Skip to content

Commit b1ffd33

Browse files
committed
fix(codebuild): module fails to load with error "Cannot use import statement outside a module"
The bundling done in #13699 is somehow only putting the TypeScript files in the resulting NPM bundle, and thus causing the above error (from Node trying to execute TypeScript). This reverts commit 41a2b2e from PR #13699.
1 parent 28ba8b4 commit b1ffd33

File tree

14 files changed

+43
-140
lines changed

14 files changed

+43
-140
lines changed

package.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@
5151
"nohoist": [
5252
"**/jszip",
5353
"**/jszip/**",
54-
"@aws-cdk/aws-codebuild/@aws-cdk/yaml-cfn",
55-
"@aws-cdk/aws-codebuild/@aws-cdk/yaml-cfn/yaml",
56-
"@aws-cdk/aws-codebuild/@aws-cdk/yaml-cfn/yaml/**",
5754
"@aws-cdk/aws-codepipeline-actions/case",
5855
"@aws-cdk/aws-codepipeline-actions/case/**",
5956
"@aws-cdk/aws-cognito/punycode",
@@ -66,9 +63,6 @@
6663
"@aws-cdk/cloud-assembly-schema/jsonschema/**",
6764
"@aws-cdk/cloud-assembly-schema/semver",
6865
"@aws-cdk/cloud-assembly-schema/semver/**",
69-
"@aws-cdk/cloudformation-include/@aws-cdk/yaml-cfn",
70-
"@aws-cdk/cloudformation-include/@aws-cdk/yaml-cfn/yaml",
71-
"@aws-cdk/cloudformation-include/@aws-cdk/yaml-cfn/yaml/**",
7266
"@aws-cdk/core/@balena/dockerignore",
7367
"@aws-cdk/core/@balena/dockerignore/**",
7468
"@aws-cdk/core/fs-extra",
@@ -81,9 +75,6 @@
8175
"@aws-cdk/cx-api/semver/**",
8276
"@aws-cdk/yaml-cfn/yaml",
8377
"@aws-cdk/yaml-cfn/yaml/**",
84-
"aws-cdk-lib/@aws-cdk/yaml-cfn",
85-
"aws-cdk-lib/@aws-cdk/yaml-cfn/yaml",
86-
"aws-cdk-lib/@aws-cdk/yaml-cfn/yaml/**",
8778
"aws-cdk-lib/@balena/dockerignore",
8879
"aws-cdk-lib/@balena/dockerignore/**",
8980
"aws-cdk-lib/case",
@@ -102,9 +93,6 @@
10293
"aws-cdk-lib/semver/**",
10394
"aws-cdk-lib/yaml",
10495
"aws-cdk-lib/yaml/**",
105-
"monocdk/@aws-cdk/yaml-cfn",
106-
"monocdk/@aws-cdk/yaml-cfn/yaml",
107-
"monocdk/@aws-cdk/yaml-cfn/yaml/**",
10896
"monocdk/@balena/dockerignore",
10997
"monocdk/@balena/dockerignore/**",
11098
"monocdk/case",

packages/@aws-cdk/aws-codebuild/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@
103103
"@aws-cdk/yaml-cfn": "0.0.0",
104104
"constructs": "^3.3.69"
105105
},
106-
"bundledDependencies": [
107-
"@aws-cdk/yaml-cfn"
108-
],
109106
"homepage": "https://github.com/aws/aws-cdk",
110107
"peerDependencies": {
111108
"@aws-cdk/aws-cloudwatch": "0.0.0",
@@ -122,6 +119,7 @@
122119
"@aws-cdk/aws-secretsmanager": "0.0.0",
123120
"@aws-cdk/core": "0.0.0",
124121
"@aws-cdk/region-info": "0.0.0",
122+
"@aws-cdk/yaml-cfn": "0.0.0",
125123
"constructs": "^3.3.69"
126124
},
127125
"engines": {

packages/@aws-cdk/cloudformation-include/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
"@aws-cdk/aws-wafv2": "0.0.0",
364364
"@aws-cdk/aws-workspaces": "0.0.0",
365365
"@aws-cdk/core": "0.0.0",
366+
"@aws-cdk/yaml-cfn": "0.0.0",
366367
"constructs": "^3.3.69"
367368
},
368369
"devDependencies": {
@@ -374,9 +375,6 @@
374375
"pkglint": "0.0.0",
375376
"ts-jest": "^26.5.4"
376377
},
377-
"bundledDependencies": [
378-
"@aws-cdk/yaml-cfn"
379-
],
380378
"keywords": [
381379
"aws",
382380
"cdk",

packages/@aws-cdk/yaml-cfn/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*.d.ts
44
node_modules
55
dist
6+
tsconfig.json
67
.jsii
78

89
.LAST_BUILD
@@ -14,4 +15,4 @@ nyc.config.js
1415
!.eslintrc.js
1516
!jest.config.js
1617

17-
junit.xml
18+
junit.xml

packages/@aws-cdk/yaml-cfn/package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,32 @@
2323
"cloudformation",
2424
"yaml"
2525
],
26+
"jsii": {
27+
"outdir": "dist",
28+
"targets": {
29+
"java": {
30+
"package": "software.amazon.awscdk.yaml.cfn",
31+
"maven": {
32+
"groupId": "software.amazon.awscdk",
33+
"artifactId": "cdk-yaml-cfn"
34+
}
35+
},
36+
"dotnet": {
37+
"namespace": "Amazon.CDK.Yaml.Cfn",
38+
"packageId": "Amazon.CDK.Yaml.Cfn",
39+
"iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/master/logo/default-256-dark.png"
40+
},
41+
"python": {
42+
"distName": "aws-cdk.yaml-cfn",
43+
"module": "aws_cdk.yaml_cfn",
44+
"classifiers": [
45+
"Framework :: AWS CDK",
46+
"Framework :: AWS CDK :: 1"
47+
]
48+
}
49+
},
50+
"projectReferences": true
51+
},
2652
"scripts": {
2753
"build": "cdk-build",
2854
"watch": "cdk-watch",

packages/@aws-cdk/yaml-cfn/tsconfig.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/aws-cdk-lib/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
},
8282
"license": "Apache-2.0",
8383
"bundledDependencies": [
84-
"@aws-cdk/yaml-cfn",
8584
"@balena/dockerignore",
8685
"case",
8786
"fs-extra",
@@ -93,7 +92,6 @@
9392
"yaml"
9493
],
9594
"dependencies": {
96-
"@aws-cdk/yaml-cfn": "0.0.0",
9795
"@balena/dockerignore": "^1.0.2",
9896
"case": "1.6.3",
9997
"fs-extra": "^9.1.0",

packages/decdk/test/schema.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ test('schemaForInterface: interface with primitives', async () => {
7979
* are propagated outwards.
8080
*/
8181
function spawn(command: string, options: SpawnOptions | undefined) {
82-
return new Promise<void>((resolve, reject) => {
82+
return new Promise((resolve, reject) => {
8383
const cp = spawnAsync(command, [], { stdio: 'inherit', ...options });
8484

8585
cp.on('error', reject);

packages/monocdk/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
},
8888
"license": "Apache-2.0",
8989
"bundledDependencies": [
90-
"@aws-cdk/yaml-cfn",
9190
"@balena/dockerignore",
9291
"case",
9392
"fs-extra",
@@ -99,7 +98,6 @@
9998
"yaml"
10099
],
101100
"dependencies": {
102-
"@aws-cdk/yaml-cfn": "0.0.0",
103101
"@balena/dockerignore": "^1.0.2",
104102
"case": "1.6.3",
105103
"fs-extra": "^9.1.0",

tools/nodeunit-shim/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function nodeunitShim(exports: Record<string, any>) {
8181
});
8282
} else {
8383
// It's a test
84-
test(testName, () => new Promise<void>(ok => {
84+
test(testName, () => new Promise(ok => {
8585
testObj(new Test(ok));
8686
}));
8787
}

0 commit comments

Comments
 (0)