Skip to content

Commit 5d499dc

Browse files
authored
fix(cdk): use built-in source map support (#32115)
### Reason for this change We don't need to use the third party `source-map-support` package anymore to achieve the same result. ### Description of changes We use `process.setSourceMapsEnabled(true)` instead. However unlike the previous package, this command needs to be run _before_ we import any other files, otherwise it won't work. We therefore move it into the executable. ### Description of how you validated changes Manual verification ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 9ef4e72 commit 5d499dc

File tree

7 files changed

+14
-551
lines changed

7 files changed

+14
-551
lines changed

Diff for: packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES

-474
Large diffs are not rendered by default.

Diff for: packages/@aws-cdk/cli-lib-alpha/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"aws-cdk-lib": "0.0.0",
8888
"@aws-cdk/pkglint": "0.0.0",
8989
"@types/jest": "^29.5.14",
90+
"@types/node": "^18.18.14",
9091
"aws-cdk": "0.0.0",
9192
"constructs": "^10.0.0",
9293
"jest": "^29.7.0",

Diff for: packages/aws-cdk/THIRD_PARTY_LICENSES

-63
Original file line numberDiff line numberDiff line change
@@ -27682,32 +27682,6 @@ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TOR
2768227682
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2768327683

2768427684

27685-
----------------
27686-
27687-
** [email protected] - https://www.npmjs.com/package/buffer-from/v/1.1.2 | MIT
27688-
MIT License
27689-
27690-
Copyright (c) 2016, 2018 Linus Unnebäck
27691-
27692-
Permission is hereby granted, free of charge, to any person obtaining a copy
27693-
of this software and associated documentation files (the "Software"), to deal
27694-
in the Software without restriction, including without limitation the rights
27695-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27696-
copies of the Software, and to permit persons to whom the Software is
27697-
furnished to do so, subject to the following conditions:
27698-
27699-
The above copyright notice and this permission notice shall be included in all
27700-
copies or substantial portions of the Software.
27701-
27702-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27703-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27704-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27705-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27706-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27707-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27708-
SOFTWARE.
27709-
27710-
2771127685
----------------
2771227686

2771327687
** [email protected] - https://www.npmjs.com/package/camelcase/v/6.3.0 | MIT
@@ -29730,43 +29704,6 @@ The above copyright notice and this permission notice shall be included in all c
2973029704
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2973129705

2973229706

29733-
----------------
29734-
29735-
** [email protected] - https://www.npmjs.com/package/source-map-support/v/0.5.21 | MIT
29736-
29737-
----------------
29738-
29739-
** [email protected] - https://www.npmjs.com/package/source-map/v/0.6.1 | BSD-3-Clause
29740-
29741-
Copyright (c) 2009-2011, Mozilla Foundation and contributors
29742-
All rights reserved.
29743-
29744-
Redistribution and use in source and binary forms, with or without
29745-
modification, are permitted provided that the following conditions are met:
29746-
29747-
* Redistributions of source code must retain the above copyright notice, this
29748-
list of conditions and the following disclaimer.
29749-
29750-
* Redistributions in binary form must reproduce the above copyright notice,
29751-
this list of conditions and the following disclaimer in the documentation
29752-
and/or other materials provided with the distribution.
29753-
29754-
* Neither the names of the Mozilla Foundation nor the names of project
29755-
contributors may be used to endorse or promote products derived from this
29756-
software without specific prior written permission.
29757-
29758-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
29759-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29760-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29761-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29762-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29763-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29764-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29765-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29766-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29767-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29768-
29769-
2977029707
----------------
2977129708

2977229709
** [email protected] - https://www.npmjs.com/package/string_decoder/v/1.1.1 | MIT

Diff for: packages/aws-cdk/bin/cdk

+5
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
#!/usr/bin/env node
2+
3+
// source maps must be enabled before importing files
4+
if (process.argv.includes('--debug')) {
5+
process.setSourceMapsEnabled(true);
6+
}
27
require('./cdk.js');

Diff for: packages/aws-cdk/lib/cli.ts

-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as cxapi from '@aws-cdk/cx-api';
22
import '@jsii/check-node/run';
33
import * as chalk from 'chalk';
4-
import { install as enableSourceMapSupport } from 'source-map-support';
54

65
import { DeploymentMethod } from './api';
76
import { HotswapMode } from './api/hotswap/common';
@@ -53,10 +52,6 @@ export async function exec(args: string[], synthesizer?: Synthesizer): Promise<n
5352
setLogLevel(argv.verbose);
5453
}
5554

56-
if (argv.debug) {
57-
enableSourceMapSupport();
58-
}
59-
6055
// Debug should always imply tracing
6156
if (argv.debug || argv.verbose > 2) {
6257
enableTracing(true);

Diff for: packages/aws-cdk/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@
7676
"@types/fs-extra": "^9.0.13",
7777
"@types/glob": "^7.2.0",
7878
"@types/jest": "^29.5.12",
79+
"@types/node": "^18.18.14",
7980
"@types/mockery": "^1.4.33",
8081
"@types/promptly": "^3.0.5",
8182
"@types/semver": "^7.5.8",
8283
"@types/sinon": "^9.0.11",
83-
"@types/source-map-support": "^0.5.10",
8484
"@types/table": "^6.3.2",
8585
"@types/uuid": "^8.3.4",
8686
"@types/wrap-ansi": "^3.0.0",
@@ -149,7 +149,6 @@
149149
"promptly": "^3.2.0",
150150
"proxy-agent": "^6.4.0",
151151
"semver": "^7.6.3",
152-
"source-map-support": "^0.5.21",
153152
"strip-ansi": "^6.0.1",
154153
"table": "^6.8.2",
155154
"uuid": "^8.3.2",

Diff for: yarn.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -6315,6 +6315,13 @@
63156315
dependencies:
63166316
undici-types "~5.26.4"
63176317

6318+
"@types/node@^18.18.14":
6319+
version "18.19.64"
6320+
resolved "https://registry.npmjs.org/@types/node/-/node-18.19.64.tgz#122897fb79f2a9ec9c979bded01c11461b2b1478"
6321+
integrity sha512-955mDqvO2vFf/oL7V3WiUtiz+BugyX8uVbaT2H8oj3+8dRyH2FLiNdowe7eNqRM7IOIZvzDH76EoAT+gwm6aIQ==
6322+
dependencies:
6323+
undici-types "~5.26.4"
6324+
63186325
"@types/normalize-package-data@^2.4.0":
63196326
version "2.4.4"
63206327
resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901"
@@ -6385,13 +6392,6 @@
63856392
resolved "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.5.tgz#5fd3592ff10c1e9695d377020c033116cc2889f2"
63866393
integrity sha512-mQkU2jY8jJEF7YHjHvsQO8+3ughTL1mcnn96igfhONmR+fUPSKIkefQYpSe8bsly2Ep7oQbn/6VG5/9/0qcArQ==
63876394

6388-
"@types/source-map-support@^0.5.10":
6389-
version "0.5.10"
6390-
resolved "https://registry.npmjs.org/@types/source-map-support/-/source-map-support-0.5.10.tgz#824dcef989496bae98e9d04c8dc1ac1d70e1bd39"
6391-
integrity sha512-tgVP2H469x9zq34Z0m/fgPewGhg/MLClalNOiPIzQlXrSS2YrKu/xCdSCKnEDwkFha51VKEKB6A9wW26/ZNwzA==
6392-
dependencies:
6393-
source-map "^0.6.0"
6394-
63956395
"@types/stack-utils@^2.0.0":
63966396
version "2.0.3"
63976397
resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8"

0 commit comments

Comments
 (0)