@nikovirtala/projen-constructs 0.3.66 → 0.3.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +417 -265
- package/docs/api/assets/search.js +1 -1
- package/docs/api/interfaces/AwsCdkConstructLibraryProjectOptions.html +171 -139
- package/docs/api/interfaces/AwsCdkTypeScriptAppProjectOptions.html +163 -131
- package/docs/api/interfaces/JsiiProjectOptions.html +171 -139
- package/docs/api/interfaces/TypeScriptProjectOptions.html +155 -123
- package/lib/components/bundle-lambda-function-code.js +3 -3
- package/lib/components/colima.js +1 -1
- package/lib/components/homebrew.js +1 -1
- package/lib/components/lambda-function-construct-generator.js +1 -1
- package/lib/components/localstack.js +1 -1
- package/lib/components/mise.js +1 -1
- package/lib/components/typedoc.js +1 -1
- package/lib/components/vitest.js +1 -1
- package/lib/project-generator.js +1 -1
- package/lib/projects/awscdk-construct-library-options.generated.d.ts +14 -0
- package/lib/projects/awscdk-construct-library-options.generated.js +1 -1
- package/lib/projects/awscdk-construct-library.generated.js +1 -1
- package/lib/projects/awscdk-typescript-app-options.generated.d.ts +14 -0
- package/lib/projects/awscdk-typescript-app-options.generated.js +1 -1
- package/lib/projects/awscdk-typescript-app.generated.js +1 -1
- package/lib/projects/jsii-options.generated.d.ts +14 -0
- package/lib/projects/jsii-options.generated.js +1 -1
- package/lib/projects/jsii.generated.js +1 -1
- package/lib/projects/typescript-options.generated.d.ts +14 -0
- package/lib/projects/typescript-options.generated.js +1 -1
- package/lib/projects/typescript.generated.js +1 -1
- package/lib/versions.json +2 -2
- package/node_modules/@jsii/spec/lib/assembly-utils.js +39 -1
- package/node_modules/@jsii/spec/package.json +3 -3
- package/package.json +8 -8
|
@@ -114,6 +114,12 @@ function writeAssembly(directory, assembly, { compress = false } = {}) {
|
|
|
114
114
|
}
|
|
115
115
|
return compress;
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* The maximum number of `jsii/file-redirect` hops followed when loading an
|
|
119
|
+
* assembly. The jsii compiler only ever emits a single redirect (to the
|
|
120
|
+
* compressed assembly), so this leaves ample headroom while preventing loops.
|
|
121
|
+
*/
|
|
122
|
+
const MAX_ASSEMBLY_REDIRECTS = 5;
|
|
117
123
|
const failNoReadfileProvided = (filename) => {
|
|
118
124
|
throw new Error(`Unable to load assembly support file ${JSON.stringify(filename)}: no readFile callback provided!`);
|
|
119
125
|
};
|
|
@@ -129,7 +135,11 @@ const failNoReadfileProvided = (filename) => {
|
|
|
129
135
|
function loadAssemblyFromBuffer(assemblyBuffer, readFile = failNoReadfileProvided, validate = true, supportedFeatures = []) {
|
|
130
136
|
let contents = JSON.parse(assemblyBuffer.toString('utf-8'));
|
|
131
137
|
// check if the file holds instructions to the actual assembly file
|
|
138
|
+
let redirects = 0;
|
|
132
139
|
while ((0, redirect_1.isAssemblyRedirect)(contents)) {
|
|
140
|
+
if (++redirects > MAX_ASSEMBLY_REDIRECTS) {
|
|
141
|
+
throw new Error(`Too many assembly redirects (more than ${MAX_ASSEMBLY_REDIRECTS})`);
|
|
142
|
+
}
|
|
133
143
|
contents = followRedirect(contents, readFile);
|
|
134
144
|
}
|
|
135
145
|
// Do feature checking *before* validating using JSONSchema, and do it always.
|
|
@@ -166,15 +176,43 @@ function loadAssemblyFromPath(directory, validate = true, supportedFeatures) {
|
|
|
166
176
|
function loadAssemblyFromFile(pathToFile, validate = true, supportedFeatures) {
|
|
167
177
|
const data = fs.readFileSync(pathToFile);
|
|
168
178
|
try {
|
|
169
|
-
return loadAssemblyFromBuffer(data, (filename) =>
|
|
179
|
+
return loadAssemblyFromBuffer(data, (filename) => readSupportFile(path.dirname(pathToFile), filename), validate, supportedFeatures);
|
|
170
180
|
}
|
|
171
181
|
catch (e) {
|
|
172
182
|
throw new Error(`Error loading assembly from file ${pathToFile}:\n${e}`);
|
|
173
183
|
}
|
|
174
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Reads an assembly support file, making sure it is located inside `directory`
|
|
187
|
+
* (after resolving any symbolic links).
|
|
188
|
+
*/
|
|
189
|
+
function readSupportFile(directory, filename) {
|
|
190
|
+
const realDir = fs.realpathSync(directory);
|
|
191
|
+
const realFile = fs.realpathSync(path.resolve(realDir, filename));
|
|
192
|
+
const relative = path.relative(realDir, realFile);
|
|
193
|
+
if (relative === '' ||
|
|
194
|
+
relative === '..' ||
|
|
195
|
+
relative.startsWith(`..${path.sep}`) ||
|
|
196
|
+
path.isAbsolute(relative)) {
|
|
197
|
+
throw new Error(`Assembly redirect target ${JSON.stringify(filename)} resolves outside of ${directory}`);
|
|
198
|
+
}
|
|
199
|
+
return fs.readFileSync(realFile);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Lexically checks that a redirect `filename` is a relative path that does not
|
|
203
|
+
* escape the directory containing the redirect.
|
|
204
|
+
*/
|
|
205
|
+
function assertRelativeRedirectFilename(filename) {
|
|
206
|
+
if (path.posix.isAbsolute(filename) ||
|
|
207
|
+
path.win32.isAbsolute(filename) ||
|
|
208
|
+
filename.split(/[\\/]/).includes('..')) {
|
|
209
|
+
throw new Error(`Invalid assembly redirect filename ${JSON.stringify(filename)}: must be a relative path inside the package`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
175
212
|
function followRedirect(assemblyRedirect, readFile) {
|
|
176
213
|
// Validating the schema, this is cheap (the schema is small).
|
|
177
214
|
(0, redirect_1.validateAssemblyRedirect)(assemblyRedirect);
|
|
215
|
+
assertRelativeRedirectFilename(assemblyRedirect.filename);
|
|
178
216
|
let data = readFile(assemblyRedirect.filename);
|
|
179
217
|
switch (assemblyRedirect.compression) {
|
|
180
218
|
case 'gzip':
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsii/spec",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.142.0",
|
|
4
4
|
"description": "Specification for jsii assemblies",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"ajv": "^8.20.0",
|
|
35
35
|
"esbuild": "^0.28.2",
|
|
36
36
|
"eslint": "^9.39.5",
|
|
37
|
-
"jest": "^30.5.
|
|
38
|
-
"jsii-build-tools": "^1.
|
|
37
|
+
"jest": "^30.5.2",
|
|
38
|
+
"jsii-build-tools": "^1.142.0",
|
|
39
39
|
"typescript": "6.x",
|
|
40
40
|
"typescript-json-schema": "^0.68.0"
|
|
41
41
|
}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@biomejs/biome": "^2.5",
|
|
15
|
-
"@jsii/spec": "^1.
|
|
15
|
+
"@jsii/spec": "^1.142.0",
|
|
16
16
|
"@mrgrain/cdk-esbuild": "5.8.5",
|
|
17
17
|
"@types/node": "^24",
|
|
18
18
|
"@vitest/coverage-v8": "^4",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"constructs": "^10.8.1",
|
|
21
21
|
"esbuild": "^0.28.2",
|
|
22
22
|
"jsii": "~6.0.3",
|
|
23
|
-
"jsii-diff": "^1.
|
|
23
|
+
"jsii-diff": "^1.142.0",
|
|
24
24
|
"jsii-docgen": "^10.5.0",
|
|
25
|
-
"jsii-pacmak": "^1.
|
|
25
|
+
"jsii-pacmak": "^1.142.0",
|
|
26
26
|
"jsii-rosetta": "~6.0.3",
|
|
27
|
-
"projen": "^0.104.
|
|
27
|
+
"projen": "^0.104.12",
|
|
28
28
|
"tsx": "^4.23.15",
|
|
29
29
|
"typedoc": "^0.28",
|
|
30
30
|
"typescript": "6.0.3",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@mrgrain/cdk-esbuild": "^5.8.5",
|
|
35
35
|
"constructs": "^10.8.1",
|
|
36
|
-
"projen": "^0.104.
|
|
36
|
+
"projen": "^0.104.12"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@mrgrain/jsii-struct-builder": "^0.7.64",
|
|
40
40
|
"case": "^1.6.3",
|
|
41
|
-
"projen": "^0.104.
|
|
41
|
+
"projen": "^0.104.12"
|
|
42
42
|
},
|
|
43
43
|
"bundledDependencies": [
|
|
44
44
|
"@mrgrain/jsii-struct-builder",
|
|
45
45
|
"case"
|
|
46
46
|
],
|
|
47
47
|
"engines": {
|
|
48
|
-
"node": ">= 24.22.
|
|
48
|
+
"node": ">= 24.22.1"
|
|
49
49
|
},
|
|
50
50
|
"devEngines": {
|
|
51
51
|
"packageManager": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"version": "0.3.
|
|
63
|
+
"version": "0.3.68",
|
|
64
64
|
"types": "lib/index.d.ts",
|
|
65
65
|
"jsii": {
|
|
66
66
|
"outdir": "dist",
|