extension-develop 4.1.31 → 4.1.32
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/README.md +2 -0
- package/dist/105~0.mjs +1 -1
- package/dist/177~0.mjs +87 -19
- package/dist/273~0.mjs +13 -3
- package/dist/363~0.mjs +1874 -0
- package/dist/{896~0.mjs → 469~0.mjs} +116 -586
- package/dist/519~0.mjs +21 -8
- package/dist/616~0.mjs +1 -1
- package/dist/771~0.mjs +103 -0
- package/dist/832~0.mjs +229 -463
- package/dist/840~0.mjs +1189 -54
- package/dist/846~0.mjs +453 -0
- package/dist/852~0.mjs +8 -6
- package/dist/bridge.mjs +3 -2
- package/dist/command-preview.d.ts +1 -0
- package/dist/contract/codes.json +39 -29
- package/dist/contract/envelope.schema.json +16 -0
- package/dist/contract/golden.build.compile.json +20 -3
- package/dist/contract/golden.eval.csp-blocks-eval.page.json +15 -0
- package/dist/css-parse-guard-loader.mjs +3 -1
- package/dist/dead-css-url-loader.mjs +129 -13
- package/dist/dev-server/cleanup.d.ts +1 -1
- package/dist/dev-server/lifecycle-stream.d.ts +14 -3
- package/dist/dev-server/session-start-prune.d.ts +13 -0
- package/dist/dev-server~0.mjs +91 -14
- package/dist/ensure-hmr-for-scripts.js +4 -8
- package/dist/ensure-hmr-for-scripts.mjs +4 -8
- package/dist/extension-js-devtools/build-stamp.json +2 -2
- package/dist/extension-js-theme/build-stamp.json +2 -2
- package/dist/feature-scripts-content-script-wrapper.js +7 -4
- package/dist/feature-scripts-content-script-wrapper.mjs +7 -4
- package/dist/lib/build-summary.d.ts +4 -1
- package/dist/lib/coded-warnings.d.ts +3 -0
- package/dist/lib/compilation-diagnostics.d.ts +23 -0
- package/dist/lib/config-loader.d.ts +2 -2
- package/dist/lib/config-resolved-plugin.d.ts +3 -2
- package/dist/lib/corepack-registry.d.ts +3 -0
- package/dist/lib/diagnostic-code.d.ts +6 -0
- package/dist/lib/merge-options.d.ts +1 -0
- package/dist/lib/messages.d.ts +4 -1
- package/dist/lib/messaging.d.ts +12 -4
- package/dist/lib/output-files.d.ts +11 -0
- package/dist/lib/package-manager.d.ts +2 -2
- package/dist/module.mjs +2 -1
- package/dist/plugin-browsers/index.d.ts +1 -0
- package/dist/plugin-compatibility/compatibility-lib/free-browser-references.d.ts +9 -0
- package/dist/plugin-css/css-lib/dead-url-refs.d.ts +5 -1
- package/dist/plugin-css/css-lib/inline-content-script-css.d.ts +4 -2
- package/dist/plugin-css/css-lib/line-rewrite-source-map.d.ts +8 -0
- package/dist/plugin-css/dead-css-url-loader.d.ts +0 -2
- package/dist/plugin-css/public-css-url-loader.d.ts +8 -3
- package/dist/plugin-playwright/index.d.ts +9 -4
- package/dist/plugin-reload/classify-reload.d.ts +2 -0
- package/dist/plugin-reload/messages.d.ts +1 -0
- package/dist/plugin-reload/reload-lib/dev-content-scripts.d.ts +4 -0
- package/dist/plugin-reload/steps/prune-unreachable-chunks.d.ts +5 -0
- package/dist/plugin-special-folders/messages.d.ts +1 -1
- package/dist/plugin-special-folders/prune-removed-public-files.d.ts +7 -0
- package/dist/plugin-static-assets/check-namespace-imports.d.ts +4 -0
- package/dist/plugin-static-assets/static-assets-lib/asset-output-name.d.ts +8 -0
- package/dist/plugin-static-assets/static-assets-lib/messages.d.ts +1 -0
- package/dist/plugin-web-extension/feature-html/html-lib/utils.d.ts +2 -1
- package/dist/plugin-web-extension/feature-icons/messages.d.ts +1 -4
- package/dist/plugin-web-extension/feature-locales/get-locales.d.ts +2 -0
- package/dist/plugin-web-extension/feature-locales/messages.d.ts +3 -1
- package/dist/plugin-web-extension/feature-locales/validation.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-safari.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-overrides/common/content_scripts.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/messages.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/index.d.ts +2 -0
- package/dist/plugin-web-extension/feature-scripts/messages.d.ts +4 -3
- package/dist/plugin-web-extension/feature-scripts/scripts-lib/load-time-constants.d.ts +11 -0
- package/dist/plugin-web-extension/feature-scripts/steps/trace-runtime-loaded-files.d.ts +4 -0
- package/dist/plugin-web-extension/feature-scripts/steps/warn-missing-build-constants.d.ts +24 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/declared-pages.d.ts +2 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/resolve-war.d.ts +5 -0
- package/dist/plugin-web-extension/index.d.ts +1 -0
- package/dist/plugin-web-extension/shared/classic-concat.d.ts +1 -0
- package/dist/plugin-web-extension/shared/compilation-issues.d.ts +1 -1
- package/dist/preprocessor-passthrough-loader.mjs +3 -1
- package/dist/public-css-url-loader.mjs +1 -1
- package/dist/rspack-config~0.mjs +4925 -5885
- package/dist/stats-handler~0.mjs +12 -4
- package/dist/types.d.ts +19 -2
- package/dist/zip~0.mjs +20 -2
- package/package.json +4 -4
- package/dist/300~0.mjs +0 -394
- package/dist/747~0.mjs +0 -90
package/dist/846~0.mjs
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
+
import { createRequire, register } from "node:module";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
import dotenv from "dotenv";
|
|
5
|
+
import { isUsingExperimentalConfig as messages_isUsingExperimentalConfig, configUnknownKeys, resolveProjectStructureSync, codedError, configWrongShape, configLoadingError } from "./469~0.mjs";
|
|
6
|
+
import { debugLine, isDebug, CODES } from "./852~0.mjs";
|
|
7
|
+
import { isWebkitBasedBrowser } from "./937~0.mjs";
|
|
8
|
+
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
9
|
+
import * as __rspack_external_node_os_4f3c9d58 from "node:os";
|
|
10
|
+
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
11
|
+
import * as __rspack_external_node_vm_ef240610 from "node:vm";
|
|
12
|
+
const preloadedEnvKeys = new Set();
|
|
13
|
+
function getPreloadedEnvKeys() {
|
|
14
|
+
return preloadedEnvKeys;
|
|
15
|
+
}
|
|
16
|
+
const ENV_PRELOAD_ORDER = [
|
|
17
|
+
'.env.defaults',
|
|
18
|
+
'.env',
|
|
19
|
+
'.env.local',
|
|
20
|
+
'.env.development'
|
|
21
|
+
];
|
|
22
|
+
function applyEnvFile(filePath, shellOwned) {
|
|
23
|
+
const parsed = dotenv.parse(__rspack_external_node_fs_1b05aee1.readFileSync(filePath));
|
|
24
|
+
for (const [key, value] of Object.entries(parsed))if (!shellOwned.has(key)) {
|
|
25
|
+
process.env[key] = value;
|
|
26
|
+
preloadedEnvKeys.add(key);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function unwrapDefaultExport(loaded) {
|
|
30
|
+
if (loaded && 'object' == typeof loaded && 'default' in loaded) return loaded.default;
|
|
31
|
+
return loaded;
|
|
32
|
+
}
|
|
33
|
+
function loadCommonJsConfigWithStableDirname(absolutePath) {
|
|
34
|
+
const code = __rspack_external_node_fs_1b05aee1.readFileSync(absolutePath, 'utf-8');
|
|
35
|
+
const dirname = __rspack_external_node_path_806ed179.dirname(absolutePath);
|
|
36
|
+
const requireFn = createRequire(absolutePath);
|
|
37
|
+
const module = {
|
|
38
|
+
exports: {}
|
|
39
|
+
};
|
|
40
|
+
const exports = module.exports;
|
|
41
|
+
const wrapped = `(function (exports, require, module, __filename, __dirname) {\n${code}\n})`;
|
|
42
|
+
const fn = new __rspack_external_node_vm_ef240610.Script(wrapped, {
|
|
43
|
+
filename: absolutePath
|
|
44
|
+
}).runInThisContext();
|
|
45
|
+
fn(exports, requireFn, module, absolutePath, dirname);
|
|
46
|
+
return unwrapDefaultExport(module.exports);
|
|
47
|
+
}
|
|
48
|
+
function findNearestWorkspaceRoot(startDir) {
|
|
49
|
+
let current = __rspack_external_node_path_806ed179.resolve(startDir);
|
|
50
|
+
while(true){
|
|
51
|
+
if (__rspack_external_node_fs_1b05aee1.existsSync(__rspack_external_node_path_806ed179.join(current, 'pnpm-workspace.yaml'))) return current;
|
|
52
|
+
const parent = __rspack_external_node_path_806ed179.dirname(current);
|
|
53
|
+
if (parent === current) return;
|
|
54
|
+
current = parent;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function preloadEnvFilesFromDir(envDir) {
|
|
58
|
+
let loadedAny = false;
|
|
59
|
+
const shellOwned = new Set(Object.keys(process.env).filter((key)=>!preloadedEnvKeys.has(key)));
|
|
60
|
+
for (const filename of ENV_PRELOAD_ORDER){
|
|
61
|
+
const filePath = __rspack_external_node_path_806ed179.join(envDir, filename);
|
|
62
|
+
if (__rspack_external_node_fs_1b05aee1.existsSync(filePath)) try {
|
|
63
|
+
applyEnvFile(filePath, shellOwned);
|
|
64
|
+
loadedAny = true;
|
|
65
|
+
} catch {}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
loadedAny,
|
|
69
|
+
envDir
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const PROJECT_CONFIG_FILENAMES = [
|
|
73
|
+
'extension.config.js',
|
|
74
|
+
'extension.config.mjs',
|
|
75
|
+
'extension.config.cjs'
|
|
76
|
+
];
|
|
77
|
+
function configCandidatesIn(dir) {
|
|
78
|
+
return PROJECT_CONFIG_FILENAMES.map((name)=>__rspack_external_node_path_806ed179.join(dir, name));
|
|
79
|
+
}
|
|
80
|
+
function findConfigFileIn(dir) {
|
|
81
|
+
return configCandidatesIn(dir).find((p)=>__rspack_external_node_fs_1b05aee1.existsSync(p));
|
|
82
|
+
}
|
|
83
|
+
function resolveManifestDir(projectPath) {
|
|
84
|
+
try {
|
|
85
|
+
if (!__rspack_external_node_fs_1b05aee1.statSync(projectPath).isDirectory()) return;
|
|
86
|
+
} catch {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const structure = resolveProjectStructureSync(projectPath, {
|
|
91
|
+
quiet: true
|
|
92
|
+
});
|
|
93
|
+
return __rspack_external_node_path_806ed179.dirname(structure.manifestPath);
|
|
94
|
+
} catch {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function findConfigFile(projectPath) {
|
|
99
|
+
const atRoot = findConfigFileIn(projectPath);
|
|
100
|
+
if (atRoot) return atRoot;
|
|
101
|
+
const manifestDir = resolveManifestDir(projectPath);
|
|
102
|
+
if (!manifestDir || __rspack_external_node_path_806ed179.resolve(manifestDir) === __rspack_external_node_path_806ed179.resolve(projectPath)) return;
|
|
103
|
+
return findConfigFileIn(manifestDir);
|
|
104
|
+
}
|
|
105
|
+
function projectConfigCandidatePaths(projectPath) {
|
|
106
|
+
const dirs = [
|
|
107
|
+
projectPath
|
|
108
|
+
];
|
|
109
|
+
const manifestDir = resolveManifestDir(projectPath);
|
|
110
|
+
if (manifestDir && __rspack_external_node_path_806ed179.resolve(manifestDir) !== __rspack_external_node_path_806ed179.resolve(projectPath)) dirs.push(manifestDir);
|
|
111
|
+
return dirs.flatMap((dir)=>configCandidatesIn(dir));
|
|
112
|
+
}
|
|
113
|
+
function preloadEnvFiles(projectDir) {
|
|
114
|
+
const local = preloadEnvFilesFromDir(projectDir);
|
|
115
|
+
if (local.loadedAny) return local;
|
|
116
|
+
const workspaceRoot = findNearestWorkspaceRoot(projectDir);
|
|
117
|
+
if (workspaceRoot && workspaceRoot !== projectDir) return preloadEnvFilesFromDir(workspaceRoot);
|
|
118
|
+
return local;
|
|
119
|
+
}
|
|
120
|
+
const IMPORT_META_ENV_GLOBAL = '__EXTENSION_IMPORT_META_ENV__';
|
|
121
|
+
const IMPORT_META_ENV_HOOK = `
|
|
122
|
+
import {readFileSync} from 'node:fs'
|
|
123
|
+
import {fileURLToPath} from 'node:url'
|
|
124
|
+
|
|
125
|
+
const CONFIG_FILE = /(^|\\/)extension\\.config\\.(js|mjs)$/
|
|
126
|
+
|
|
127
|
+
export async function load(url, context, nextLoad) {
|
|
128
|
+
if (!url.startsWith('file:') || !CONFIG_FILE.test(new URL(url).pathname)) {
|
|
129
|
+
return nextLoad(url, context)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let text
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
text = readFileSync(fileURLToPath(url), 'utf8')
|
|
136
|
+
} catch {
|
|
137
|
+
return nextLoad(url, context)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (!text.includes('import.meta.env')) return nextLoad(url, context)
|
|
141
|
+
|
|
142
|
+
// import.meta is module syntax, so the format is settled here. Left to
|
|
143
|
+
// Node, a package.json without "type" means a reparse and a warning per run.
|
|
144
|
+
const loaded = await nextLoad(url, {...context, format: 'module'})
|
|
145
|
+
const source =
|
|
146
|
+
typeof loaded.source === 'string'
|
|
147
|
+
? loaded.source
|
|
148
|
+
: Buffer.from(loaded.source).toString('utf8')
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
...loaded,
|
|
152
|
+
source: source.replaceAll(
|
|
153
|
+
'import.meta.env',
|
|
154
|
+
'globalThis.${IMPORT_META_ENV_GLOBAL}'
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
`;
|
|
159
|
+
let importMetaEnvHookRegistered = false;
|
|
160
|
+
function prepareImportMetaEnv(absolutePath) {
|
|
161
|
+
let source = '';
|
|
162
|
+
try {
|
|
163
|
+
source = __rspack_external_node_fs_1b05aee1.readFileSync(absolutePath, 'utf-8');
|
|
164
|
+
} catch {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!source.includes('import.meta.env')) return;
|
|
168
|
+
globalThis[IMPORT_META_ENV_GLOBAL] = Object.freeze({
|
|
169
|
+
...process.env
|
|
170
|
+
});
|
|
171
|
+
if (importMetaEnvHookRegistered) return;
|
|
172
|
+
try {
|
|
173
|
+
register(`data:text/javascript,${encodeURIComponent(IMPORT_META_ENV_HOOK)}`);
|
|
174
|
+
importMetaEnvHookRegistered = true;
|
|
175
|
+
} catch {}
|
|
176
|
+
}
|
|
177
|
+
class ConfigShapeError extends Error {
|
|
178
|
+
code = CODES.E_CONFIG_LOAD;
|
|
179
|
+
}
|
|
180
|
+
function configLoadError(configPath, cause) {
|
|
181
|
+
return Object.assign(codedError(CODES.E_CONFIG_LOAD, configLoadingError(configPath, cause)), {
|
|
182
|
+
cause
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function isConfigLoadError(error) {
|
|
186
|
+
return error?.code === CODES.E_CONFIG_LOAD;
|
|
187
|
+
}
|
|
188
|
+
const loadedConfigCache = new Map();
|
|
189
|
+
const reportedConfigPaths = new Set();
|
|
190
|
+
function reportConfigLoadingErrorOnce(configPath, error) {
|
|
191
|
+
if (isConfigLoadError(error)) return;
|
|
192
|
+
const key = __rspack_external_node_path_806ed179.resolve(configPath);
|
|
193
|
+
if (reportedConfigPaths.has(key)) return;
|
|
194
|
+
reportedConfigPaths.add(key);
|
|
195
|
+
console.error(configLoadingError(configPath, error));
|
|
196
|
+
}
|
|
197
|
+
const CONFIG_TOP_LEVEL_KEYS = [
|
|
198
|
+
'browser',
|
|
199
|
+
'commands',
|
|
200
|
+
'config',
|
|
201
|
+
'configResolved',
|
|
202
|
+
'define',
|
|
203
|
+
'extensions',
|
|
204
|
+
'folders',
|
|
205
|
+
'perfBudgets',
|
|
206
|
+
'transpilePackages'
|
|
207
|
+
];
|
|
208
|
+
function assertConfigShape(configPath, value) {
|
|
209
|
+
if (void 0 === value) return;
|
|
210
|
+
if ('object' != typeof value || null === value || Array.isArray(value)) throw new ConfigShapeError(configWrongShape(configPath, value));
|
|
211
|
+
const unknown = Object.keys(value).filter((key)=>!CONFIG_TOP_LEVEL_KEYS.includes(key));
|
|
212
|
+
if (unknown.length > 0) console.error(configUnknownKeys(configPath, unknown, CONFIG_TOP_LEVEL_KEYS));
|
|
213
|
+
}
|
|
214
|
+
async function loadConfigFile(configPath) {
|
|
215
|
+
const absolutePath = __rspack_external_node_path_806ed179.resolve(configPath);
|
|
216
|
+
const cached = loadedConfigCache.get(absolutePath);
|
|
217
|
+
if (cached) return cached;
|
|
218
|
+
const loading = loadConfigFileUncached(absolutePath).then((value)=>{
|
|
219
|
+
assertConfigShape(absolutePath, value);
|
|
220
|
+
return value;
|
|
221
|
+
});
|
|
222
|
+
loadedConfigCache.set(absolutePath, loading);
|
|
223
|
+
try {
|
|
224
|
+
return await loading;
|
|
225
|
+
} catch (error) {
|
|
226
|
+
loadedConfigCache.delete(absolutePath);
|
|
227
|
+
throw error;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
async function loadConfigFileUncached(absolutePath) {
|
|
231
|
+
const projectDir = __rspack_external_node_path_806ed179.dirname(absolutePath);
|
|
232
|
+
preloadEnvFiles(projectDir);
|
|
233
|
+
try {
|
|
234
|
+
if (absolutePath.endsWith('.cjs')) {
|
|
235
|
+
const requireFn = createRequire(import.meta.url);
|
|
236
|
+
const required = requireFn(absolutePath);
|
|
237
|
+
return unwrapDefaultExport(required);
|
|
238
|
+
}
|
|
239
|
+
prepareImportMetaEnv(absolutePath);
|
|
240
|
+
const module = await import(pathToFileURL(absolutePath).href);
|
|
241
|
+
return unwrapDefaultExport(module);
|
|
242
|
+
} catch (err) {
|
|
243
|
+
const error = err;
|
|
244
|
+
try {
|
|
245
|
+
if (!absolutePath.endsWith('.mjs')) {
|
|
246
|
+
const requireFn = createRequire(import.meta.url);
|
|
247
|
+
let required;
|
|
248
|
+
try {
|
|
249
|
+
required = requireFn(absolutePath);
|
|
250
|
+
} catch (requireErr) {
|
|
251
|
+
const message = String(error?.message || '') + ' ' + String(requireErr?.message || '');
|
|
252
|
+
const looksLikeCommonJsInEsm = message.includes('require is not defined in ES module scope') || message.includes('Cannot use import statement outside a module') || message.includes('ERR_REQUIRE_ESM');
|
|
253
|
+
if (looksLikeCommonJsInEsm) try {
|
|
254
|
+
required = loadCommonJsConfigWithStableDirname(absolutePath);
|
|
255
|
+
} catch {
|
|
256
|
+
const tmpDir = __rspack_external_node_fs_1b05aee1.mkdtempSync(__rspack_external_node_path_806ed179.join(__rspack_external_node_os_4f3c9d58.tmpdir(), 'extension-config-'));
|
|
257
|
+
try {
|
|
258
|
+
const tmpCjsPath = __rspack_external_node_path_806ed179.join(tmpDir, __rspack_external_node_path_806ed179.basename(absolutePath, __rspack_external_node_path_806ed179.extname(absolutePath)) + '.cjs');
|
|
259
|
+
__rspack_external_node_fs_1b05aee1.copyFileSync(absolutePath, tmpCjsPath);
|
|
260
|
+
required = requireFn(tmpCjsPath);
|
|
261
|
+
} finally{
|
|
262
|
+
try {
|
|
263
|
+
__rspack_external_node_fs_1b05aee1.rmSync(tmpDir, {
|
|
264
|
+
recursive: true,
|
|
265
|
+
force: true
|
|
266
|
+
});
|
|
267
|
+
} catch {}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else throw requireErr;
|
|
271
|
+
}
|
|
272
|
+
return unwrapDefaultExport(required);
|
|
273
|
+
}
|
|
274
|
+
} catch {}
|
|
275
|
+
try {
|
|
276
|
+
const content = __rspack_external_node_fs_1b05aee1.readFileSync(absolutePath, 'utf-8');
|
|
277
|
+
return JSON.parse(content);
|
|
278
|
+
} catch {
|
|
279
|
+
throw configLoadError(absolutePath, error);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
async function loadCustomConfig(projectPath, context) {
|
|
284
|
+
const configPath = findConfigFile(projectPath);
|
|
285
|
+
if (configPath) {
|
|
286
|
+
if (await isUsingExperimentalConfig(projectPath)) try {
|
|
287
|
+
const userConfig = await loadConfigFile(configPath);
|
|
288
|
+
if (userConfig && 'function' == typeof userConfig.config) {
|
|
289
|
+
const hook = userConfig.config;
|
|
290
|
+
return (config)=>hook(config, context);
|
|
291
|
+
}
|
|
292
|
+
if (userConfig?.config && 'object' == typeof userConfig.config) {
|
|
293
|
+
const partial = userConfig.config;
|
|
294
|
+
return (config)=>{
|
|
295
|
+
const requireFn = createRequire(import.meta.url);
|
|
296
|
+
const { merge } = requireFn('webpack-merge');
|
|
297
|
+
return merge(config, partial);
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
} catch (err) {
|
|
301
|
+
const error = err;
|
|
302
|
+
reportConfigLoadingErrorOnce(configPath, error);
|
|
303
|
+
throw err;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return (config)=>config;
|
|
307
|
+
}
|
|
308
|
+
async function loadConfigResolvedHook(projectPath) {
|
|
309
|
+
const configPath = findConfigFile(projectPath);
|
|
310
|
+
if (!configPath) return;
|
|
311
|
+
if (!await isUsingExperimentalConfig(projectPath)) return;
|
|
312
|
+
const userConfig = await loadConfigFile(configPath);
|
|
313
|
+
return 'function' == typeof userConfig?.configResolved ? userConfig.configResolved : void 0;
|
|
314
|
+
}
|
|
315
|
+
function typeOfDefineValue(value) {
|
|
316
|
+
if (null === value) return 'null';
|
|
317
|
+
if (Array.isArray(value)) return 'unknown[]';
|
|
318
|
+
switch(typeof value){
|
|
319
|
+
case 'string':
|
|
320
|
+
return 'string';
|
|
321
|
+
case 'number':
|
|
322
|
+
return 'number';
|
|
323
|
+
case 'boolean':
|
|
324
|
+
return 'boolean';
|
|
325
|
+
case 'object':
|
|
326
|
+
return 'Record<string, unknown>';
|
|
327
|
+
default:
|
|
328
|
+
return 'unknown';
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function collectDefineTypes(into, define) {
|
|
332
|
+
if (!define || 'object' != typeof define) return;
|
|
333
|
+
for (const [key, value] of Object.entries(define)){
|
|
334
|
+
const types = into.get(key) || new Set();
|
|
335
|
+
types.add(typeOfDefineValue(value));
|
|
336
|
+
into.set(key, types);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
async function loadDefineTypes(projectPath) {
|
|
340
|
+
const configPath = findConfigFile(projectPath);
|
|
341
|
+
if (!configPath) return {};
|
|
342
|
+
if (!await isUsingExperimentalConfig(projectPath)) return {};
|
|
343
|
+
let userConfig;
|
|
344
|
+
try {
|
|
345
|
+
userConfig = await loadConfigFile(configPath);
|
|
346
|
+
} catch {
|
|
347
|
+
return {};
|
|
348
|
+
}
|
|
349
|
+
const found = new Map();
|
|
350
|
+
collectDefineTypes(found, userConfig?.define);
|
|
351
|
+
for (const scope of [
|
|
352
|
+
userConfig?.browser,
|
|
353
|
+
userConfig?.commands
|
|
354
|
+
])if (scope && 'object' == typeof scope) for (const entry of Object.values(scope))collectDefineTypes(found, entry?.define);
|
|
355
|
+
const types = {};
|
|
356
|
+
for (const [key, set] of found)types[key] = [
|
|
357
|
+
...set
|
|
358
|
+
].sort().join(' | ');
|
|
359
|
+
return types;
|
|
360
|
+
}
|
|
361
|
+
async function loadProjectConfigDefaults(projectPath) {
|
|
362
|
+
const configPath = findConfigFile(projectPath);
|
|
363
|
+
if (configPath) {
|
|
364
|
+
if (await isUsingExperimentalConfig(projectPath)) try {
|
|
365
|
+
const userConfig = await loadConfigFile(configPath);
|
|
366
|
+
return {
|
|
367
|
+
...userConfig?.extensions ? {
|
|
368
|
+
extensions: userConfig.extensions
|
|
369
|
+
} : {},
|
|
370
|
+
...Array.isArray(userConfig?.transpilePackages) ? {
|
|
371
|
+
transpilePackages: userConfig.transpilePackages
|
|
372
|
+
} : {},
|
|
373
|
+
...userConfig?.perfBudgets && 'object' == typeof userConfig.perfBudgets ? {
|
|
374
|
+
perfBudgets: userConfig.perfBudgets
|
|
375
|
+
} : {},
|
|
376
|
+
...userConfig?.define && 'object' == typeof userConfig.define ? {
|
|
377
|
+
define: userConfig.define
|
|
378
|
+
} : {},
|
|
379
|
+
...userConfig?.folders && 'object' == typeof userConfig.folders ? {
|
|
380
|
+
folders: userConfig.folders
|
|
381
|
+
} : {}
|
|
382
|
+
};
|
|
383
|
+
} catch (err) {
|
|
384
|
+
const error = err;
|
|
385
|
+
reportConfigLoadingErrorOnce(configPath, error);
|
|
386
|
+
throw err;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return {};
|
|
390
|
+
}
|
|
391
|
+
async function loadCommandConfig(projectPath, command) {
|
|
392
|
+
const configPath = findConfigFile(projectPath);
|
|
393
|
+
if (configPath) {
|
|
394
|
+
if (await isUsingExperimentalConfig(projectPath)) try {
|
|
395
|
+
const userConfig = await loadConfigFile(configPath);
|
|
396
|
+
return userConfig?.commands?.[command] || {};
|
|
397
|
+
} catch (err) {
|
|
398
|
+
const error = err;
|
|
399
|
+
reportConfigLoadingErrorOnce(configPath, error);
|
|
400
|
+
throw err;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return {};
|
|
404
|
+
}
|
|
405
|
+
async function loadBrowserConfig(projectPath, browser = 'chrome') {
|
|
406
|
+
const configPath = findConfigFile(projectPath);
|
|
407
|
+
if (configPath) {
|
|
408
|
+
if (await isUsingExperimentalConfig(projectPath)) try {
|
|
409
|
+
const userConfig = await loadConfigFile(configPath);
|
|
410
|
+
if (userConfig?.browser) {
|
|
411
|
+
const browsers = userConfig.browser;
|
|
412
|
+
const browserName = String(browser);
|
|
413
|
+
if ('chromium-based' === browser) {
|
|
414
|
+
if (browsers['chromium-based']) return browsers['chromium-based'];
|
|
415
|
+
if (browsers.chromium) return browsers.chromium;
|
|
416
|
+
} else if ('gecko-based' === browser) {
|
|
417
|
+
if (browsers['gecko-based']) return browsers['gecko-based'];
|
|
418
|
+
if (browsers.firefox) return browsers.firefox;
|
|
419
|
+
} else if (isWebkitBasedBrowser(browserName)) {
|
|
420
|
+
const direct = browsers[browserName];
|
|
421
|
+
if (direct) return direct;
|
|
422
|
+
if ('safari' !== browserName) {
|
|
423
|
+
if (browsers['webkit-based']) return browsers['webkit-based'];
|
|
424
|
+
if (browsers.safari) return browsers.safari;
|
|
425
|
+
}
|
|
426
|
+
} else {
|
|
427
|
+
const direct = browsers[browserName];
|
|
428
|
+
if (direct) return direct;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
} catch (err) {
|
|
432
|
+
const error = err;
|
|
433
|
+
reportConfigLoadingErrorOnce(configPath, error);
|
|
434
|
+
throw err;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
return {
|
|
438
|
+
browser: browser || 'chrome'
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
let userMessageDelivered = false;
|
|
442
|
+
async function isUsingExperimentalConfig(projectPath) {
|
|
443
|
+
const configPath = findConfigFile(projectPath);
|
|
444
|
+
if (configPath) {
|
|
445
|
+
if (!userMessageDelivered) {
|
|
446
|
+
if (isDebug()) debugLine(messages_isUsingExperimentalConfig('extension.config.js'));
|
|
447
|
+
userMessageDelivered = true;
|
|
448
|
+
}
|
|
449
|
+
return true;
|
|
450
|
+
}
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
export { findConfigFile, getPreloadedEnvKeys, loadBrowserConfig, loadCommandConfig, loadConfigResolvedHook, loadCustomConfig, loadDefineTypes, loadProjectConfigDefaults, projectConfigCandidatePaths };
|
package/dist/852~0.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
+
import { format } from "node:util";
|
|
2
3
|
import pintor from "pintor";
|
|
3
4
|
const GLYPH = '⏵⏵⏵';
|
|
4
5
|
const DEBUG_GLYPH = '···';
|
|
@@ -37,13 +38,17 @@ function isMachineOutput() {
|
|
|
37
38
|
return MACHINE_OUTPUT_VALUES.has(String(process.env.EXTENSION_OUTPUT || '').trim().toLowerCase());
|
|
38
39
|
}
|
|
39
40
|
function humanLine(...parts) {
|
|
40
|
-
if (isMachineOutput()) return;
|
|
41
|
+
if (isMachineOutput()) return void process.stderr.write(`${format(...parts)}\n`);
|
|
41
42
|
console.log(...parts);
|
|
42
43
|
}
|
|
43
44
|
function humanWarn(...parts) {
|
|
44
45
|
if (isMachineOutput()) return;
|
|
45
46
|
console.warn(...parts);
|
|
46
47
|
}
|
|
48
|
+
function debugLine(...parts) {
|
|
49
|
+
if (isMachineOutput()) return void console.error(...parts);
|
|
50
|
+
console.log(...parts);
|
|
51
|
+
}
|
|
47
52
|
const fmt = {
|
|
48
53
|
heading: (title)=>pintor.underline(pintor.blue(title)),
|
|
49
54
|
label: (key)=>pintor.gray(key.toUpperCase()),
|
|
@@ -188,7 +193,6 @@ const CODES = {
|
|
|
188
193
|
E_CONFIG_LOAD: 'E_CONFIG_LOAD',
|
|
189
194
|
E_MANAGED_DEP_CONFLICT: 'E_MANAGED_DEP_CONFLICT',
|
|
190
195
|
E_TYPES_EMIT: 'E_TYPES_EMIT',
|
|
191
|
-
E_TSCONFIG_MISSING: 'E_TSCONFIG_MISSING',
|
|
192
196
|
E_OPTIONAL_DEP_UNRESOLVED: 'E_OPTIONAL_DEP_UNRESOLVED',
|
|
193
197
|
E_OPTIONAL_DEP_LOAD: 'E_OPTIONAL_DEP_LOAD',
|
|
194
198
|
E_OPTIONAL_DEP_UNKNOWN: 'E_OPTIONAL_DEP_UNKNOWN',
|
|
@@ -204,11 +208,9 @@ const CODES = {
|
|
|
204
208
|
E_CSS_PARSE: 'E_CSS_PARSE',
|
|
205
209
|
E_CSS_PREPROCESSOR_MISSING: 'E_CSS_PREPROCESSOR_MISSING',
|
|
206
210
|
E_CSS_DEAD_REF: 'E_CSS_DEAD_REF',
|
|
207
|
-
E_INTEGRATION_INSTALL: 'E_INTEGRATION_INSTALL',
|
|
208
211
|
E_POLYFILL_NOT_FOUND: 'E_POLYFILL_NOT_FOUND',
|
|
209
212
|
E_LOCALES_LAYOUT: 'E_LOCALES_LAYOUT',
|
|
210
213
|
E_WAR_INVALID: 'E_WAR_INVALID',
|
|
211
|
-
E_MATCH_PATTERN_INVALID: 'E_MATCH_PATTERN_INVALID',
|
|
212
214
|
E_BACKGROUND_REQUIRED: 'E_BACKGROUND_REQUIRED',
|
|
213
215
|
E_CONTENT_SCRIPT_SYNTAX: 'E_CONTENT_SCRIPT_SYNTAX',
|
|
214
216
|
E_NO_ENTRYPOINTS: 'E_NO_ENTRYPOINTS',
|
|
@@ -227,7 +229,6 @@ const CODES = {
|
|
|
227
229
|
E_BROWSER_START_TIMEOUT: 'E_BROWSER_START_TIMEOUT',
|
|
228
230
|
E_LAUNCH_SKIPPED_COMPILE_ERRORS: 'E_LAUNCH_SKIPPED_COMPILE_ERRORS',
|
|
229
231
|
E_INSTANCE_AMBIGUOUS: 'E_INSTANCE_AMBIGUOUS',
|
|
230
|
-
E_WSL_INTEROP: 'E_WSL_INTEROP',
|
|
231
232
|
E_EXTENSION_LOAD_REFUSED: 'E_EXTENSION_LOAD_REFUSED',
|
|
232
233
|
E_ADDON_INSTALL: 'E_ADDON_INSTALL',
|
|
233
234
|
E_BROWSER_CONNECT: 'E_BROWSER_CONNECT',
|
|
@@ -239,6 +240,7 @@ const CODES = {
|
|
|
239
240
|
E_RDP_PROTOCOL: 'E_RDP_PROTOCOL',
|
|
240
241
|
E_PORT_IN_USE: 'E_PORT_IN_USE',
|
|
241
242
|
E_SESSION_STOPPED: 'E_SESSION_STOPPED',
|
|
243
|
+
E_SESSION_EXISTS: 'E_SESSION_EXISTS',
|
|
242
244
|
E_LOGS_STREAM_GAP: 'E_LOGS_STREAM_GAP',
|
|
243
245
|
E_BROWSER_INSTALL_PRIVILEGE: 'E_BROWSER_INSTALL_PRIVILEGE',
|
|
244
246
|
E_UNINSTALL_NOOP: 'E_UNINSTALL_NOOP'
|
|
@@ -292,4 +294,4 @@ const ENVELOPE = {
|
|
|
292
294
|
}, extras);
|
|
293
295
|
}
|
|
294
296
|
};
|
|
295
|
-
export { CODES, ENVELOPE, artifactNoun, browserRowValue, card, claimCardKey, fmt, hasChannelPrefix, humanLine, humanWarn, isDebug, isMachineOutput, prefix, stripChannelPrefix };
|
|
297
|
+
export { CODES, ENVELOPE, artifactNoun, browserRowValue, card, claimCardKey, debugLine, fmt, hasChannelPrefix, humanLine, humanWarn, isDebug, isMachineOutput, prefix, stripChannelPrefix };
|
package/dist/bridge.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
2
|
import { WebSocket } from "ws";
|
|
3
|
-
import {
|
|
3
|
+
import { readyContractPath, logsPath } from "./771~0.mjs";
|
|
4
4
|
import { CONTROL_WS_PATH, LOG_CONTEXTS } from "./616~0.mjs";
|
|
5
|
+
import { resolveProjectStructureSync, getDirs } from "./469~0.mjs";
|
|
5
6
|
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
6
7
|
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
7
8
|
function readReadyContractDocument(projectPath, browser = 'chrome') {
|
|
@@ -417,5 +418,5 @@ var bridge_entry_CLOSE_SLOW_CONSUMER = 4008;
|
|
|
417
418
|
var bridge_entry_CONTROL_ENVELOPE_VERSION = 1;
|
|
418
419
|
var bridge_entry_LOG_EVENT_VERSION = 1;
|
|
419
420
|
export { CONTROL_WS_PATH, LOG_CONTEXTS, REFUSAL_API_UNAVAILABLE, REFUSAL_NEEDS_HEADED_WINDOW, REFUSAL_NEEDS_USER_GESTURE, REFUSAL_SURFACE_NOT_OPEN, REFUSAL_TAB_NOT_FOUND, REFUSAL_URL_REFUSED, readControlToken, readPersistedControlPort } from "./616~0.mjs";
|
|
420
|
-
export { actionsPath, browserArtifactsDir, browserDistDir, browserProfileRootDir, buildSummaryPath, controlPortFilePath, controlTokenPath, eventsPath, logsPath, readyContractPath, sessionArtifactsRootDir, sessionStateDir } from "./
|
|
421
|
+
export { actionsPath, browserArtifactsDir, browserDistDir, browserProfileRootDir, buildSummaryPath, controlPortFilePath, controlTokenPath, eventsPath, logsPath, readyContractPath, sessionArtifactsRootDir, sessionStateDir } from "./771~0.mjs";
|
|
421
422
|
export { BridgeConsumer, BridgeController, LOG_LEVEL_FILTERS, LOG_LEVEL_ORDER, bridge_entry_CLOSE_BAD_HELLO as CLOSE_BAD_HELLO, bridge_entry_CLOSE_BAD_INSTANCE as CLOSE_BAD_INSTANCE, bridge_entry_CLOSE_CONTROL_UNAVAILABLE as CLOSE_CONTROL_UNAVAILABLE, bridge_entry_CLOSE_SLOW_CONSUMER as CLOSE_SLOW_CONSUMER, bridge_entry_CONTROL_ENVELOPE_VERSION as CONTROL_ENVELOPE_VERSION, bridge_entry_LOG_EVENT_VERSION as LOG_EVENT_VERSION, isAfterSince, logLevelRank, logQueryProblem, matchesLogQuery, parseLogLevelFilter, parseLogSince, readLogEvents, readReadyContract, readReadyContractDocument, resolveSessionProjectRoot, unknownLogContexts };
|