extension-develop 4.0.7-canary.1783860631.e2b9b285 → 4.0.7
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/0~rspack-config.mjs +67 -207
- package/dist/101.mjs +2 -9
- package/dist/839.mjs +5 -43
- package/dist/extension-js-devtools/chrome/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/chrome/pages/centralized-logger.css +1 -1
- package/dist/extension-js-devtools/chrome/pages/centralized-logger.js +4 -4
- package/dist/extension-js-devtools/chrome/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/chrome/pages/welcome.js +1 -1
- package/dist/extension-js-devtools/chromium/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/chromium/pages/centralized-logger.css +1 -1
- package/dist/extension-js-devtools/chromium/pages/centralized-logger.js +4 -4
- package/dist/extension-js-devtools/chromium/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/chromium/pages/welcome.js +1 -1
- package/dist/extension-js-devtools/edge/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/edge/pages/centralized-logger.css +1 -1
- package/dist/extension-js-devtools/edge/pages/centralized-logger.js +4 -4
- package/dist/extension-js-devtools/edge/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/edge/pages/welcome.js +1 -1
- package/dist/extension-js-devtools/extension-js/chrome/events.ndjson +6 -102
- package/dist/extension-js-devtools/extension-js/chrome/ready.json +7 -7
- package/dist/extension-js-devtools/extension-js/chromium/events.ndjson +6 -104
- package/dist/extension-js-devtools/extension-js/chromium/ready.json +7 -7
- package/dist/extension-js-devtools/extension-js/edge/events.ndjson +6 -102
- package/dist/extension-js-devtools/extension-js/edge/ready.json +7 -7
- package/dist/extension-js-devtools/extension-js/firefox/events.ndjson +6 -102
- package/dist/extension-js-devtools/extension-js/firefox/ready.json +7 -7
- package/dist/extension-js-devtools/firefox/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/firefox/pages/centralized-logger.css +1 -1
- package/dist/extension-js-devtools/firefox/pages/centralized-logger.js +4 -4
- package/dist/extension-js-devtools/firefox/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/firefox/pages/welcome.js +1 -1
- package/dist/extension-js-theme/extension-js/chrome/events.ndjson +6 -102
- package/dist/extension-js-theme/extension-js/chrome/ready.json +7 -7
- package/dist/extension-js-theme/extension-js/chromium/events.ndjson +6 -102
- package/dist/extension-js-theme/extension-js/chromium/ready.json +7 -7
- package/dist/extension-js-theme/extension-js/edge/events.ndjson +6 -102
- package/dist/extension-js-theme/extension-js/edge/ready.json +7 -7
- package/dist/extension-js-theme/extension-js/firefox/events.ndjson +8 -174
- package/dist/extension-js-theme/extension-js/firefox/ready.json +7 -7
- package/package.json +1 -1
package/dist/0~rspack-config.mjs
CHANGED
|
@@ -293,89 +293,6 @@ function checkManifestInPublic(compilation, publicDir) {
|
|
|
293
293
|
}
|
|
294
294
|
} catch {}
|
|
295
295
|
}
|
|
296
|
-
function isFromFilepathList(filePath, filepathList) {
|
|
297
|
-
return Object.values(filepathList || {}).some((value)=>value === filePath);
|
|
298
|
-
}
|
|
299
|
-
function getFilename(feature, filePath) {
|
|
300
|
-
const entryExt = __rspack_external_path.extname(filePath);
|
|
301
|
-
let fileOutputpath = feature;
|
|
302
|
-
if ([
|
|
303
|
-
'.js',
|
|
304
|
-
'.jsx',
|
|
305
|
-
'.tsx',
|
|
306
|
-
'.ts',
|
|
307
|
-
'.vue',
|
|
308
|
-
'.svelte'
|
|
309
|
-
].includes(entryExt)) fileOutputpath = fileOutputpath.replace(entryExt, '.js');
|
|
310
|
-
if ([
|
|
311
|
-
'.html',
|
|
312
|
-
'.njk',
|
|
313
|
-
'.nunjucks'
|
|
314
|
-
].includes(entryExt)) fileOutputpath = fileOutputpath.replace(entryExt, '.html');
|
|
315
|
-
if ([
|
|
316
|
-
'.css',
|
|
317
|
-
'.scss',
|
|
318
|
-
'.sass',
|
|
319
|
-
'.less'
|
|
320
|
-
].includes(entryExt)) fileOutputpath = fileOutputpath.replace(entryExt, '.css');
|
|
321
|
-
return unixify(fileOutputpath || '');
|
|
322
|
-
}
|
|
323
|
-
function unixify(filePath) {
|
|
324
|
-
return filePath.replace(/\\/g, '/');
|
|
325
|
-
}
|
|
326
|
-
function resolveRootAbsoluteRef(ref, projectRoot, publicRoot) {
|
|
327
|
-
if (!ref || !ref.startsWith('/')) return;
|
|
328
|
-
if (projectRoot && ref.startsWith(projectRoot)) return;
|
|
329
|
-
if (ref.startsWith('//')) return;
|
|
330
|
-
const trimmed = ref.replace(/^\/+/, '');
|
|
331
|
-
if (!trimmed) return;
|
|
332
|
-
if (publicRoot && __rspack_external_fs.existsSync(__rspack_external_path.join(publicRoot, trimmed))) return;
|
|
333
|
-
const candidate = __rspack_external_path.resolve(projectRoot, trimmed);
|
|
334
|
-
const rel = __rspack_external_path.relative(projectRoot, candidate);
|
|
335
|
-
if (rel.startsWith('..') || __rspack_external_path.isAbsolute(rel)) return;
|
|
336
|
-
if (!__rspack_external_fs.existsSync(candidate) || !__rspack_external_fs.statSync(candidate).isFile()) return;
|
|
337
|
-
return candidate;
|
|
338
|
-
}
|
|
339
|
-
function collectRootAbsoluteRefs(source) {
|
|
340
|
-
const refs = new Set();
|
|
341
|
-
const attrRe = /(?:src|href)\s*=\s*["'](\/[^"'#?]*)["']/gi;
|
|
342
|
-
const urlRe = /url\(\s*["']?(\/[^"')#?]+)["']?\s*\)/gi;
|
|
343
|
-
let m;
|
|
344
|
-
while(m = attrRe.exec(source))refs.add(m[1]);
|
|
345
|
-
while(m = urlRe.exec(source))refs.add(m[1]);
|
|
346
|
-
return refs;
|
|
347
|
-
}
|
|
348
|
-
function emitRootAbsoluteRefs(compilation, context, publicDir) {
|
|
349
|
-
const scanned = new Set();
|
|
350
|
-
for(let pass = 0; pass < 10; pass++){
|
|
351
|
-
const refs = new Set();
|
|
352
|
-
for (const asset of compilation.getAssets()){
|
|
353
|
-
if (!/\.(html|css)$/i.test(asset.name)) continue;
|
|
354
|
-
if (scanned.has(asset.name)) continue;
|
|
355
|
-
scanned.add(asset.name);
|
|
356
|
-
let source;
|
|
357
|
-
try {
|
|
358
|
-
source = String(asset.source.source());
|
|
359
|
-
} catch {
|
|
360
|
-
continue;
|
|
361
|
-
}
|
|
362
|
-
for (const ref of collectRootAbsoluteRefs(source))refs.add(ref);
|
|
363
|
-
}
|
|
364
|
-
if (0 === refs.size) return;
|
|
365
|
-
let emitted = 0;
|
|
366
|
-
for (const ref of refs){
|
|
367
|
-
const outputName = ref.replace(/^\/+/, '');
|
|
368
|
-
if (compilation.getAsset(outputName)) continue;
|
|
369
|
-
const sourcePath = resolveRootAbsoluteRef(ref, context, publicDir);
|
|
370
|
-
if (sourcePath) try {
|
|
371
|
-
compilation.emitAsset(outputName, new rspack.sources.RawSource(__rspack_external_fs.readFileSync(sourcePath)));
|
|
372
|
-
compilation.fileDependencies.add(sourcePath);
|
|
373
|
-
emitted++;
|
|
374
|
-
} catch {}
|
|
375
|
-
}
|
|
376
|
-
if (0 === emitted) return;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
296
|
class SpecialFoldersPlugin {
|
|
380
297
|
static name = 'plugin-special-folders';
|
|
381
298
|
options;
|
|
@@ -386,14 +303,6 @@ class SpecialFoldersPlugin {
|
|
|
386
303
|
const { manifestPath } = this.options;
|
|
387
304
|
const context = compiler.options.context || __rspack_external_path.dirname(manifestPath);
|
|
388
305
|
const publicDir = __rspack_external_path.join(context, 'public');
|
|
389
|
-
compiler.hooks.thisCompilation.tap(SpecialFoldersPlugin.name, (compilation)=>{
|
|
390
|
-
compilation.hooks.processAssets.tap({
|
|
391
|
-
name: `${SpecialFoldersPlugin.name}:root-absolute-refs`,
|
|
392
|
-
stage: compilation.constructor.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
393
|
-
}, ()=>{
|
|
394
|
-
emitRootAbsoluteRefs(compilation, __rspack_external_path.dirname(manifestPath), publicDir);
|
|
395
|
-
});
|
|
396
|
-
});
|
|
397
306
|
if (__rspack_external_fs.existsSync(publicDir) && __rspack_external_fs.statSync(publicDir).isDirectory()) {
|
|
398
307
|
compiler.hooks.thisCompilation.tap(SpecialFoldersPlugin.name, (compilation)=>{
|
|
399
308
|
compilation.hooks.processAssets.tap({
|
|
@@ -471,6 +380,36 @@ function envInjectedPublicVars(count) {
|
|
|
471
380
|
function envNoMatchingFile(browser, mode, presentFiles, expectedCandidates) {
|
|
472
381
|
return `Found ${presentFiles.map((file)=>pintor.yellow(file)).join(', ')} but none match browser ${pintor.yellow(browser)} (mode ${pintor.yellow(mode)}), so EXTENSION_PUBLIC_* variables read from code will be ${pintor.yellow('undefined')} in this build.\nMatching names, in priority order: ${expectedCandidates.map((file)=>pintor.gray(file)).join(', ')}.\nFamily names apply to every family member — e.g. ${pintor.yellow('.env.chrome')} also matches ${pintor.yellow('chromium')} and ${pintor.yellow('edge')} targets.`;
|
|
473
382
|
}
|
|
383
|
+
function isFromFilepathList(filePath, filepathList) {
|
|
384
|
+
return Object.values(filepathList || {}).some((value)=>value === filePath);
|
|
385
|
+
}
|
|
386
|
+
function getFilename(feature, filePath) {
|
|
387
|
+
const entryExt = __rspack_external_path.extname(filePath);
|
|
388
|
+
let fileOutputpath = feature;
|
|
389
|
+
if ([
|
|
390
|
+
'.js',
|
|
391
|
+
'.jsx',
|
|
392
|
+
'.tsx',
|
|
393
|
+
'.ts',
|
|
394
|
+
'.vue',
|
|
395
|
+
'.svelte'
|
|
396
|
+
].includes(entryExt)) fileOutputpath = fileOutputpath.replace(entryExt, '.js');
|
|
397
|
+
if ([
|
|
398
|
+
'.html',
|
|
399
|
+
'.njk',
|
|
400
|
+
'.nunjucks'
|
|
401
|
+
].includes(entryExt)) fileOutputpath = fileOutputpath.replace(entryExt, '.html');
|
|
402
|
+
if ([
|
|
403
|
+
'.css',
|
|
404
|
+
'.scss',
|
|
405
|
+
'.sass',
|
|
406
|
+
'.less'
|
|
407
|
+
].includes(entryExt)) fileOutputpath = fileOutputpath.replace(entryExt, '.css');
|
|
408
|
+
return unixify(fileOutputpath || '');
|
|
409
|
+
}
|
|
410
|
+
function unixify(filePath) {
|
|
411
|
+
return filePath.replace(/\\/g, '/');
|
|
412
|
+
}
|
|
474
413
|
function background_background(manifest) {
|
|
475
414
|
return manifest.background && manifest.background.scripts && {
|
|
476
415
|
background: {
|
|
@@ -2414,7 +2353,7 @@ class StaticAssetsPlugin {
|
|
|
2414
2353
|
rules: []
|
|
2415
2354
|
};
|
|
2416
2355
|
compiler.options.module.rules = compiler.options.module.rules || [];
|
|
2417
|
-
const filenamePattern = 'assets/[name].[contenthash:8][ext]';
|
|
2356
|
+
const filenamePattern = 'production' === this.mode ? 'assets/[name].[contenthash:8][ext]' : 'assets/[name][ext]';
|
|
2418
2357
|
const defaultSvgRule = {
|
|
2419
2358
|
test: /\.svg$/i,
|
|
2420
2359
|
type: 'asset',
|
|
@@ -3933,7 +3872,8 @@ function emitDirectoryAsAssets(compilation, absDir, baseDir) {
|
|
|
3933
3872
|
walk(absDir);
|
|
3934
3873
|
}
|
|
3935
3874
|
function emitFileAsAsset(compilation, absPath) {
|
|
3936
|
-
const
|
|
3875
|
+
const mode = compilation.options?.mode || 'development';
|
|
3876
|
+
const filenamePattern = 'production' === mode ? 'assets/[name].[contenthash:8][ext]' : 'assets/[name][ext]';
|
|
3937
3877
|
const ext = __rspack_external_path.extname(absPath);
|
|
3938
3878
|
const name = __rspack_external_path.basename(absPath, ext);
|
|
3939
3879
|
const content = __rspack_external_fs.readFileSync(absPath);
|
|
@@ -4839,7 +4779,6 @@ function javaScriptError(errorSourcePath, missingFilePath, opts) {
|
|
|
4839
4779
|
lines.push(`Missing script file in ${pintor.underline(errorSourcePath)}.`);
|
|
4840
4780
|
lines.push(`Update your ${pintor.yellow("<script>")} src to point to a file that exists.`);
|
|
4841
4781
|
if (opts?.publicRootHint) lines.push(`Paths starting with '/' are resolved from the extension output root (served from ${pintor.yellow('public/')}), not your source directory.`);
|
|
4842
|
-
if (opts?.deadRefHint) lines.push(`Chrome loads the page anyway and 404s this reference silently — likely dead code. Set ${pintor.yellow('EXTENSION_STRICT_REFS=true')} to make this a build error.`);
|
|
4843
4782
|
lines.push('');
|
|
4844
4783
|
lines.push(`${pintor.red('NOT FOUND')} ${pintor.underline(missingFilePath)}`);
|
|
4845
4784
|
return lines.join('\n');
|
|
@@ -4849,7 +4788,6 @@ function cssError(errorSourcePath, missingFilePath, opts) {
|
|
|
4849
4788
|
lines.push(`Missing stylesheet in ${pintor.underline(errorSourcePath)}.`);
|
|
4850
4789
|
lines.push(`Update your ${pintor.yellow('<link>')} href to point to a file that exists.`);
|
|
4851
4790
|
if (opts?.publicRootHint) lines.push(`Paths starting with '/' are resolved from the extension output root (served from ${pintor.yellow('public/')}), not your source directory.`);
|
|
4852
|
-
if (opts?.deadRefHint) lines.push(`Chrome loads the page anyway and 404s this reference silently — likely dead code. Set ${pintor.yellow('EXTENSION_STRICT_REFS=true')} to make this a build error.`);
|
|
4853
4791
|
lines.push('');
|
|
4854
4792
|
lines.push(`${pintor.red('NOT FOUND')} ${pintor.underline(missingFilePath)}`);
|
|
4855
4793
|
return lines.join('\n');
|
|
@@ -4861,7 +4799,6 @@ function staticAssetError(errorSourcePath, missingFilePath, opts) {
|
|
|
4861
4799
|
const ref = opts?.refLabel || '*' + extname;
|
|
4862
4800
|
lines.push(`Update the ${pintor.yellow(ref)} reference to point to a file that exists.`);
|
|
4863
4801
|
if (opts?.publicRootHint) lines.push(`Paths starting with '/' are resolved from the extension output root (served from ${pintor.yellow('public/')}), not your source directory.`);
|
|
4864
|
-
if (opts?.deadRefHint) lines.push(`Chrome loads the page anyway and 404s this reference silently — likely dead code. Set ${pintor.yellow('EXTENSION_STRICT_REFS=true')} to make this a build error.`);
|
|
4865
4802
|
lines.push('');
|
|
4866
4803
|
lines.push(`${pintor.red('NOT FOUND')} ${pintor.underline(missingFilePath)}`);
|
|
4867
4804
|
return lines.join('\n');
|
|
@@ -5190,7 +5127,6 @@ function warnMissingPublicRootResources(params) {
|
|
|
5190
5127
|
const trimmed = publicRootUrl.replace(/^\//, '');
|
|
5191
5128
|
const publicRootAbs = __rspack_external_path.join(publicRootForResource, trimmed);
|
|
5192
5129
|
const outputRootAssetAbs = __rspack_external_path.join(outputRoot, trimmed);
|
|
5193
|
-
if (resolveRootAbsoluteRef(publicRootUrl, projectRoot, publicRootForResource)) return;
|
|
5194
5130
|
if (!__rspack_external_fs.existsSync(publicRootAbs) && !__rspack_external_fs.existsSync(outputRootAssetAbs)) {
|
|
5195
5131
|
const displayPath = __rspack_external_path.join(outputRoot, trimmed);
|
|
5196
5132
|
reportToCompilation(compilation, compiler, fileNotFound(resource, displayPath, {
|
|
@@ -5204,15 +5140,12 @@ function warnMissingPublicRootResources(params) {
|
|
|
5204
5140
|
}
|
|
5205
5141
|
function checkMissingLocalEntries(params) {
|
|
5206
5142
|
const { compilation, compiler, resource, manifestDir, projectRoot, js, css } = params;
|
|
5207
|
-
const strictRefs = 'true' === process.env.EXTENSION_STRICT_REFS;
|
|
5208
5143
|
const check = (url)=>{
|
|
5209
5144
|
if (!url || isHttpLike(url) || isSpecialScheme(url)) return;
|
|
5210
|
-
if (url.startsWith('/') && !
|
|
5145
|
+
if (url.startsWith('/') && !__rspack_external_path.isAbsolute(url)) return;
|
|
5211
5146
|
if (!__rspack_external_fs.existsSync(url)) {
|
|
5212
5147
|
const displayFile = __rspack_external_path.relative(manifestDir, resource);
|
|
5213
|
-
reportToCompilation(compilation, compiler, fileNotFound(displayFile, url,
|
|
5214
|
-
deadRefHint: !strictRefs
|
|
5215
|
-
}), strictRefs ? 'error' : 'warning', displayFile);
|
|
5148
|
+
reportToCompilation(compilation, compiler, fileNotFound(displayFile, url), 'error', displayFile);
|
|
5216
5149
|
}
|
|
5217
5150
|
};
|
|
5218
5151
|
js?.forEach(check);
|
|
@@ -5382,15 +5315,12 @@ function isClassicScript(filePath) {
|
|
|
5382
5315
|
}
|
|
5383
5316
|
}
|
|
5384
5317
|
function classicConcatEntry(feature, jsFiles) {
|
|
5385
|
-
const deduped = [
|
|
5386
|
-
...new Set(jsFiles)
|
|
5387
|
-
];
|
|
5388
5318
|
const queryData = encodeURIComponent(JSON.stringify({
|
|
5389
5319
|
feature,
|
|
5390
|
-
js:
|
|
5320
|
+
js: jsFiles,
|
|
5391
5321
|
css: []
|
|
5392
5322
|
}));
|
|
5393
|
-
return `${
|
|
5323
|
+
return `${jsFiles[0]}?__extensionjs_classic_concat__=${queryData}`;
|
|
5394
5324
|
}
|
|
5395
5325
|
const WILDCARD_HOSTS = new Set([
|
|
5396
5326
|
'0.0.0.0',
|
|
@@ -5496,6 +5426,8 @@ class AddScriptsAndStylesToCompilation {
|
|
|
5496
5426
|
const htmlEntries = this.includeList || {};
|
|
5497
5427
|
const manifestDir = __rspack_external_path.dirname(this.manifestPath);
|
|
5498
5428
|
const projectRoot = compiler.options.context || manifestDir;
|
|
5429
|
+
const publicDir = __rspack_external_path.join(projectRoot, 'public');
|
|
5430
|
+
const hasPublicDir = __rspack_external_fs.existsSync(publicDir);
|
|
5499
5431
|
const devServerHmrImports = 'development' === compiler.options.mode ? getDevServerHmrImports(compiler) : [];
|
|
5500
5432
|
for (const field of Object.entries(htmlEntries)){
|
|
5501
5433
|
const [feature, resource] = field;
|
|
@@ -5503,10 +5435,9 @@ class AddScriptsAndStylesToCompilation {
|
|
|
5503
5435
|
if (!__rspack_external_fs.existsSync(resource)) continue;
|
|
5504
5436
|
const htmlAssets = getAssetsFromHtml(resource);
|
|
5505
5437
|
const isRemoteUrl = (p)=>/^(https?:)?\/\//i.test(p);
|
|
5506
|
-
const looksLikePublicRootUrl = (p)=>p.startsWith('/public/') || p.startsWith('/') && !p.startsWith(projectRoot);
|
|
5507
|
-
const
|
|
5508
|
-
const
|
|
5509
|
-
const cssAssets = (htmlAssets?.css || []).filter((asset)=>!looksLikePublicRootUrl(asset) && !isRemoteUrl(asset) && !isMissingLocalFile(asset));
|
|
5438
|
+
const looksLikePublicRootUrl = (p)=>p.startsWith('/public/') || p.startsWith('/') && !p.startsWith(projectRoot) && hasPublicDir;
|
|
5439
|
+
const jsAssets = (htmlAssets?.js || []).filter((asset)=>!looksLikePublicRootUrl(asset) && !isRemoteUrl(asset));
|
|
5440
|
+
const cssAssets = (htmlAssets?.css || []).filter((asset)=>!looksLikePublicRootUrl(asset) && !isRemoteUrl(asset));
|
|
5510
5441
|
const moduleJsAssets = new Set(htmlAssets?.moduleJs || []);
|
|
5511
5442
|
const concatenateClassic = jsAssets.length > 1 && jsAssets.every((asset)=>!moduleJsAssets.has(asset) && /\.(js|cjs)$/i.test(asset) && isClassicScript(asset));
|
|
5512
5443
|
const jsImports = concatenateClassic ? [
|
|
@@ -8053,56 +7984,31 @@ const BRIDGE_PRODUCER_SOURCE = `;(function () {
|
|
|
8053
7984
|
|
|
8054
7985
|
// Multi-context console forwarding: other contexts (content scripts, surface
|
|
8055
7986
|
// pages) can't reliably open ws://127.0.0.1 (page CSP / connect-src), so they
|
|
8056
|
-
// relay console to this SW, which owns the WS.
|
|
8057
|
-
//
|
|
8058
|
-
// invisible to the extension's own onMessage listeners. With sendMessage, an
|
|
8059
|
-
// extension whose SW echoes every message back to its tabs (wild newtube:
|
|
8060
|
-
// onMessage → tabs.sendMessage(msg) to all tabs) turned each relayed log
|
|
8061
|
-
// into a new tab message, whose subject-side console.log became another
|
|
8062
|
-
// relayed envelope — a self-sustaining dev-only message storm (25k rows/10min
|
|
8063
|
-
// observed) that starved the extension system and wedged Chromium's DevTools
|
|
8064
|
-
// endpoint (family B). We enrich with the real tabId/url from the port sender.
|
|
8065
|
-
function shipRelayedLog(ev, sender) {
|
|
8066
|
-
try {
|
|
8067
|
-
send({
|
|
8068
|
-
type: "log",
|
|
8069
|
-
event: {
|
|
8070
|
-
v: 1,
|
|
8071
|
-
id: nowId(),
|
|
8072
|
-
timestamp: Date.now(),
|
|
8073
|
-
level: ev.level || "log",
|
|
8074
|
-
context: ev.context || "content",
|
|
8075
|
-
messageParts: Array.isArray(ev.messageParts) ? ev.messageParts : [],
|
|
8076
|
-
url: ev.url || (sender ? sender.url : undefined),
|
|
8077
|
-
tabId: sender && sender.tab ? sender.tab.id : undefined,
|
|
8078
|
-
frameId: sender ? sender.frameId : undefined,
|
|
8079
|
-
runId: INSTANCE_ID
|
|
8080
|
-
}
|
|
8081
|
-
});
|
|
8082
|
-
} catch (e) {}
|
|
8083
|
-
}
|
|
8084
|
-
try {
|
|
8085
|
-
var rtPort = g.chrome;
|
|
8086
|
-
if (rtPort && rtPort.runtime && rtPort.runtime.onConnect) {
|
|
8087
|
-
rtPort.runtime.onConnect.addListener(function (port) {
|
|
8088
|
-
if (!port || port.name !== "__extjs-bridge-log__") return;
|
|
8089
|
-
try {
|
|
8090
|
-
port.onMessage.addListener(function (msg) {
|
|
8091
|
-
if (!msg || !msg.__extjsBridgeLog) return;
|
|
8092
|
-
shipRelayedLog(msg.__extjsBridgeLog, port.sender);
|
|
8093
|
-
});
|
|
8094
|
-
} catch (e) {}
|
|
8095
|
-
});
|
|
8096
|
-
}
|
|
8097
|
-
} catch (e) {}
|
|
8098
|
-
// Legacy sendMessage path: kept for any surface still relaying the old way
|
|
8099
|
-
// (harmless one-predicate listener; new relays never use it).
|
|
7987
|
+
// relay console via chrome.runtime.sendMessage to this SW, which owns the WS.
|
|
7988
|
+
// We enrich with the real tabId/url from the message sender.
|
|
8100
7989
|
try {
|
|
8101
7990
|
var rt = g.chrome;
|
|
8102
7991
|
if (rt && rt.runtime && rt.runtime.onMessage) {
|
|
8103
7992
|
rt.runtime.onMessage.addListener(function (msg, sender) {
|
|
8104
7993
|
if (!msg || !msg.__extjsBridgeLog) return;
|
|
8105
|
-
|
|
7994
|
+
var ev = msg.__extjsBridgeLog;
|
|
7995
|
+
try {
|
|
7996
|
+
send({
|
|
7997
|
+
type: "log",
|
|
7998
|
+
event: {
|
|
7999
|
+
v: 1,
|
|
8000
|
+
id: nowId(),
|
|
8001
|
+
timestamp: Date.now(),
|
|
8002
|
+
level: ev.level || "log",
|
|
8003
|
+
context: ev.context || "content",
|
|
8004
|
+
messageParts: Array.isArray(ev.messageParts) ? ev.messageParts : [],
|
|
8005
|
+
url: ev.url || (sender ? sender.url : undefined),
|
|
8006
|
+
tabId: sender && sender.tab ? sender.tab.id : undefined,
|
|
8007
|
+
frameId: sender ? sender.frameId : undefined,
|
|
8008
|
+
runId: INSTANCE_ID
|
|
8009
|
+
}
|
|
8010
|
+
});
|
|
8011
|
+
} catch (e) {}
|
|
8106
8012
|
// No async response.
|
|
8107
8013
|
});
|
|
8108
8014
|
}
|
|
@@ -8165,8 +8071,7 @@ const BRIDGE_RELAY_SOURCE = `;(function () {
|
|
|
8165
8071
|
|
|
8166
8072
|
var CONTEXT = "__EXTJS_CONTEXT__";
|
|
8167
8073
|
var chrome = g.chrome;
|
|
8168
|
-
if (!chrome || !chrome.runtime) return;
|
|
8169
|
-
var canRelay = typeof chrome.runtime.connect === "function";
|
|
8074
|
+
if (!chrome || !chrome.runtime || typeof chrome.runtime.sendMessage !== "function") return;
|
|
8170
8075
|
|
|
8171
8076
|
g.__extjsBridgeRelayInstalled = true;
|
|
8172
8077
|
var consoleRef = g.console || {};
|
|
@@ -8188,39 +8093,14 @@ const BRIDGE_RELAY_SOURCE = `;(function () {
|
|
|
8188
8093
|
|
|
8189
8094
|
function here() { try { return g.location ? g.location.href : undefined; } catch (e) { return undefined; } }
|
|
8190
8095
|
|
|
8191
|
-
// Lazy named port to the SW producer. Connecting wakes an idle SW like
|
|
8192
|
-
// sendMessage does, but port frames never reach the extension's own
|
|
8193
|
-
// onMessage listeners (see the loop note above). Reconnect on demand: the
|
|
8194
|
-
// SW idling out (or reloading) disconnects the port; the next log redials.
|
|
8195
|
-
var logPort = null;
|
|
8196
|
-
function getLogPort() {
|
|
8197
|
-
if (!canRelay) return null;
|
|
8198
|
-
if (logPort) return logPort;
|
|
8199
|
-
try {
|
|
8200
|
-
logPort = chrome.runtime.connect({name: "__extjs-bridge-log__"});
|
|
8201
|
-
logPort.onDisconnect.addListener(function () {
|
|
8202
|
-
try { void chrome.runtime.lastError; } catch (e) {}
|
|
8203
|
-
logPort = null;
|
|
8204
|
-
});
|
|
8205
|
-
} catch (e) { logPort = null; }
|
|
8206
|
-
return logPort;
|
|
8207
|
-
}
|
|
8208
|
-
|
|
8209
8096
|
LEVELS.forEach(function (level) {
|
|
8210
8097
|
var orig = typeof consoleRef[level] === "function" ? consoleRef[level].bind(consoleRef) : function () {};
|
|
8211
8098
|
consoleRef[level] = function () {
|
|
8212
8099
|
try {
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
} catch (e) {
|
|
8218
|
-
// stale port (SW restarted): drop it and redial once
|
|
8219
|
-
logPort = null;
|
|
8220
|
-
var p2 = getLogPort();
|
|
8221
|
-
if (p2) { try { p2.postMessage({__extjsBridgeLog: {level: level, context: CONTEXT, messageParts: sanitize([].slice.call(arguments)), url: here()}}); } catch (e2) {} }
|
|
8222
|
-
}
|
|
8223
|
-
}
|
|
8100
|
+
chrome.runtime.sendMessage(
|
|
8101
|
+
{__extjsBridgeLog: {level: level, context: CONTEXT, messageParts: sanitize([].slice.call(arguments)), url: here()}},
|
|
8102
|
+
function () { void chrome.runtime.lastError; } // swallow "no receiver" while the SW wakes
|
|
8103
|
+
);
|
|
8224
8104
|
} catch (e) {}
|
|
8225
8105
|
return orig.apply(consoleRef, arguments);
|
|
8226
8106
|
};
|
|
@@ -10644,26 +10524,6 @@ function webpackConfig(projectStructure, devOptions) {
|
|
|
10644
10524
|
'node_modules',
|
|
10645
10525
|
__rspack_external_path.join(process.cwd(), 'node_modules')
|
|
10646
10526
|
],
|
|
10647
|
-
roots: [
|
|
10648
|
-
__rspack_external_path.join(packageJsonDir, 'public'),
|
|
10649
|
-
__rspack_external_path.dirname(manifestPath)
|
|
10650
|
-
],
|
|
10651
|
-
extensionAlias: {
|
|
10652
|
-
'.js': [
|
|
10653
|
-
'.ts',
|
|
10654
|
-
'.tsx',
|
|
10655
|
-
'.js',
|
|
10656
|
-
'.jsx'
|
|
10657
|
-
],
|
|
10658
|
-
'.mjs': [
|
|
10659
|
-
'.mts',
|
|
10660
|
-
'.mjs'
|
|
10661
|
-
],
|
|
10662
|
-
'.cjs': [
|
|
10663
|
-
'.cts',
|
|
10664
|
-
'.cjs'
|
|
10665
|
-
]
|
|
10666
|
-
},
|
|
10667
10527
|
extensions: [
|
|
10668
10528
|
'.js',
|
|
10669
10529
|
'.cjs',
|
package/dist/101.mjs
CHANGED
|
@@ -117,9 +117,6 @@ function authorInstallNotice(target) {
|
|
|
117
117
|
function projectInstallFallbackToNpm(pmName) {
|
|
118
118
|
return `${getLoggingPrefix('warn')} Dependency install with ${pmName} failed. Retrying once with npm so the build can continue.`;
|
|
119
119
|
}
|
|
120
|
-
function projectInstallScriptsDisabled(pmName) {
|
|
121
|
-
return `${getLoggingPrefix('info')} Installing project dependencies with ${pmName}. Lifecycle scripts are disabled for safety — set EXTENSION_ALLOW_INSTALL_SCRIPTS=true to run them.`;
|
|
122
|
-
}
|
|
123
120
|
function buildWebpack(projectDir, stats, browser) {
|
|
124
121
|
const statsJson = stats?.toJson({
|
|
125
122
|
all: false,
|
|
@@ -677,7 +674,7 @@ async function config_loader_isUsingExperimentalConfig(projectPath) {
|
|
|
677
674
|
}
|
|
678
675
|
return false;
|
|
679
676
|
}
|
|
680
|
-
var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.0.7
|
|
677
|
+
var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"4.0.7","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^2.1.1","@rspack/dev-server":"2.1.0","@rspack/plugin-preact-refresh":"2.0.1","@rspack/plugin-react-refresh":"2.0.2","@vue/compiler-sfc":"3.5.26","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.9","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","dotenv":"^17.2.3","es-module-lexer":"^2.1.0","extension-from-store":"^0.1.1","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.6.7","less-loader":"13.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.10","postcss-loader":"8.2.1","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"10.27.3","prefers-yarn":"2.0.1","react-refresh":"0.18.0","sass-loader":"17.0.0","schema-utils":"^4.3.3","svelte-loader":"3.2.4","tiny-glob":"^0.2.9","typescript":"5.9.3","vue":"3.5.26","vue-loader":"17.4.2","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.20.1"}}');
|
|
681
678
|
function asAbsolute(p) {
|
|
682
679
|
return __rspack_external_path.isAbsolute(p) ? p : __rspack_external_path.resolve(p);
|
|
683
680
|
}
|
|
@@ -1637,10 +1634,6 @@ function createPlaywrightMetadataWriter(options) {
|
|
|
1637
1634
|
if (__rspack_external_fs.existsSync(readyPath)) {
|
|
1638
1635
|
const prev = JSON.parse(__rspack_external_fs.readFileSync(readyPath, 'utf-8'));
|
|
1639
1636
|
if ('number' == typeof prev.cdpPort) payload.cdpPort = prev.cdpPort;
|
|
1640
|
-
if ('string' == typeof prev.browserExitedAt) {
|
|
1641
|
-
payload.browserExitedAt = prev.browserExitedAt;
|
|
1642
|
-
payload.browserExitCode = prev.browserExitCode ?? null;
|
|
1643
|
-
}
|
|
1644
1637
|
}
|
|
1645
1638
|
} catch {}
|
|
1646
1639
|
writeJsonAtomic(readyPath, payload);
|
|
@@ -2120,4 +2113,4 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions, browserLauncher
|
|
|
2120
2113
|
await browserLauncher(resolvedOpts);
|
|
2121
2114
|
metadata.writeReady();
|
|
2122
2115
|
}
|
|
2123
|
-
export { PlaywrightPlugin, asAbsolute, assertNoManagedDependencyConflicts, authorInstallNotice, autoExitForceKill, autoExitModeEnabled, autoExitTriggered, browserRunnerDisabled, buildCommandFailed, buildSuccess, buildSuccessWithWarnings, buildWarningsDetails, buildWebpack, bundlerFatalError, bundlerRecompiling, computeExtensionsToLoad, constants_isGeckoBasedBrowser, createPlaywrightMetadataWriter, debugBrowser, debugContextPath, debugDirs, debugExtensionsToLoad, debugOutputPath, devServerStartTimeout, downloadingText, extensionJsRunnerError, extensionPreview, failedToDownloadOrExtractZIPFileError, getDirs, getDistPath, getProjectStructure, getSpecialFoldersDataForCompiler, getSpecialFoldersDataForProjectRoot, invalidRemoteZip, isChromiumBasedBrowser, loadBrowserConfig, loadCommandConfig, loadCustomConfig, localZipNotFound, manifestInvalidJson, messages_ready, needsInstall, noCompanionExtensionsResolved, noEntrypointsDetected, normalizeBrowser, notAZipArchive, package_namespaceObject, packagingDistributionFiles, packagingSourceFiles, portInUse, projectInstallFallbackToNpm,
|
|
2116
|
+
export { PlaywrightPlugin, asAbsolute, assertNoManagedDependencyConflicts, authorInstallNotice, autoExitForceKill, autoExitModeEnabled, autoExitTriggered, browserRunnerDisabled, buildCommandFailed, buildSuccess, buildSuccessWithWarnings, buildWarningsDetails, buildWebpack, bundlerFatalError, bundlerRecompiling, computeExtensionsToLoad, constants_isGeckoBasedBrowser, createPlaywrightMetadataWriter, debugBrowser, debugContextPath, debugDirs, debugExtensionsToLoad, debugOutputPath, devServerStartTimeout, downloadingText, extensionJsRunnerError, extensionPreview, failedToDownloadOrExtractZIPFileError, getDirs, getDistPath, getProjectStructure, getSpecialFoldersDataForCompiler, getSpecialFoldersDataForProjectRoot, invalidRemoteZip, isChromiumBasedBrowser, loadBrowserConfig, loadCommandConfig, loadCustomConfig, localZipNotFound, manifestInvalidJson, messages_ready, needsInstall, noCompanionExtensionsResolved, noEntrypointsDetected, normalizeBrowser, notAZipArchive, package_namespaceObject, packagingDistributionFiles, packagingSourceFiles, portInUse, projectInstallFallbackToNpm, resolveCompanionExtensionDirs, resolveCompanionExtensionsConfig, sanitize, spacerLine, toPosixPath, treeWithDistFilesbrowser, treeWithSourceAndDistFiles, treeWithSourceFiles, unpackagedSuccessfully, unpackagingExtension, writingTypeDefinitions, writingTypeDefinitionsError };
|
package/dist/839.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { execFileSync, spawn, spawnSync as external_child_process_spawnSync } fr
|
|
|
4
4
|
import { buildExecEnv, detectPackageManagerFromLockfile } from "prefers-yarn";
|
|
5
5
|
import pintor from "pintor";
|
|
6
6
|
import { EventEmitter } from "node:events";
|
|
7
|
-
import { package_namespaceObject, buildSuccessWithWarnings, buildWarningsDetails, loadCommandConfig, needsInstall, getDirs, buildCommandFailed,
|
|
7
|
+
import { package_namespaceObject, buildSuccessWithWarnings, buildWarningsDetails, loadCommandConfig, needsInstall, getDirs, buildCommandFailed, sanitize, writingTypeDefinitions, projectInstallFallbackToNpm, buildWebpack, assertNoManagedDependencyConflicts, debugDirs, debugBrowser, normalizeBrowser, debugOutputPath, loadCustomConfig, buildSuccess, writingTypeDefinitionsError, getDistPath, loadBrowserConfig, getProjectStructure, authorInstallNotice, resolveCompanionExtensionsConfig, getSpecialFoldersDataForProjectRoot } from "./101.mjs";
|
|
8
8
|
import { stripBom, parseJsonSafe } from "./23.mjs";
|
|
9
9
|
import { hasProjectDependency, findNearestProjectManifestDirSync } from "./80.mjs";
|
|
10
10
|
import { getCanonicalContentScriptEntryName } from "./291.mjs";
|
|
@@ -14,11 +14,6 @@ var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(imp
|
|
|
14
14
|
import * as __rspack_external_fs from "fs";
|
|
15
15
|
import * as __rspack_external_path from "path";
|
|
16
16
|
import * as __rspack_external_fs_promises_400951f8 from "fs/promises";
|
|
17
|
-
const RUST_MIN_STACK_BYTES = 268435456;
|
|
18
|
-
function ensureRustMinStack(env = process.env) {
|
|
19
|
-
if (!env.RUST_MIN_STACK) env.RUST_MIN_STACK = String(RUST_MIN_STACK_BYTES);
|
|
20
|
-
}
|
|
21
|
-
ensureRustMinStack();
|
|
22
17
|
function getBuildSummary(browser, info) {
|
|
23
18
|
const assets = info?.assets || [];
|
|
24
19
|
return {
|
|
@@ -352,29 +347,6 @@ function projectInstallArgs(pm, projectDir) {
|
|
|
352
347
|
'--ignore-workspace'
|
|
353
348
|
];
|
|
354
349
|
}
|
|
355
|
-
function installScriptSuppression(pm) {
|
|
356
|
-
if ('true' === process.env.EXTENSION_ALLOW_INSTALL_SCRIPTS) return {
|
|
357
|
-
args: [],
|
|
358
|
-
env: {}
|
|
359
|
-
};
|
|
360
|
-
if ('deno' === pm.name) return {
|
|
361
|
-
args: [],
|
|
362
|
-
env: {}
|
|
363
|
-
};
|
|
364
|
-
if ('yarn' === pm.name) return {
|
|
365
|
-
args: [],
|
|
366
|
-
env: {
|
|
367
|
-
YARN_ENABLE_SCRIPTS: 'false',
|
|
368
|
-
npm_config_ignore_scripts: 'true'
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
return {
|
|
372
|
-
args: [
|
|
373
|
-
"--ignore-scripts"
|
|
374
|
-
],
|
|
375
|
-
env: {}
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
350
|
function resolveNpmPackageManager() {
|
|
379
351
|
return hydrateResolvedPackageManager('npm') || {
|
|
380
352
|
name: 'npm'
|
|
@@ -425,10 +397,7 @@ function execInstallCommand(command, args, options) {
|
|
|
425
397
|
const child = spawn(invocation.command, invocation.args, {
|
|
426
398
|
cwd: options?.cwd,
|
|
427
399
|
stdio,
|
|
428
|
-
env:
|
|
429
|
-
...env || process.env,
|
|
430
|
-
...options?.env
|
|
431
|
-
},
|
|
400
|
+
env: env || process.env,
|
|
432
401
|
...useShell ? {
|
|
433
402
|
shell: true
|
|
434
403
|
} : {}
|
|
@@ -445,34 +414,27 @@ async function ensureUserProjectDependencies(packageJsonDir) {
|
|
|
445
414
|
const pm = resolvePackageManager({
|
|
446
415
|
cwd: packageJsonDir
|
|
447
416
|
});
|
|
448
|
-
const suppression = installScriptSuppression(pm);
|
|
449
417
|
const cmd = buildInstallCommand(pm, [
|
|
450
418
|
'install',
|
|
451
|
-
...suppression.args,
|
|
452
419
|
...projectInstallArgs(pm, packageJsonDir)
|
|
453
420
|
]);
|
|
454
|
-
if (suppression.args.length || Object.keys(suppression.env).length) console.warn(projectInstallScriptsDisabled(pm.name));
|
|
455
421
|
try {
|
|
456
422
|
await execInstallCommand(cmd.command, cmd.args, {
|
|
457
423
|
cwd: packageJsonDir,
|
|
458
|
-
stdio: 'inherit'
|
|
459
|
-
env: suppression.env
|
|
424
|
+
stdio: 'inherit'
|
|
460
425
|
});
|
|
461
426
|
} catch (error) {
|
|
462
427
|
if ('npm' === pm.name) throw error;
|
|
463
428
|
if ('deno' === pm.name) throw error;
|
|
464
429
|
console.warn(projectInstallFallbackToNpm(pm.name));
|
|
465
430
|
const npmPm = resolveNpmPackageManager();
|
|
466
|
-
const npmSuppression = installScriptSuppression(npmPm);
|
|
467
431
|
const npmCmd = buildInstallCommand(npmPm, [
|
|
468
432
|
'install',
|
|
469
|
-
'--no-package-lock'
|
|
470
|
-
...npmSuppression.args
|
|
433
|
+
'--no-package-lock'
|
|
471
434
|
]);
|
|
472
435
|
await execInstallCommand(npmCmd.command, npmCmd.args, {
|
|
473
436
|
cwd: packageJsonDir,
|
|
474
|
-
stdio: 'inherit'
|
|
475
|
-
env: npmSuppression.env
|
|
437
|
+
stdio: 'inherit'
|
|
476
438
|
});
|
|
477
439
|
}
|
|
478
440
|
}
|