@bleedingdev/modern-js-app-tools-extensions 3.9.3-ultramodern.10 → 3.9.3-ultramodern.11
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/dist/cjs/cloudflare-output-verifier/mutation-policy.js +24 -3
- package/dist/esm/cloudflare-output-verifier/mutation-policy.mjs +24 -3
- package/dist/esm-node/cloudflare-output-verifier/mutation-policy.mjs +24 -3
- package/package.json +16 -16
- package/src/cloudflare-output-verifier/mutation-policy.ts +41 -3
|
@@ -45,7 +45,8 @@ var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObj
|
|
|
45
45
|
const external_node_path_namespaceObject = require("node:path");
|
|
46
46
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
47
47
|
const external_issues_js_namespaceObject = require("./issues.js");
|
|
48
|
-
const SOURCE_SCAN_FILE_PATTERN = /\.(?:[cm]?[jt]
|
|
48
|
+
const SOURCE_SCAN_FILE_PATTERN = /\.(?:[cm]?[jt]sx?)$/u;
|
|
49
|
+
const DECLARATION_FILE_PATTERN = /\.d\.[cm]?ts$/u;
|
|
49
50
|
const SOURCE_SCAN_IGNORED_DIRECTORY_NAMES = new Set([
|
|
50
51
|
'.codex',
|
|
51
52
|
'.fastcontext',
|
|
@@ -118,7 +119,7 @@ const walkFiles = async (root)=>{
|
|
|
118
119
|
files.push(...await walkFiles(entryPath));
|
|
119
120
|
continue;
|
|
120
121
|
}
|
|
121
|
-
if (SOURCE_SCAN_FILE_PATTERN.test(entry.name)) files.push(entryPath);
|
|
122
|
+
if ('package.json' === entry.name || SOURCE_SCAN_FILE_PATTERN.test(entry.name) && !DECLARATION_FILE_PATTERN.test(entry.name)) files.push(entryPath);
|
|
122
123
|
}
|
|
123
124
|
return files;
|
|
124
125
|
};
|
|
@@ -135,7 +136,26 @@ const verifyCloudflareOutputMutationPolicy = async (options)=>{
|
|
|
135
136
|
if ('ENOENT' === error.code) continue;
|
|
136
137
|
throw error;
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
+
let executableSources = [
|
|
140
|
+
source
|
|
141
|
+
];
|
|
142
|
+
if ('package.json' === external_node_path_default().basename(file)) try {
|
|
143
|
+
const manifest = JSON.parse(source);
|
|
144
|
+
if (!isRecord(manifest)) throw new TypeError('Package metadata must be an object.');
|
|
145
|
+
const scripts = Object.hasOwn(manifest, "scripts") ? manifest.scripts : {};
|
|
146
|
+
if (!isRecord(scripts)) throw new TypeError("Package scripts must be an object.");
|
|
147
|
+
const commands = Object.values(scripts);
|
|
148
|
+
if (!commands.every((value)=>'string' == typeof value)) throw new TypeError("Package scripts must contain only strings.");
|
|
149
|
+
executableSources = commands;
|
|
150
|
+
} catch {
|
|
151
|
+
(0, external_issues_js_namespaceObject.addIssue)(issues, {
|
|
152
|
+
code: 'invalid-package',
|
|
153
|
+
message: "Cannot verify executable package lifecycle scripts: invalid package metadata.",
|
|
154
|
+
path: file
|
|
155
|
+
});
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
for (const forbidden of FORBIDDEN_MUTATION_PATTERNS)if (executableSources.some((value)=>forbidden.pattern.test(value))) (0, external_issues_js_namespaceObject.addIssue)(issues, {
|
|
139
159
|
code: forbidden.code,
|
|
140
160
|
message: forbidden.message,
|
|
141
161
|
path: file
|
|
@@ -146,6 +166,7 @@ const verifyCloudflareOutputMutationPolicy = async (options)=>{
|
|
|
146
166
|
issues
|
|
147
167
|
};
|
|
148
168
|
};
|
|
169
|
+
const isRecord = (value)=>null !== value && 'object' == typeof value && !Array.isArray(value);
|
|
149
170
|
exports.verifyCloudflareOutputMutationPolicy = __webpack_exports__.verifyCloudflareOutputMutationPolicy;
|
|
150
171
|
exports.walkFiles = __webpack_exports__.walkFiles;
|
|
151
172
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import promises from "node:fs/promises";
|
|
2
2
|
import node_path from "node:path";
|
|
3
3
|
import { addIssue } from "./issues.mjs";
|
|
4
|
-
const SOURCE_SCAN_FILE_PATTERN = /\.(?:[cm]?[jt]
|
|
4
|
+
const SOURCE_SCAN_FILE_PATTERN = /\.(?:[cm]?[jt]sx?)$/u;
|
|
5
|
+
const DECLARATION_FILE_PATTERN = /\.d\.[cm]?ts$/u;
|
|
5
6
|
const SOURCE_SCAN_IGNORED_DIRECTORY_NAMES = new Set([
|
|
6
7
|
'.codex',
|
|
7
8
|
'.fastcontext',
|
|
@@ -74,7 +75,7 @@ const walkFiles = async (root)=>{
|
|
|
74
75
|
files.push(...await walkFiles(entryPath));
|
|
75
76
|
continue;
|
|
76
77
|
}
|
|
77
|
-
if (SOURCE_SCAN_FILE_PATTERN.test(entry.name)) files.push(entryPath);
|
|
78
|
+
if ('package.json' === entry.name || SOURCE_SCAN_FILE_PATTERN.test(entry.name) && !DECLARATION_FILE_PATTERN.test(entry.name)) files.push(entryPath);
|
|
78
79
|
}
|
|
79
80
|
return files;
|
|
80
81
|
};
|
|
@@ -91,7 +92,26 @@ const verifyCloudflareOutputMutationPolicy = async (options)=>{
|
|
|
91
92
|
if ('ENOENT' === error.code) continue;
|
|
92
93
|
throw error;
|
|
93
94
|
}
|
|
94
|
-
|
|
95
|
+
let executableSources = [
|
|
96
|
+
source
|
|
97
|
+
];
|
|
98
|
+
if ('package.json' === node_path.basename(file)) try {
|
|
99
|
+
const manifest = JSON.parse(source);
|
|
100
|
+
if (!isRecord(manifest)) throw new TypeError('Package metadata must be an object.');
|
|
101
|
+
const scripts = Object.hasOwn(manifest, "scripts") ? manifest.scripts : {};
|
|
102
|
+
if (!isRecord(scripts)) throw new TypeError("Package scripts must be an object.");
|
|
103
|
+
const commands = Object.values(scripts);
|
|
104
|
+
if (!commands.every((value)=>'string' == typeof value)) throw new TypeError("Package scripts must contain only strings.");
|
|
105
|
+
executableSources = commands;
|
|
106
|
+
} catch {
|
|
107
|
+
addIssue(issues, {
|
|
108
|
+
code: 'invalid-package',
|
|
109
|
+
message: "Cannot verify executable package lifecycle scripts: invalid package metadata.",
|
|
110
|
+
path: file
|
|
111
|
+
});
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
for (const forbidden of FORBIDDEN_MUTATION_PATTERNS)if (executableSources.some((value)=>forbidden.pattern.test(value))) addIssue(issues, {
|
|
95
115
|
code: forbidden.code,
|
|
96
116
|
message: forbidden.message,
|
|
97
117
|
path: file
|
|
@@ -102,4 +122,5 @@ const verifyCloudflareOutputMutationPolicy = async (options)=>{
|
|
|
102
122
|
issues
|
|
103
123
|
};
|
|
104
124
|
};
|
|
125
|
+
const isRecord = (value)=>null !== value && 'object' == typeof value && !Array.isArray(value);
|
|
105
126
|
export { verifyCloudflareOutputMutationPolicy, walkFiles };
|
|
@@ -2,7 +2,8 @@ import "node:module";
|
|
|
2
2
|
import promises from "node:fs/promises";
|
|
3
3
|
import node_path from "node:path";
|
|
4
4
|
import { addIssue } from "./issues.mjs";
|
|
5
|
-
const SOURCE_SCAN_FILE_PATTERN = /\.(?:[cm]?[jt]
|
|
5
|
+
const SOURCE_SCAN_FILE_PATTERN = /\.(?:[cm]?[jt]sx?)$/u;
|
|
6
|
+
const DECLARATION_FILE_PATTERN = /\.d\.[cm]?ts$/u;
|
|
6
7
|
const SOURCE_SCAN_IGNORED_DIRECTORY_NAMES = new Set([
|
|
7
8
|
'.codex',
|
|
8
9
|
'.fastcontext',
|
|
@@ -75,7 +76,7 @@ const walkFiles = async (root)=>{
|
|
|
75
76
|
files.push(...await walkFiles(entryPath));
|
|
76
77
|
continue;
|
|
77
78
|
}
|
|
78
|
-
if (SOURCE_SCAN_FILE_PATTERN.test(entry.name)) files.push(entryPath);
|
|
79
|
+
if ('package.json' === entry.name || SOURCE_SCAN_FILE_PATTERN.test(entry.name) && !DECLARATION_FILE_PATTERN.test(entry.name)) files.push(entryPath);
|
|
79
80
|
}
|
|
80
81
|
return files;
|
|
81
82
|
};
|
|
@@ -92,7 +93,26 @@ const verifyCloudflareOutputMutationPolicy = async (options)=>{
|
|
|
92
93
|
if ('ENOENT' === error.code) continue;
|
|
93
94
|
throw error;
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
+
let executableSources = [
|
|
97
|
+
source
|
|
98
|
+
];
|
|
99
|
+
if ('package.json' === node_path.basename(file)) try {
|
|
100
|
+
const manifest = JSON.parse(source);
|
|
101
|
+
if (!isRecord(manifest)) throw new TypeError('Package metadata must be an object.');
|
|
102
|
+
const scripts = Object.hasOwn(manifest, "scripts") ? manifest.scripts : {};
|
|
103
|
+
if (!isRecord(scripts)) throw new TypeError("Package scripts must be an object.");
|
|
104
|
+
const commands = Object.values(scripts);
|
|
105
|
+
if (!commands.every((value)=>'string' == typeof value)) throw new TypeError("Package scripts must contain only strings.");
|
|
106
|
+
executableSources = commands;
|
|
107
|
+
} catch {
|
|
108
|
+
addIssue(issues, {
|
|
109
|
+
code: 'invalid-package',
|
|
110
|
+
message: "Cannot verify executable package lifecycle scripts: invalid package metadata.",
|
|
111
|
+
path: file
|
|
112
|
+
});
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
for (const forbidden of FORBIDDEN_MUTATION_PATTERNS)if (executableSources.some((value)=>forbidden.pattern.test(value))) addIssue(issues, {
|
|
96
116
|
code: forbidden.code,
|
|
97
117
|
message: forbidden.message,
|
|
98
118
|
path: file
|
|
@@ -103,4 +123,5 @@ const verifyCloudflareOutputMutationPolicy = async (options)=>{
|
|
|
103
123
|
issues
|
|
104
124
|
};
|
|
105
125
|
};
|
|
126
|
+
const isRecord = (value)=>null !== value && 'object' == typeof value && !Array.isArray(value);
|
|
106
127
|
export { verifyCloudflareOutputMutationPolicy, walkFiles };
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/solutions/app-tools-extensions"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"version": "3.9.3-ultramodern.
|
|
14
|
+
"version": "3.9.3-ultramodern.11",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"src"
|
|
@@ -177,16 +177,16 @@
|
|
|
177
177
|
"dependencies": {
|
|
178
178
|
"@babel/parser": "^8.0.7",
|
|
179
179
|
"@babel/traverse": "^8.0.7",
|
|
180
|
-
"@modern-js/backend-federation-contracts": "npm:@bleedingdev/modern-js-backend-federation-contracts@3.9.3-ultramodern.
|
|
181
|
-
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.3-ultramodern.
|
|
182
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.3-ultramodern.
|
|
183
|
-
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.3-ultramodern.
|
|
184
|
-
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.3-ultramodern.
|
|
185
|
-
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.3-ultramodern.
|
|
186
|
-
"@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.3-ultramodern.
|
|
187
|
-
"@modern-js/surface-resolution": "npm:@bleedingdev/modern-js-surface-resolution@3.9.3-ultramodern.
|
|
188
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.3-ultramodern.
|
|
189
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.3-ultramodern.
|
|
180
|
+
"@modern-js/backend-federation-contracts": "npm:@bleedingdev/modern-js-backend-federation-contracts@3.9.3-ultramodern.11",
|
|
181
|
+
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.3-ultramodern.11",
|
|
182
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.3-ultramodern.11",
|
|
183
|
+
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.3-ultramodern.11",
|
|
184
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.3-ultramodern.11",
|
|
185
|
+
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.3-ultramodern.11",
|
|
186
|
+
"@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.3-ultramodern.11",
|
|
187
|
+
"@modern-js/surface-resolution": "npm:@bleedingdev/modern-js-surface-resolution@3.9.3-ultramodern.11",
|
|
188
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.3-ultramodern.11",
|
|
189
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.3-ultramodern.11",
|
|
190
190
|
"@swc/helpers": "^0.5.23",
|
|
191
191
|
"@vercel/nft": "^1.11.0",
|
|
192
192
|
"compression-webpack-plugin": "^12.0.0",
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
},
|
|
197
197
|
"peerDependencies": {
|
|
198
198
|
"@loadable/component": "5.16.7",
|
|
199
|
-
"@modern-js/runtime-renderer-extensions": "3.9.3-ultramodern.
|
|
199
|
+
"@modern-js/runtime-renderer-extensions": "3.9.3-ultramodern.11",
|
|
200
200
|
"@rsbuild/core": "2.2.13",
|
|
201
201
|
"react": "^19.3.1"
|
|
202
202
|
},
|
|
@@ -213,10 +213,10 @@
|
|
|
213
213
|
},
|
|
214
214
|
"devDependencies": {
|
|
215
215
|
"@loadable/component": "5.16.7",
|
|
216
|
-
"@modern-js/bff-effect": "npm:@bleedingdev/modern-js-bff-effect@3.9.3-ultramodern.
|
|
217
|
-
"@modern-js/plugin-bff-extensions": "npm:@bleedingdev/modern-js-plugin-bff-extensions@3.9.3-ultramodern.
|
|
218
|
-
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.3-ultramodern.
|
|
219
|
-
"@modern-js/runtime-renderer-extensions": "npm:@bleedingdev/modern-js-runtime-renderer-extensions@3.9.3-ultramodern.
|
|
216
|
+
"@modern-js/bff-effect": "npm:@bleedingdev/modern-js-bff-effect@3.9.3-ultramodern.11",
|
|
217
|
+
"@modern-js/plugin-bff-extensions": "npm:@bleedingdev/modern-js-plugin-bff-extensions@3.9.3-ultramodern.11",
|
|
218
|
+
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.3-ultramodern.11",
|
|
219
|
+
"@modern-js/runtime-renderer-extensions": "npm:@bleedingdev/modern-js-runtime-renderer-extensions@3.9.3-ultramodern.11",
|
|
220
220
|
"@module-federation/modern-js-v3": "2.9.2",
|
|
221
221
|
"@module-federation/runtime-tools": "2.9.2",
|
|
222
222
|
"@rsbuild/core": "2.2.13",
|
|
@@ -19,7 +19,8 @@ export interface VerifyCloudflareOutputMutationPolicyOptions {
|
|
|
19
19
|
excludePaths?: string[];
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const SOURCE_SCAN_FILE_PATTERN = /\.(?:[cm]?[jt]
|
|
22
|
+
const SOURCE_SCAN_FILE_PATTERN = /\.(?:[cm]?[jt]sx?)$/u;
|
|
23
|
+
const DECLARATION_FILE_PATTERN = /\.d\.[cm]?ts$/u;
|
|
23
24
|
const SOURCE_SCAN_IGNORED_DIRECTORY_NAMES = new Set([
|
|
24
25
|
'.codex',
|
|
25
26
|
'.fastcontext',
|
|
@@ -115,7 +116,11 @@ export const walkFiles = async (root: string): Promise<string[]> => {
|
|
|
115
116
|
continue;
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
if (
|
|
119
|
+
if (
|
|
120
|
+
entry.name === 'package.json' ||
|
|
121
|
+
(SOURCE_SCAN_FILE_PATTERN.test(entry.name) &&
|
|
122
|
+
!DECLARATION_FILE_PATTERN.test(entry.name))
|
|
123
|
+
) {
|
|
119
124
|
files.push(entryPath);
|
|
120
125
|
}
|
|
121
126
|
}
|
|
@@ -151,8 +156,38 @@ export const verifyCloudflareOutputMutationPolicy = async (
|
|
|
151
156
|
}
|
|
152
157
|
throw error;
|
|
153
158
|
}
|
|
159
|
+
let executableSources = [source];
|
|
160
|
+
if (path.basename(file) === 'package.json') {
|
|
161
|
+
try {
|
|
162
|
+
const manifest: unknown = JSON.parse(source);
|
|
163
|
+
if (!isRecord(manifest)) {
|
|
164
|
+
throw new TypeError('Package metadata must be an object.');
|
|
165
|
+
}
|
|
166
|
+
const scripts = Object.hasOwn(manifest, 'scripts')
|
|
167
|
+
? manifest.scripts
|
|
168
|
+
: {};
|
|
169
|
+
if (!isRecord(scripts)) {
|
|
170
|
+
throw new TypeError('Package scripts must be an object.');
|
|
171
|
+
}
|
|
172
|
+
const commands = Object.values(scripts);
|
|
173
|
+
if (
|
|
174
|
+
!commands.every((value): value is string => typeof value === 'string')
|
|
175
|
+
) {
|
|
176
|
+
throw new TypeError('Package scripts must contain only strings.');
|
|
177
|
+
}
|
|
178
|
+
executableSources = commands;
|
|
179
|
+
} catch {
|
|
180
|
+
addIssue(issues, {
|
|
181
|
+
code: 'invalid-package',
|
|
182
|
+
message:
|
|
183
|
+
'Cannot verify executable package lifecycle scripts: invalid package metadata.',
|
|
184
|
+
path: file,
|
|
185
|
+
});
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
154
189
|
for (const forbidden of FORBIDDEN_MUTATION_PATTERNS) {
|
|
155
|
-
if (forbidden.pattern.test(
|
|
190
|
+
if (executableSources.some(value => forbidden.pattern.test(value))) {
|
|
156
191
|
addIssue(issues, {
|
|
157
192
|
code: forbidden.code,
|
|
158
193
|
message: forbidden.message,
|
|
@@ -167,3 +202,6 @@ export const verifyCloudflareOutputMutationPolicy = async (
|
|
|
167
202
|
issues,
|
|
168
203
|
};
|
|
169
204
|
};
|
|
205
|
+
|
|
206
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
207
|
+
value !== null && typeof value === 'object' && !Array.isArray(value);
|