extension-develop 3.5.0 → 3.6.0
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 +30 -15
- package/dist/215.cjs +40 -22
- package/dist/323.cjs +123 -5
- package/dist/{547.cjs → 535.cjs} +2156 -461
- package/dist/928.cjs +10 -0
- package/dist/content-script-wrapper.cjs +72 -4
- package/dist/main-world-bridge.cjs +18 -0
- package/dist/minimum-script-file.cjs +7 -5
- package/dist/module.cjs +1112 -401
- package/dist/warn-no-default-export.cjs +32 -5
- package/package.json +2 -1
package/dist/module.cjs
CHANGED
|
@@ -127122,6 +127122,280 @@ var __webpack_modules__ = {
|
|
|
127122
127122
|
});
|
|
127123
127123
|
module.exports = library;
|
|
127124
127124
|
},
|
|
127125
|
+
"./webpack/feature-special-folders/folder-extensions/resolve-config.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
127126
|
+
"use strict";
|
|
127127
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
127128
|
+
R: ()=>resolveCompanionExtensionsConfig
|
|
127129
|
+
});
|
|
127130
|
+
var external_fs_ = __webpack_require__("fs");
|
|
127131
|
+
var external_path_ = __webpack_require__("path");
|
|
127132
|
+
const external_extension_from_store_namespaceObject = require("extension-from-store");
|
|
127133
|
+
var utils = __webpack_require__("./webpack/feature-special-folders/folder-extensions/utils.ts");
|
|
127134
|
+
function isPathLike(value) {
|
|
127135
|
+
if (external_path_.isAbsolute(value)) return true;
|
|
127136
|
+
if (value.startsWith('./') || value.startsWith('../')) return true;
|
|
127137
|
+
return value.includes('/') || value.includes('\\');
|
|
127138
|
+
}
|
|
127139
|
+
function isSubpathOf(parent, child) {
|
|
127140
|
+
const rel = external_path_.relative(parent, child);
|
|
127141
|
+
return '' !== rel && !rel.startsWith('..') && !external_path_.isAbsolute(rel);
|
|
127142
|
+
}
|
|
127143
|
+
function getBrowserFolder(browser) {
|
|
127144
|
+
if ('firefox' === browser || 'gecko-based' === browser || 'firefox-based' === browser) return 'firefox';
|
|
127145
|
+
if ('edge' === browser) return 'edge';
|
|
127146
|
+
return 'chrome';
|
|
127147
|
+
}
|
|
127148
|
+
function parseChromeWebStoreId(url) {
|
|
127149
|
+
if ('chromewebstore.google.com' !== url.hostname) return null;
|
|
127150
|
+
const match = url.pathname.match(/\/([a-z]{32})(?:\/|$)/i);
|
|
127151
|
+
return match ? match[1] : null;
|
|
127152
|
+
}
|
|
127153
|
+
function parseEdgeAddonsId(url) {
|
|
127154
|
+
if ('microsoftedge.microsoft.com' !== url.hostname) return null;
|
|
127155
|
+
const match = url.pathname.match(/\/([a-z]{32})(?:\/|$)/i);
|
|
127156
|
+
return match ? match[1] : null;
|
|
127157
|
+
}
|
|
127158
|
+
function parseAmoSlug(url) {
|
|
127159
|
+
if ('addons.mozilla.org' !== url.hostname) return null;
|
|
127160
|
+
const match = url.pathname.match(/\/addon\/([^/]+)(?:\/|$)/i);
|
|
127161
|
+
return match ? match[1] : null;
|
|
127162
|
+
}
|
|
127163
|
+
function parseStoreUrl(raw) {
|
|
127164
|
+
let url;
|
|
127165
|
+
try {
|
|
127166
|
+
url = new URL(raw);
|
|
127167
|
+
} catch {
|
|
127168
|
+
return null;
|
|
127169
|
+
}
|
|
127170
|
+
const chromeId = parseChromeWebStoreId(url);
|
|
127171
|
+
if (chromeId) return {
|
|
127172
|
+
browser: 'chrome',
|
|
127173
|
+
id: chromeId
|
|
127174
|
+
};
|
|
127175
|
+
const edgeId = parseEdgeAddonsId(url);
|
|
127176
|
+
if (edgeId) return {
|
|
127177
|
+
browser: 'edge',
|
|
127178
|
+
id: edgeId
|
|
127179
|
+
};
|
|
127180
|
+
const amoSlug = parseAmoSlug(url);
|
|
127181
|
+
if (amoSlug) return {
|
|
127182
|
+
browser: 'firefox',
|
|
127183
|
+
id: amoSlug
|
|
127184
|
+
};
|
|
127185
|
+
return null;
|
|
127186
|
+
}
|
|
127187
|
+
function ensurePathsUnderExtensions(projectRoot, paths) {
|
|
127188
|
+
const extensionsRoot = external_path_.resolve(projectRoot, 'extensions');
|
|
127189
|
+
return paths.map((p)=>{
|
|
127190
|
+
const abs = (0, utils.A$)(projectRoot, p);
|
|
127191
|
+
if (abs !== extensionsRoot && !isSubpathOf(extensionsRoot, abs) && external_path_.resolve(abs) !== extensionsRoot) throw new Error(`Companion extensions must be inside ${extensionsRoot}.\nInvalid path: ${abs}`);
|
|
127192
|
+
return abs;
|
|
127193
|
+
});
|
|
127194
|
+
}
|
|
127195
|
+
function findExtensionRoots(dir, maxDepth = 3) {
|
|
127196
|
+
const found = [];
|
|
127197
|
+
function walk(current, depth) {
|
|
127198
|
+
if (depth > maxDepth) return;
|
|
127199
|
+
if (!(0, utils.Q7)(current)) return;
|
|
127200
|
+
if ((0, utils.Uy)(current)) return void found.push(current);
|
|
127201
|
+
let entries = [];
|
|
127202
|
+
try {
|
|
127203
|
+
entries = external_fs_.readdirSync(current, {
|
|
127204
|
+
withFileTypes: true
|
|
127205
|
+
});
|
|
127206
|
+
} catch {
|
|
127207
|
+
return;
|
|
127208
|
+
}
|
|
127209
|
+
for (const ent of entries)if (ent.isDirectory()) {
|
|
127210
|
+
if (!ent.name.startsWith('.')) walk(external_path_.join(current, ent.name), depth + 1);
|
|
127211
|
+
}
|
|
127212
|
+
}
|
|
127213
|
+
walk(dir, 0);
|
|
127214
|
+
return found;
|
|
127215
|
+
}
|
|
127216
|
+
async function runExtensionFromStore(url, outDir) {
|
|
127217
|
+
const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
127218
|
+
await (0, external_extension_from_store_namespaceObject.fetchExtensionFromStore)(url, {
|
|
127219
|
+
outDir,
|
|
127220
|
+
extract: true,
|
|
127221
|
+
logger: isAuthor ? {
|
|
127222
|
+
onInfo: (message)=>console.log(message),
|
|
127223
|
+
onWarn: (message)=>console.warn(message),
|
|
127224
|
+
onError: (message, error)=>console.error(message, error)
|
|
127225
|
+
} : void 0
|
|
127226
|
+
});
|
|
127227
|
+
}
|
|
127228
|
+
async function resolveStoreExtensionToPath(opts) {
|
|
127229
|
+
const { projectRoot, storeUrl, browser, id } = opts;
|
|
127230
|
+
const extensionsRoot = external_path_.resolve(projectRoot, 'extensions');
|
|
127231
|
+
const targetRoot = external_path_.join(extensionsRoot, browser, id);
|
|
127232
|
+
const manifestPath = external_path_.join(targetRoot, 'manifest.json');
|
|
127233
|
+
if ((0, utils.fo)(manifestPath)) return targetRoot;
|
|
127234
|
+
await runExtensionFromStore(storeUrl, external_path_.join(extensionsRoot, browser));
|
|
127235
|
+
const candidates = findExtensionRoots(external_path_.join(extensionsRoot, browser));
|
|
127236
|
+
let selected;
|
|
127237
|
+
if (1 === candidates.length) selected = candidates[0];
|
|
127238
|
+
else if (candidates.length > 1) {
|
|
127239
|
+
const directMatch = candidates.find((c)=>external_path_.basename(c) === id);
|
|
127240
|
+
const versionedMatch = candidates.find((c)=>external_path_.basename(c).startsWith(`${id}@`));
|
|
127241
|
+
if (directMatch) selected = directMatch;
|
|
127242
|
+
else if (versionedMatch) selected = versionedMatch;
|
|
127243
|
+
}
|
|
127244
|
+
if (!selected) throw new Error(`Could not locate an unpacked extension from ${storeUrl}.`);
|
|
127245
|
+
external_fs_.mkdirSync(external_path_.dirname(targetRoot), {
|
|
127246
|
+
recursive: true
|
|
127247
|
+
});
|
|
127248
|
+
if (external_path_.basename(selected).startsWith(`${id}@`)) external_fs_.renameSync(selected, targetRoot);
|
|
127249
|
+
return targetRoot;
|
|
127250
|
+
}
|
|
127251
|
+
async function resolveCompanionExtensionsConfig(opts) {
|
|
127252
|
+
const { projectRoot, browser, config } = opts;
|
|
127253
|
+
if (!config) return;
|
|
127254
|
+
const normalized = (0, utils.cz)(config);
|
|
127255
|
+
const runtimeBrowser = getBrowserFolder(browser);
|
|
127256
|
+
const resolvedPaths = [];
|
|
127257
|
+
const localPaths = [];
|
|
127258
|
+
for (const entry of normalized.paths){
|
|
127259
|
+
const parsedStore = parseStoreUrl(entry);
|
|
127260
|
+
if (parsedStore) {
|
|
127261
|
+
if (parsedStore.browser !== runtimeBrowser) continue;
|
|
127262
|
+
const resolvedPath = await resolveStoreExtensionToPath({
|
|
127263
|
+
projectRoot,
|
|
127264
|
+
storeUrl: entry,
|
|
127265
|
+
browser: parsedStore.browser,
|
|
127266
|
+
id: parsedStore.id
|
|
127267
|
+
});
|
|
127268
|
+
resolvedPaths.push(resolvedPath);
|
|
127269
|
+
continue;
|
|
127270
|
+
}
|
|
127271
|
+
if (isPathLike(entry)) localPaths.push(entry);
|
|
127272
|
+
}
|
|
127273
|
+
if (localPaths.length > 0) {
|
|
127274
|
+
const absLocalPaths = ensurePathsUnderExtensions(projectRoot, localPaths);
|
|
127275
|
+
resolvedPaths.push(...absLocalPaths);
|
|
127276
|
+
}
|
|
127277
|
+
const output = {};
|
|
127278
|
+
if ('string' == typeof normalized.dir) {
|
|
127279
|
+
const absDir = (0, utils.A$)(projectRoot, normalized.dir);
|
|
127280
|
+
const extensionsRoot = external_path_.resolve(projectRoot, 'extensions');
|
|
127281
|
+
if (absDir !== extensionsRoot && !isSubpathOf(extensionsRoot, absDir)) throw new Error(`extensions.dir must be inside ${extensionsRoot}.\nInvalid dir: ${absDir}`);
|
|
127282
|
+
output.dir = normalized.dir;
|
|
127283
|
+
}
|
|
127284
|
+
if (resolvedPaths.length > 0) output.paths = resolvedPaths;
|
|
127285
|
+
return output;
|
|
127286
|
+
}
|
|
127287
|
+
},
|
|
127288
|
+
"./webpack/feature-special-folders/folder-extensions/utils.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
127289
|
+
"use strict";
|
|
127290
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
127291
|
+
A$: ()=>toAbs,
|
|
127292
|
+
Q7: ()=>isDir,
|
|
127293
|
+
Uy: ()=>isValidExtensionRoot,
|
|
127294
|
+
cz: ()=>normalizeCompanionConfig,
|
|
127295
|
+
fo: ()=>isFile
|
|
127296
|
+
});
|
|
127297
|
+
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
127298
|
+
var path__rspack_import_1 = __webpack_require__("path");
|
|
127299
|
+
function isDir(p) {
|
|
127300
|
+
try {
|
|
127301
|
+
return fs__rspack_import_0.existsSync(p) && fs__rspack_import_0.statSync(p).isDirectory();
|
|
127302
|
+
} catch {
|
|
127303
|
+
return false;
|
|
127304
|
+
}
|
|
127305
|
+
}
|
|
127306
|
+
function isFile(p) {
|
|
127307
|
+
try {
|
|
127308
|
+
return fs__rspack_import_0.existsSync(p) && fs__rspack_import_0.statSync(p).isFile();
|
|
127309
|
+
} catch {
|
|
127310
|
+
return false;
|
|
127311
|
+
}
|
|
127312
|
+
}
|
|
127313
|
+
function toAbs(projectRoot, p) {
|
|
127314
|
+
return path__rspack_import_1.isAbsolute(p) ? p : path__rspack_import_1.resolve(projectRoot, p);
|
|
127315
|
+
}
|
|
127316
|
+
function isValidExtensionRoot(dir) {
|
|
127317
|
+
if (!isDir(dir)) return false;
|
|
127318
|
+
return isFile(path__rspack_import_1.join(dir, 'manifest.json'));
|
|
127319
|
+
}
|
|
127320
|
+
function normalizeCompanionConfig(config) {
|
|
127321
|
+
const explicitPaths = [];
|
|
127322
|
+
let scanDir;
|
|
127323
|
+
if (Array.isArray(config)) explicitPaths.push(...config.filter((p)=>'string' == typeof p));
|
|
127324
|
+
else if (config && 'object' == typeof config) {
|
|
127325
|
+
if (Array.isArray(config.paths)) explicitPaths.push(...config.paths.filter((p)=>'string' == typeof p));
|
|
127326
|
+
if ('string' == typeof config.dir && config.dir.trim().length > 0) scanDir = config.dir.trim();
|
|
127327
|
+
}
|
|
127328
|
+
return {
|
|
127329
|
+
dir: scanDir,
|
|
127330
|
+
paths: explicitPaths
|
|
127331
|
+
};
|
|
127332
|
+
}
|
|
127333
|
+
},
|
|
127334
|
+
"./webpack/feature-special-folders/get-data.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
127335
|
+
"use strict";
|
|
127336
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
127337
|
+
B: ()=>getSpecialFoldersDataForCompiler,
|
|
127338
|
+
H: ()=>getSpecialFoldersDataForProjectRoot
|
|
127339
|
+
});
|
|
127340
|
+
var path__rspack_import_0 = __webpack_require__("path");
|
|
127341
|
+
var path__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(path__rspack_import_0);
|
|
127342
|
+
var fs__rspack_import_1 = __webpack_require__("fs");
|
|
127343
|
+
var browser_extension_manifest_fields__rspack_import_2 = __webpack_require__("browser-extension-manifest-fields");
|
|
127344
|
+
function isUnderPublicDir(entry, projectRoot, publicDir) {
|
|
127345
|
+
if (!entry) return false;
|
|
127346
|
+
const normalizedEntry = String(entry);
|
|
127347
|
+
const candidate = path__rspack_import_0_default().isAbsolute(normalizedEntry) ? normalizedEntry : path__rspack_import_0_default().join(projectRoot, normalizedEntry);
|
|
127348
|
+
const rel = path__rspack_import_0_default().relative(publicDir, candidate);
|
|
127349
|
+
return Boolean(rel && !rel.startsWith('..') && !path__rspack_import_0_default().isAbsolute(rel));
|
|
127350
|
+
}
|
|
127351
|
+
function filterPublicEntrypoints(list, projectRoot, publicDir) {
|
|
127352
|
+
const next = {};
|
|
127353
|
+
for (const [key, value] of Object.entries(list || {})){
|
|
127354
|
+
if (Array.isArray(value)) {
|
|
127355
|
+
const filtered = value.filter((entry)=>!isUnderPublicDir(String(entry), projectRoot, publicDir));
|
|
127356
|
+
if (filtered.length > 0) next[key] = filtered;
|
|
127357
|
+
continue;
|
|
127358
|
+
}
|
|
127359
|
+
if ('string' == typeof value) {
|
|
127360
|
+
if (!isUnderPublicDir(value, projectRoot, publicDir)) next[key] = value;
|
|
127361
|
+
continue;
|
|
127362
|
+
}
|
|
127363
|
+
}
|
|
127364
|
+
return next;
|
|
127365
|
+
}
|
|
127366
|
+
function getSpecialFoldersDataForCompiler(compiler) {
|
|
127367
|
+
const projectRoot = compiler.options.context || '';
|
|
127368
|
+
const publicDir = path__rspack_import_0_default().join(projectRoot, 'public');
|
|
127369
|
+
const data = (0, browser_extension_manifest_fields__rspack_import_2.getSpecialFoldersData)({
|
|
127370
|
+
manifestPath: path__rspack_import_0_default().join(projectRoot, 'package.json')
|
|
127371
|
+
});
|
|
127372
|
+
return finalizeSpecialFoldersData(data, projectRoot, publicDir);
|
|
127373
|
+
}
|
|
127374
|
+
function getSpecialFoldersDataForProjectRoot(projectRoot) {
|
|
127375
|
+
const publicDir = path__rspack_import_0_default().join(projectRoot, 'public');
|
|
127376
|
+
const data = (0, browser_extension_manifest_fields__rspack_import_2.getSpecialFoldersData)({
|
|
127377
|
+
manifestPath: path__rspack_import_0_default().join(projectRoot, 'package.json')
|
|
127378
|
+
});
|
|
127379
|
+
return finalizeSpecialFoldersData(data, projectRoot, publicDir);
|
|
127380
|
+
}
|
|
127381
|
+
function finalizeSpecialFoldersData(data, projectRoot, publicDir) {
|
|
127382
|
+
return {
|
|
127383
|
+
...data,
|
|
127384
|
+
pages: filterPublicEntrypoints(data.pages, projectRoot, publicDir),
|
|
127385
|
+
scripts: filterPublicEntrypoints(data.scripts, projectRoot, publicDir),
|
|
127386
|
+
extensions: getLocalExtensionsConfig(projectRoot)
|
|
127387
|
+
};
|
|
127388
|
+
}
|
|
127389
|
+
function getLocalExtensionsConfig(projectRoot) {
|
|
127390
|
+
if (!projectRoot) return;
|
|
127391
|
+
const extensionsDir = path__rspack_import_0_default().join(projectRoot, 'extensions');
|
|
127392
|
+
try {
|
|
127393
|
+
if (fs__rspack_import_1.existsSync(extensionsDir) && fs__rspack_import_1.statSync(extensionsDir).isDirectory()) return {
|
|
127394
|
+
dir: './extensions'
|
|
127395
|
+
};
|
|
127396
|
+
} catch {}
|
|
127397
|
+
}
|
|
127398
|
+
},
|
|
127125
127399
|
"./webpack/plugin-browsers/browsers-lib/banner.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
127126
127400
|
"use strict";
|
|
127127
127401
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -129189,83 +129463,8 @@ var __webpack_modules__ = {
|
|
|
129189
129463
|
if (Array.isArray(codeWanted)) return codeWanted.includes(code);
|
|
129190
129464
|
return code === codeWanted;
|
|
129191
129465
|
}
|
|
129466
|
+
var firefox_utils = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/firefox-utils.ts");
|
|
129192
129467
|
var external_path_ = __webpack_require__("path");
|
|
129193
|
-
var banner = __webpack_require__("./webpack/plugin-browsers/browsers-lib/banner.ts");
|
|
129194
|
-
async function waitForManifest(outPath, timeoutMs = 8000) {
|
|
129195
|
-
const manifestPath = external_path_.join(outPath, 'manifest.json');
|
|
129196
|
-
const start = Date.now();
|
|
129197
|
-
while(Date.now() - start < timeoutMs){
|
|
129198
|
-
try {
|
|
129199
|
-
if (external_fs_.existsSync(manifestPath)) return true;
|
|
129200
|
-
} catch {}
|
|
129201
|
-
await new Promise((resolve)=>setTimeout(resolve, 150));
|
|
129202
|
-
}
|
|
129203
|
-
return false;
|
|
129204
|
-
}
|
|
129205
|
-
async function printRunningInDevelopmentSummary(candidateAddonPaths, browser, extensionId, browserVersionLine) {
|
|
129206
|
-
try {
|
|
129207
|
-
let chosenPath = null;
|
|
129208
|
-
for (const p of candidateAddonPaths){
|
|
129209
|
-
const isManager = /extensions\/[a-z-]+-manager/.test(String(p));
|
|
129210
|
-
const isDevtools = /extension-js-devtools/.test(String(p));
|
|
129211
|
-
const isThemePath = /extension-js-theme/.test(String(p));
|
|
129212
|
-
if (isManager || isDevtools || isThemePath) continue;
|
|
129213
|
-
const mp = external_path_.join(p, 'manifest.json');
|
|
129214
|
-
if (external_fs_.existsSync(mp)) {
|
|
129215
|
-
const mf = JSON.parse(external_fs_.readFileSync(mp, 'utf-8'));
|
|
129216
|
-
const name = mf?.name || '';
|
|
129217
|
-
const isThemeManifest = mf?.theme != null || 'theme' === String(mf?.type || '');
|
|
129218
|
-
if ('string' == typeof name && !/Extension\.js DevTools/i.test(name) && !/theme/i.test(name) && !isThemeManifest) {
|
|
129219
|
-
chosenPath = p;
|
|
129220
|
-
break;
|
|
129221
|
-
}
|
|
129222
|
-
}
|
|
129223
|
-
}
|
|
129224
|
-
if (!chosenPath && candidateAddonPaths.length > 0) chosenPath = candidateAddonPaths[candidateAddonPaths.length - 1];
|
|
129225
|
-
if (!chosenPath) return false;
|
|
129226
|
-
const manifestPath = external_path_.join(chosenPath, 'manifest.json');
|
|
129227
|
-
if (!external_fs_.existsSync(manifestPath)) {
|
|
129228
|
-
const ready = await waitForManifest(chosenPath, 10000);
|
|
129229
|
-
if (!ready) return false;
|
|
129230
|
-
}
|
|
129231
|
-
const manifest = JSON.parse(external_fs_.readFileSync(manifestPath, 'utf-8'));
|
|
129232
|
-
const printed = await (0, banner.a)({
|
|
129233
|
-
browser,
|
|
129234
|
-
outPath: chosenPath,
|
|
129235
|
-
hostPort: {
|
|
129236
|
-
host: '127.0.0.1'
|
|
129237
|
-
},
|
|
129238
|
-
getInfo: async ()=>({
|
|
129239
|
-
extensionId: extensionId || '(temporary)',
|
|
129240
|
-
name: manifest.name,
|
|
129241
|
-
version: manifest.version
|
|
129242
|
-
}),
|
|
129243
|
-
browserVersionLine
|
|
129244
|
-
});
|
|
129245
|
-
return printed;
|
|
129246
|
-
} catch {
|
|
129247
|
-
return false;
|
|
129248
|
-
}
|
|
129249
|
-
}
|
|
129250
|
-
function printSourceInspection(html) {
|
|
129251
|
-
console.log(messages.sew());
|
|
129252
|
-
console.log(messages.sew());
|
|
129253
|
-
console.log(html);
|
|
129254
|
-
console.log(messages.sew());
|
|
129255
|
-
}
|
|
129256
|
-
function printLogEventPretty(event, color, colorFns, showTs) {
|
|
129257
|
-
const ts = showTs ? new Date(event.timestamp).toISOString() + ' ' : '';
|
|
129258
|
-
const level = event.level;
|
|
129259
|
-
const context = event.context;
|
|
129260
|
-
const text = event.messageParts[0];
|
|
129261
|
-
const url = event.url;
|
|
129262
|
-
const arrow = 'error' === level ? color ? colorFns.red('►►►') : '►►►' : 'warn' === level ? color ? colorFns.yellow('►►►') : '►►►' : 'log' === level ? color ? colorFns.gray('►►►') : '►►►' : color ? colorFns.blue('►►►') : '►►►';
|
|
129263
|
-
const where = url ? ` ${url}` : '';
|
|
129264
|
-
console.log(`${arrow} ${ts}${context}${where} - ${text}`);
|
|
129265
|
-
}
|
|
129266
|
-
function printLogEventJson(event) {
|
|
129267
|
-
console.log(JSON.stringify(event));
|
|
129268
|
-
}
|
|
129269
129468
|
function resolveAddonDirectory(baseDir, inputPath) {
|
|
129270
129469
|
let candidate = inputPath.replace(/\"/g, '');
|
|
129271
129470
|
if (!external_path_.isAbsolute(candidate)) candidate = external_path_.resolve(baseDir, candidate);
|
|
@@ -129317,12 +129516,22 @@ var __webpack_modules__ = {
|
|
|
129317
129516
|
}
|
|
129318
129517
|
async function installTemporaryAddon(client, addonsActor, addonPath, openDevTools) {
|
|
129319
129518
|
if (!addonsActor) throw new Error(messages.WVu('firefox', 'No addonsActor available from Firefox RDP.'));
|
|
129320
|
-
const
|
|
129321
|
-
|
|
129322
|
-
|
|
129323
|
-
|
|
129324
|
-
|
|
129325
|
-
|
|
129519
|
+
const tryInstall = async (pathToUse)=>client.request({
|
|
129520
|
+
to: addonsActor,
|
|
129521
|
+
type: 'installTemporaryAddon',
|
|
129522
|
+
addonPath: pathToUse,
|
|
129523
|
+
openDevTools
|
|
129524
|
+
});
|
|
129525
|
+
let clientResponse;
|
|
129526
|
+
try {
|
|
129527
|
+
clientResponse = await tryInstall(addonPath);
|
|
129528
|
+
} catch (error) {
|
|
129529
|
+
if ('win32' === process.platform) {
|
|
129530
|
+
const winPath = String(addonPath).replace(/\//g, '\\');
|
|
129531
|
+
if (winPath !== addonPath) clientResponse = await tryInstall(winPath);
|
|
129532
|
+
else throw error;
|
|
129533
|
+
} else throw error;
|
|
129534
|
+
}
|
|
129326
129535
|
return clientResponse;
|
|
129327
129536
|
}
|
|
129328
129537
|
async function deriveMozExtensionId(client) {
|
|
@@ -129335,99 +129544,7 @@ var __webpack_modules__ = {
|
|
|
129335
129544
|
} catch {}
|
|
129336
129545
|
} catch {}
|
|
129337
129546
|
}
|
|
129338
|
-
var
|
|
129339
|
-
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
|
|
129340
|
-
async function attachConsoleListeners(client) {
|
|
129341
|
-
try {
|
|
129342
|
-
const targets = await client.getTargets();
|
|
129343
|
-
for (const t of targets || [])try {
|
|
129344
|
-
const resolved = await client.getTargetFromDescriptor(String(t.actor || ''));
|
|
129345
|
-
const consoleActor = resolved?.consoleActor || t.consoleActor || t.webConsoleActor;
|
|
129346
|
-
if (consoleActor) try {
|
|
129347
|
-
await client.request({
|
|
129348
|
-
to: consoleActor,
|
|
129349
|
-
type: 'startListeners',
|
|
129350
|
-
listeners: [
|
|
129351
|
-
'ConsoleAPI',
|
|
129352
|
-
'PageError',
|
|
129353
|
-
'NetworkActivity'
|
|
129354
|
-
]
|
|
129355
|
-
});
|
|
129356
|
-
} catch {}
|
|
129357
|
-
} catch {}
|
|
129358
|
-
} catch {}
|
|
129359
|
-
}
|
|
129360
|
-
function subscribeUnifiedLogging(client, opts) {
|
|
129361
|
-
const levelMap = [
|
|
129362
|
-
'trace',
|
|
129363
|
-
'debug',
|
|
129364
|
-
'log',
|
|
129365
|
-
'info',
|
|
129366
|
-
'warn',
|
|
129367
|
-
'error'
|
|
129368
|
-
];
|
|
129369
|
-
const wantLevel = String(opts.level || 'info').toLowerCase();
|
|
129370
|
-
const wantIdx = Math.max(0, levelMap.indexOf(wantLevel));
|
|
129371
|
-
const wantContexts = Array.isArray(opts.contexts) ? opts.contexts.map((s)=>String(s)) : void 0;
|
|
129372
|
-
const urlFilter = String(opts.urlFilter || '');
|
|
129373
|
-
const tabFilter = opts.tabFilter || '';
|
|
129374
|
-
const fmt = opts.format || 'pretty';
|
|
129375
|
-
const showTs = false !== opts.timestamps;
|
|
129376
|
-
const color = !!opts.color;
|
|
129377
|
-
const colorFns = {
|
|
129378
|
-
red: (s)=>external_pintor_default().red ? external_pintor_default().red(s) : s,
|
|
129379
|
-
yellow: (s)=>external_pintor_default().brightYellow ? external_pintor_default().brightYellow(s) : s,
|
|
129380
|
-
gray: (s)=>external_pintor_default().gray ? external_pintor_default().gray(s) : s,
|
|
129381
|
-
blue: (s)=>external_pintor_default().blue ? external_pintor_default().blue(s) : s
|
|
129382
|
-
};
|
|
129383
|
-
client.on('message', (message)=>{
|
|
129384
|
-
try {
|
|
129385
|
-
const type = String(message?.type || '');
|
|
129386
|
-
if (!type) return;
|
|
129387
|
-
let level = 'info';
|
|
129388
|
-
let text = '';
|
|
129389
|
-
let url = '';
|
|
129390
|
-
let context = 'page';
|
|
129391
|
-
let tabId;
|
|
129392
|
-
if ('consoleAPICall' === type || 'logMessage' === type) {
|
|
129393
|
-
const a = message?.message || message;
|
|
129394
|
-
level = String(a.level || a.category || 'log').toLowerCase();
|
|
129395
|
-
const arg = a.arguments && a.arguments[0] || a.message || a.text;
|
|
129396
|
-
text = String(arg && (arg.value || arg.text || arg.message || arg) || '');
|
|
129397
|
-
url = String(a.filename || a.sourceName || '');
|
|
129398
|
-
} else if ('pageError' === type || 'networkEventUpdate' === type) {
|
|
129399
|
-
level = 'pageError' === type ? 'error' : 'info';
|
|
129400
|
-
text = String(message?.errorMessage || message?.cause || '');
|
|
129401
|
-
url = String(message?.url || message?.sourceURL || '');
|
|
129402
|
-
} else {
|
|
129403
|
-
if ('tabNavigated' !== type) return;
|
|
129404
|
-
level = 'debug';
|
|
129405
|
-
text = String(message?.url || '');
|
|
129406
|
-
url = String(message?.url || '');
|
|
129407
|
-
}
|
|
129408
|
-
context = 'string' == typeof url && url.startsWith('moz-extension://') ? 'background' : 'page';
|
|
129409
|
-
const idx = Math.max(0, levelMap.indexOf(level));
|
|
129410
|
-
if (idx < wantIdx) return;
|
|
129411
|
-
if (wantContexts && wantContexts.length && !wantContexts.includes(context)) return;
|
|
129412
|
-
if (urlFilter && !String(url || '').includes(urlFilter)) return;
|
|
129413
|
-
const msgTab = String(message?.from || '');
|
|
129414
|
-
if (tabFilter && msgTab && !msgTab.includes(tabFilter)) return;
|
|
129415
|
-
const event = {
|
|
129416
|
-
id: `${Date.now()}-${Math.random().toString(16).slice(2)}`,
|
|
129417
|
-
timestamp: Date.now(),
|
|
129418
|
-
level,
|
|
129419
|
-
context,
|
|
129420
|
-
messageParts: [
|
|
129421
|
-
text
|
|
129422
|
-
],
|
|
129423
|
-
url,
|
|
129424
|
-
tabId
|
|
129425
|
-
};
|
|
129426
|
-
if ('json' === fmt || 'ndjson' === fmt) return void printLogEventJson(event);
|
|
129427
|
-
printLogEventPretty(event, color, colorFns, showTs);
|
|
129428
|
-
} catch {}
|
|
129429
|
-
});
|
|
129430
|
-
}
|
|
129547
|
+
var logging = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/logging.ts");
|
|
129431
129548
|
var source_inspect = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/source-inspect.ts");
|
|
129432
129549
|
function _define_property(obj, key, value) {
|
|
129433
129550
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -129493,6 +129610,9 @@ var __webpack_modules__ = {
|
|
|
129493
129610
|
let addonsActor = await getAddonsActorWithRetry(client, this.cachedAddonsActor);
|
|
129494
129611
|
if (addonsActor) this.cachedAddonsActor = addonsActor;
|
|
129495
129612
|
const candidateAddonPaths = computeCandidateAddonPaths(compilation, extensionsToLoad);
|
|
129613
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
129614
|
+
console.log('[plugin-browsers] Firefox add-on paths:', candidateAddonPaths);
|
|
129615
|
+
} catch {}
|
|
129496
129616
|
for (const [index, addonPath] of candidateAddonPaths.entries()){
|
|
129497
129617
|
const isManager = /extensions\/[a-z-]+-manager/.test(String(addonPath));
|
|
129498
129618
|
const isDevtoolsEnabled = 0 === index && Boolean(devtools);
|
|
@@ -129524,7 +129644,7 @@ var __webpack_modules__ = {
|
|
|
129524
129644
|
if (!this.derivedExtensionId) this.derivedExtensionId = await deriveMozExtensionId(client);
|
|
129525
129645
|
} catch {}
|
|
129526
129646
|
this.lastInstalledAddonPath = candidateAddonPaths[0];
|
|
129527
|
-
const bannerPrinted = await
|
|
129647
|
+
const bannerPrinted = await (0, firefox_utils.Rv)(candidateAddonPaths, 'firefox', this.derivedExtensionId, this.options.browserVersionLine);
|
|
129528
129648
|
if (!bannerPrinted) throw new Error(messages.WVu(this.options.browser, 'Failed to print runningInDevelopment banner; add-on may not be installed.'));
|
|
129529
129649
|
}
|
|
129530
129650
|
markNeedsReinstall() {
|
|
@@ -129582,6 +129702,7 @@ var __webpack_modules__ = {
|
|
|
129582
129702
|
const normalized = (changedAssets || []).map((n)=>String(n || '')).map((n)=>n.replace(/\\/g, '/'));
|
|
129583
129703
|
const isManifestChanged = normalized.includes('manifest.json');
|
|
129584
129704
|
const isLocalesChanged = normalized.some((n)=>/(^|\/)__?locales\/.+\.json$/i.test(n));
|
|
129705
|
+
const isContentScriptChanged = normalized.some((n)=>/(^|\/)content_scripts\/content-\d+\.(js|css)$/i.test(n));
|
|
129585
129706
|
let isServiceWorkerChanged = false;
|
|
129586
129707
|
try {
|
|
129587
129708
|
const manifestAsset = compilation.getAsset?.('manifest.json');
|
|
@@ -129595,7 +129716,7 @@ var __webpack_modules__ = {
|
|
|
129595
129716
|
}
|
|
129596
129717
|
}
|
|
129597
129718
|
} catch {}
|
|
129598
|
-
const critical = isManifestChanged || isLocalesChanged || isServiceWorkerChanged;
|
|
129719
|
+
const critical = isManifestChanged || isLocalesChanged || isServiceWorkerChanged || isContentScriptChanged;
|
|
129599
129720
|
if (!critical) return;
|
|
129600
129721
|
await this.reloadAddonOrReinstall(client);
|
|
129601
129722
|
} catch {}
|
|
@@ -129609,7 +129730,7 @@ var __webpack_modules__ = {
|
|
|
129609
129730
|
if (!tab) return;
|
|
129610
129731
|
if (urlToInspect) await (0, source_inspect.VJ)(client, tab.actor, tab.consoleActor, urlToInspect);
|
|
129611
129732
|
const html = await (0, source_inspect.Lj)(client, tab.actor, tab.consoleActor) || '';
|
|
129612
|
-
|
|
129733
|
+
(0, firefox_utils.z0)(html);
|
|
129613
129734
|
} catch (error) {
|
|
129614
129735
|
const err = error;
|
|
129615
129736
|
console.warn(messages.eO_(err?.message || String(err)));
|
|
@@ -129620,7 +129741,7 @@ var __webpack_modules__ = {
|
|
|
129620
129741
|
if (this.loggingAttached) return;
|
|
129621
129742
|
const rdpPort = this.resolveRdpPort();
|
|
129622
129743
|
const client = this.client || await this.connectClient(rdpPort);
|
|
129623
|
-
await
|
|
129744
|
+
await (0, logging.c)(client);
|
|
129624
129745
|
const wantLevel = String(opts.level || 'info').toLowerCase();
|
|
129625
129746
|
const wantContexts = Array.isArray(opts.contexts) ? opts.contexts.map((s)=>String(s)) : void 0;
|
|
129626
129747
|
const urlFilter = String(opts.urlFilter || '');
|
|
@@ -129628,7 +129749,7 @@ var __webpack_modules__ = {
|
|
|
129628
129749
|
const fmt = opts.format || 'pretty';
|
|
129629
129750
|
const showTs = false !== opts.timestamps;
|
|
129630
129751
|
const color = !!opts.color;
|
|
129631
|
-
|
|
129752
|
+
(0, logging.g)(client, {
|
|
129632
129753
|
level: wantLevel,
|
|
129633
129754
|
contexts: wantContexts,
|
|
129634
129755
|
urlFilter,
|
|
@@ -129708,6 +129829,10 @@ var __webpack_modules__ = {
|
|
|
129708
129829
|
return await fn();
|
|
129709
129830
|
} catch (error) {
|
|
129710
129831
|
lastError = error;
|
|
129832
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
129833
|
+
const msg = error?.message || String(error);
|
|
129834
|
+
console.warn(`[plugin-browsers] Firefox RDP setup retry ${i + 1}/${attempts}: ${msg}`);
|
|
129835
|
+
} catch {}
|
|
129711
129836
|
const ms = baseMs * Math.pow(2, i);
|
|
129712
129837
|
await new Promise((r)=>setTimeout(r, ms));
|
|
129713
129838
|
}
|
|
@@ -129877,9 +130002,9 @@ var __webpack_modules__ = {
|
|
|
129877
130002
|
external_fs_.writeFileSync(userJsPath, userJsContent);
|
|
129878
130003
|
} catch {}
|
|
129879
130004
|
const parts = [
|
|
129880
|
-
`--binary-args="${binaryArgs.join(' ')}"`,
|
|
129881
130005
|
'--verbose'
|
|
129882
130006
|
];
|
|
130007
|
+
if (binaryArgs.length > 0) parts.unshift(`--binary-args="${binaryArgs.join(' ')}"`);
|
|
129883
130008
|
if (profilePath) parts.splice(1, 0, `--profile="${profilePath}"`);
|
|
129884
130009
|
return parts.join(' ');
|
|
129885
130010
|
}
|
|
@@ -130143,7 +130268,8 @@ var __webpack_modules__ = {
|
|
|
130143
130268
|
const firefoxArgs = [];
|
|
130144
130269
|
const binaryArgsMatch = firefoxCfg.match(/--binary-args="([^"]*)"/);
|
|
130145
130270
|
if (binaryArgsMatch) {
|
|
130146
|
-
|
|
130271
|
+
const rawArgs = String(binaryArgsMatch[1] || '').trim();
|
|
130272
|
+
if (rawArgs) firefoxArgs.push(...rawArgs.split(' ').filter((arg)=>arg.trim().length > 0));
|
|
130147
130273
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.info?.(messages.ivb(binaryArgsMatch[1]));
|
|
130148
130274
|
} else if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.info?.(messages.dNY());
|
|
130149
130275
|
const profileMatch = firefoxCfg.match(/--profile="([^"]*)"/);
|
|
@@ -130151,7 +130277,15 @@ var __webpack_modules__ = {
|
|
|
130151
130277
|
const profilePath = profileMatch[1];
|
|
130152
130278
|
const { binary, args } = FirefoxBinaryDetector.generateFirefoxArgs(binaryPath, profilePath, debugPort, firefoxArgs);
|
|
130153
130279
|
const isWin = 'win32' === process.platform;
|
|
130154
|
-
const stdio = isWin ? '
|
|
130280
|
+
const stdio = isWin ? 'true' === process.env.EXTENSION_AUTHOR_MODE ? [
|
|
130281
|
+
'pipe',
|
|
130282
|
+
'pipe',
|
|
130283
|
+
'pipe'
|
|
130284
|
+
] : [
|
|
130285
|
+
'ignore',
|
|
130286
|
+
'ignore',
|
|
130287
|
+
'ignore'
|
|
130288
|
+
] : [
|
|
130155
130289
|
'pipe',
|
|
130156
130290
|
'pipe',
|
|
130157
130291
|
'pipe'
|
|
@@ -130170,13 +130304,15 @@ var __webpack_modules__ = {
|
|
|
130170
130304
|
}, compilation, debugPort);
|
|
130171
130305
|
this.host.rdpController = ctrl;
|
|
130172
130306
|
this.ctx.setController(ctrl, debugPort);
|
|
130307
|
+
this.scheduleWatchTimeout();
|
|
130173
130308
|
try {
|
|
130174
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE
|
|
130309
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
130175
130310
|
this.ctx.logger?.info?.(messages.pdv(debugPort, desiredDebugPort));
|
|
130176
|
-
this.ctx.logger?.info?.(messages.dwQ(
|
|
130311
|
+
this.ctx.logger?.info?.(messages.dwQ(profilePath));
|
|
130177
130312
|
}
|
|
130178
130313
|
} catch {}
|
|
130179
130314
|
} else {
|
|
130315
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.warn?.('[plugin-browsers] Firefox profile not set; skipping RDP add-on install.');
|
|
130180
130316
|
const args = [
|
|
130181
130317
|
...debugPort > 0 ? [
|
|
130182
130318
|
'-start-debugger-server',
|
|
@@ -130189,7 +130325,15 @@ var __webpack_modules__ = {
|
|
|
130189
130325
|
...firefoxArgs
|
|
130190
130326
|
];
|
|
130191
130327
|
const isWin = 'win32' === process.platform;
|
|
130192
|
-
const stdio = isWin ? '
|
|
130328
|
+
const stdio = isWin ? 'true' === process.env.EXTENSION_AUTHOR_MODE ? [
|
|
130329
|
+
'pipe',
|
|
130330
|
+
'pipe',
|
|
130331
|
+
'pipe'
|
|
130332
|
+
] : [
|
|
130333
|
+
'ignore',
|
|
130334
|
+
'ignore',
|
|
130335
|
+
'ignore'
|
|
130336
|
+
] : [
|
|
130193
130337
|
'pipe',
|
|
130194
130338
|
'pipe',
|
|
130195
130339
|
'pipe'
|
|
@@ -130202,6 +130346,7 @@ var __webpack_modules__ = {
|
|
|
130202
130346
|
logger: this.ctx.logger
|
|
130203
130347
|
});
|
|
130204
130348
|
this.wireChildLifecycle(compilation, debugPort, desiredDebugPort);
|
|
130349
|
+
this.scheduleWatchTimeout();
|
|
130205
130350
|
}
|
|
130206
130351
|
}
|
|
130207
130352
|
wireChildLifecycle(compilation, debugPort, desiredDebugPort) {
|
|
@@ -130213,6 +130358,10 @@ var __webpack_modules__ = {
|
|
|
130213
130358
|
process.exit(1);
|
|
130214
130359
|
});
|
|
130215
130360
|
child.on('close', (_code)=>{
|
|
130361
|
+
if (this.watchTimeout) {
|
|
130362
|
+
clearTimeout(this.watchTimeout);
|
|
130363
|
+
this.watchTimeout = void 0;
|
|
130364
|
+
}
|
|
130216
130365
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) this.ctx.logger?.info?.(messages.Tho(this.host.browser));
|
|
130217
130366
|
this.cleanupInstance().finally(()=>{
|
|
130218
130367
|
process.exit();
|
|
@@ -130238,6 +130387,22 @@ var __webpack_modules__ = {
|
|
|
130238
130387
|
}
|
|
130239
130388
|
} catch {}
|
|
130240
130389
|
}
|
|
130390
|
+
scheduleWatchTimeout() {
|
|
130391
|
+
if (this.watchTimeout) return;
|
|
130392
|
+
if (process.env.VITEST || process.env.VITEST_WORKER_ID) return;
|
|
130393
|
+
const raw = process.env.EXTENSION_WATCH_TIMEOUT_MS || process.env.EXTENSION_DEV_WATCH_TIMEOUT_MS || process.env.EXTJS_WATCH_TIMEOUT_MS || process.env.EXTJS_DEV_WATCH_TIMEOUT_MS || '';
|
|
130394
|
+
const ms = parseInt(String(raw || ''), 10);
|
|
130395
|
+
if (!Number.isFinite(ms) || ms <= 0) return;
|
|
130396
|
+
this.watchTimeout = setTimeout(()=>{
|
|
130397
|
+
try {
|
|
130398
|
+
this.ctx.logger?.info?.(`[plugin-browsers] Watch timeout reached (${ms}ms). Shutting down.`);
|
|
130399
|
+
} catch {}
|
|
130400
|
+
this.cleanupInstance().catch(()=>{}).finally(()=>{
|
|
130401
|
+
process.exit(0);
|
|
130402
|
+
});
|
|
130403
|
+
}, ms);
|
|
130404
|
+
if ('function' == typeof this.watchTimeout.unref) this.watchTimeout.unref();
|
|
130405
|
+
}
|
|
130241
130406
|
printInstallHint(compilation, raw) {
|
|
130242
130407
|
try {
|
|
130243
130408
|
const displayCacheDir = (0, output_binaries_resolver.LB)(compilation);
|
|
@@ -130251,11 +130416,201 @@ var __webpack_modules__ = {
|
|
|
130251
130416
|
firefox_launch_define_property(this, "host", void 0);
|
|
130252
130417
|
firefox_launch_define_property(this, "ctx", void 0);
|
|
130253
130418
|
firefox_launch_define_property(this, "child", null);
|
|
130419
|
+
firefox_launch_define_property(this, "watchTimeout", void 0);
|
|
130254
130420
|
this.host = host;
|
|
130255
130421
|
this.ctx = ctx;
|
|
130256
130422
|
}
|
|
130257
130423
|
}
|
|
130258
130424
|
},
|
|
130425
|
+
"./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/firefox-utils.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
130426
|
+
"use strict";
|
|
130427
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
130428
|
+
Rv: ()=>printRunningInDevelopmentSummary,
|
|
130429
|
+
ek: ()=>printLogEventJson,
|
|
130430
|
+
mN: ()=>printLogEventPretty,
|
|
130431
|
+
z0: ()=>printSourceInspection
|
|
130432
|
+
});
|
|
130433
|
+
var path__rspack_import_0 = __webpack_require__("path");
|
|
130434
|
+
var fs__rspack_import_1 = __webpack_require__("fs");
|
|
130435
|
+
var _browsers_lib_messages__rspack_import_2 = __webpack_require__("./webpack/plugin-browsers/browsers-lib/messages.ts");
|
|
130436
|
+
var _browsers_lib_banner__rspack_import_3 = __webpack_require__("./webpack/plugin-browsers/browsers-lib/banner.ts");
|
|
130437
|
+
async function waitForManifest(outPath, timeoutMs = 8000) {
|
|
130438
|
+
const manifestPath = path__rspack_import_0.join(outPath, 'manifest.json');
|
|
130439
|
+
const start = Date.now();
|
|
130440
|
+
while(Date.now() - start < timeoutMs){
|
|
130441
|
+
try {
|
|
130442
|
+
if (fs__rspack_import_1.existsSync(manifestPath)) return true;
|
|
130443
|
+
} catch {}
|
|
130444
|
+
await new Promise((resolve)=>setTimeout(resolve, 150));
|
|
130445
|
+
}
|
|
130446
|
+
return false;
|
|
130447
|
+
}
|
|
130448
|
+
async function printRunningInDevelopmentSummary(candidateAddonPaths, browser, extensionId, browserVersionLine) {
|
|
130449
|
+
try {
|
|
130450
|
+
let chosenPath = null;
|
|
130451
|
+
for (const p of candidateAddonPaths){
|
|
130452
|
+
const isManager = /extensions\/[a-z-]+-manager/.test(String(p));
|
|
130453
|
+
const isDevtools = /extension-js-devtools/.test(String(p));
|
|
130454
|
+
const isThemePath = /extension-js-theme/.test(String(p));
|
|
130455
|
+
if (isManager || isDevtools || isThemePath) continue;
|
|
130456
|
+
const mp = path__rspack_import_0.join(p, 'manifest.json');
|
|
130457
|
+
if (fs__rspack_import_1.existsSync(mp)) {
|
|
130458
|
+
const mf = JSON.parse(fs__rspack_import_1.readFileSync(mp, 'utf-8'));
|
|
130459
|
+
const name = mf?.name || '';
|
|
130460
|
+
const isThemeManifest = mf?.theme != null || 'theme' === String(mf?.type || '');
|
|
130461
|
+
if ('string' == typeof name && !/Extension\.js DevTools/i.test(name) && !/theme/i.test(name) && !isThemeManifest) {
|
|
130462
|
+
chosenPath = p;
|
|
130463
|
+
break;
|
|
130464
|
+
}
|
|
130465
|
+
}
|
|
130466
|
+
}
|
|
130467
|
+
if (!chosenPath && candidateAddonPaths.length > 0) chosenPath = candidateAddonPaths[candidateAddonPaths.length - 1];
|
|
130468
|
+
if (!chosenPath) return false;
|
|
130469
|
+
const manifestPath = path__rspack_import_0.join(chosenPath, 'manifest.json');
|
|
130470
|
+
if (!fs__rspack_import_1.existsSync(manifestPath)) {
|
|
130471
|
+
const ready = await waitForManifest(chosenPath, 10000);
|
|
130472
|
+
if (!ready) return false;
|
|
130473
|
+
}
|
|
130474
|
+
const manifest = JSON.parse(fs__rspack_import_1.readFileSync(manifestPath, 'utf-8'));
|
|
130475
|
+
const printed = await (0, _browsers_lib_banner__rspack_import_3.a)({
|
|
130476
|
+
browser,
|
|
130477
|
+
outPath: chosenPath,
|
|
130478
|
+
hostPort: {
|
|
130479
|
+
host: '127.0.0.1'
|
|
130480
|
+
},
|
|
130481
|
+
getInfo: async ()=>({
|
|
130482
|
+
extensionId: extensionId || '(temporary)',
|
|
130483
|
+
name: manifest.name,
|
|
130484
|
+
version: manifest.version
|
|
130485
|
+
}),
|
|
130486
|
+
browserVersionLine
|
|
130487
|
+
});
|
|
130488
|
+
return printed;
|
|
130489
|
+
} catch {
|
|
130490
|
+
return false;
|
|
130491
|
+
}
|
|
130492
|
+
}
|
|
130493
|
+
function printSourceInspection(html) {
|
|
130494
|
+
console.log(_browsers_lib_messages__rspack_import_2.sew());
|
|
130495
|
+
console.log(_browsers_lib_messages__rspack_import_2.sew());
|
|
130496
|
+
console.log(html);
|
|
130497
|
+
console.log(_browsers_lib_messages__rspack_import_2.sew());
|
|
130498
|
+
}
|
|
130499
|
+
function printLogEventPretty(event, color, colorFns, showTs) {
|
|
130500
|
+
const ts = showTs ? new Date(event.timestamp).toISOString() + ' ' : '';
|
|
130501
|
+
const level = event.level;
|
|
130502
|
+
const context = event.context;
|
|
130503
|
+
const text = event.messageParts[0];
|
|
130504
|
+
const url = event.url;
|
|
130505
|
+
const arrow = 'error' === level ? color ? colorFns.red('►►►') : '►►►' : 'warn' === level ? color ? colorFns.yellow('►►►') : '►►►' : 'log' === level ? color ? colorFns.gray('►►►') : '►►►' : color ? colorFns.blue('►►►') : '►►►';
|
|
130506
|
+
const where = url ? ` ${url}` : '';
|
|
130507
|
+
console.log(`${arrow} ${ts}${context}${where} - ${text}`);
|
|
130508
|
+
}
|
|
130509
|
+
function printLogEventJson(event) {
|
|
130510
|
+
console.log(JSON.stringify(event));
|
|
130511
|
+
}
|
|
130512
|
+
},
|
|
130513
|
+
"./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/logging.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
130514
|
+
"use strict";
|
|
130515
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
130516
|
+
c: ()=>attachConsoleListeners,
|
|
130517
|
+
g: ()=>subscribeUnifiedLogging
|
|
130518
|
+
});
|
|
130519
|
+
var pintor__rspack_import_0 = __webpack_require__("pintor");
|
|
130520
|
+
var pintor__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_0);
|
|
130521
|
+
var _firefox_utils__rspack_import_1 = __webpack_require__("./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/firefox-utils.ts");
|
|
130522
|
+
async function attachConsoleListeners(client) {
|
|
130523
|
+
try {
|
|
130524
|
+
const targets = await client.getTargets();
|
|
130525
|
+
for (const t of targets || [])try {
|
|
130526
|
+
const resolved = await client.getTargetFromDescriptor(String(t.actor || ''));
|
|
130527
|
+
const consoleActor = resolved?.consoleActor || t.consoleActor || t.webConsoleActor;
|
|
130528
|
+
if (consoleActor) try {
|
|
130529
|
+
await client.request({
|
|
130530
|
+
to: consoleActor,
|
|
130531
|
+
type: 'startListeners',
|
|
130532
|
+
listeners: [
|
|
130533
|
+
'ConsoleAPI',
|
|
130534
|
+
'PageError',
|
|
130535
|
+
'NetworkActivity'
|
|
130536
|
+
]
|
|
130537
|
+
});
|
|
130538
|
+
} catch {}
|
|
130539
|
+
} catch {}
|
|
130540
|
+
} catch {}
|
|
130541
|
+
}
|
|
130542
|
+
function subscribeUnifiedLogging(client, opts) {
|
|
130543
|
+
const levelMap = [
|
|
130544
|
+
'trace',
|
|
130545
|
+
'debug',
|
|
130546
|
+
'log',
|
|
130547
|
+
'info',
|
|
130548
|
+
'warn',
|
|
130549
|
+
'error'
|
|
130550
|
+
];
|
|
130551
|
+
const wantLevel = String(opts.level || 'info').toLowerCase();
|
|
130552
|
+
const wantIdx = Math.max(0, levelMap.indexOf(wantLevel));
|
|
130553
|
+
const wantContexts = Array.isArray(opts.contexts) ? opts.contexts.map((s)=>String(s)) : void 0;
|
|
130554
|
+
const urlFilter = String(opts.urlFilter || '');
|
|
130555
|
+
const tabFilter = opts.tabFilter || '';
|
|
130556
|
+
const fmt = opts.format || 'pretty';
|
|
130557
|
+
const showTs = false !== opts.timestamps;
|
|
130558
|
+
const color = !!opts.color;
|
|
130559
|
+
const colorFns = {
|
|
130560
|
+
red: (s)=>pintor__rspack_import_0_default().red ? pintor__rspack_import_0_default().red(s) : s,
|
|
130561
|
+
yellow: (s)=>pintor__rspack_import_0_default().brightYellow ? pintor__rspack_import_0_default().brightYellow(s) : s,
|
|
130562
|
+
gray: (s)=>pintor__rspack_import_0_default().gray ? pintor__rspack_import_0_default().gray(s) : s,
|
|
130563
|
+
blue: (s)=>pintor__rspack_import_0_default().blue ? pintor__rspack_import_0_default().blue(s) : s
|
|
130564
|
+
};
|
|
130565
|
+
client.on('message', (message)=>{
|
|
130566
|
+
try {
|
|
130567
|
+
const type = String(message?.type || '');
|
|
130568
|
+
if (!type) return;
|
|
130569
|
+
let level = 'info';
|
|
130570
|
+
let text = '';
|
|
130571
|
+
let url = '';
|
|
130572
|
+
let context = 'page';
|
|
130573
|
+
let tabId;
|
|
130574
|
+
if ('consoleAPICall' === type || 'logMessage' === type) {
|
|
130575
|
+
const a = message?.message || message;
|
|
130576
|
+
level = String(a.level || a.category || 'log').toLowerCase();
|
|
130577
|
+
const arg = a.arguments && a.arguments[0] || a.message || a.text;
|
|
130578
|
+
text = String(arg && (arg.value || arg.text || arg.message || arg) || '');
|
|
130579
|
+
url = String(a.filename || a.sourceName || '');
|
|
130580
|
+
} else if ('pageError' === type || 'networkEventUpdate' === type) {
|
|
130581
|
+
level = 'pageError' === type ? 'error' : 'info';
|
|
130582
|
+
text = String(message?.errorMessage || message?.cause || '');
|
|
130583
|
+
url = String(message?.url || message?.sourceURL || '');
|
|
130584
|
+
} else {
|
|
130585
|
+
if ('tabNavigated' !== type) return;
|
|
130586
|
+
level = 'debug';
|
|
130587
|
+
text = String(message?.url || '');
|
|
130588
|
+
url = String(message?.url || '');
|
|
130589
|
+
}
|
|
130590
|
+
context = 'string' == typeof url && url.startsWith('moz-extension://') ? 'background' : 'page';
|
|
130591
|
+
const idx = Math.max(0, levelMap.indexOf(level));
|
|
130592
|
+
if (idx < wantIdx) return;
|
|
130593
|
+
if (wantContexts && wantContexts.length && !wantContexts.includes(context)) return;
|
|
130594
|
+
if (urlFilter && !String(url || '').includes(urlFilter)) return;
|
|
130595
|
+
const msgTab = String(message?.from || '');
|
|
130596
|
+
if (tabFilter && msgTab && !msgTab.includes(tabFilter)) return;
|
|
130597
|
+
const event = {
|
|
130598
|
+
id: `${Date.now()}-${Math.random().toString(16).slice(2)}`,
|
|
130599
|
+
timestamp: Date.now(),
|
|
130600
|
+
level,
|
|
130601
|
+
context,
|
|
130602
|
+
messageParts: [
|
|
130603
|
+
text
|
|
130604
|
+
],
|
|
130605
|
+
url,
|
|
130606
|
+
tabId
|
|
130607
|
+
};
|
|
130608
|
+
if ('json' === fmt || 'ndjson' === fmt) return void (0, _firefox_utils__rspack_import_1.ek)(event);
|
|
130609
|
+
(0, _firefox_utils__rspack_import_1.mN)(event, color, colorFns, showTs);
|
|
130610
|
+
} catch {}
|
|
130611
|
+
});
|
|
130612
|
+
}
|
|
130613
|
+
},
|
|
130259
130614
|
"./webpack/plugin-browsers/run-firefox/firefox-source-inspection/remote-firefox/messaging-client.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
130260
130615
|
"use strict";
|
|
130261
130616
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -130660,6 +131015,13 @@ var __webpack_modules__ = {
|
|
|
130660
131015
|
class MessagingClient extends external_events_default() {
|
|
130661
131016
|
async connect(port) {
|
|
130662
131017
|
await this.transport.connect(port);
|
|
131018
|
+
if (!this.forwardingSetup) {
|
|
131019
|
+
this.forwardingSetup = true;
|
|
131020
|
+
this.transport.on('message', (message)=>this.emit('message', message));
|
|
131021
|
+
this.transport.on('error', (error)=>this.emit('error', error));
|
|
131022
|
+
this.transport.on('end', ()=>this.emit('end'));
|
|
131023
|
+
this.transport.on('timeout', ()=>this.emit('timeout'));
|
|
131024
|
+
}
|
|
130663
131025
|
}
|
|
130664
131026
|
disconnect() {
|
|
130665
131027
|
this.transport.disconnect();
|
|
@@ -130779,7 +131141,7 @@ var __webpack_modules__ = {
|
|
|
130779
131141
|
});
|
|
130780
131142
|
}
|
|
130781
131143
|
constructor(...args){
|
|
130782
|
-
super(...args), messaging_client_define_property(this, "transport", new RdpTransport());
|
|
131144
|
+
super(...args), messaging_client_define_property(this, "transport", new RdpTransport()), messaging_client_define_property(this, "forwardingSetup", false);
|
|
130783
131145
|
}
|
|
130784
131146
|
}
|
|
130785
131147
|
},
|
|
@@ -131251,13 +131613,18 @@ var __webpack_modules__ = {
|
|
|
131251
131613
|
const s = text && 0xfeff === text.charCodeAt(0) ? text.slice(1) : text;
|
|
131252
131614
|
return JSON.parse(s || '{}');
|
|
131253
131615
|
}
|
|
131254
|
-
function isContentScriptEntry(absolutePath, manifestPath) {
|
|
131255
|
-
if (!absolutePath || !manifestPath) return false;
|
|
131616
|
+
function isContentScriptEntry(absolutePath, manifestPath, projectPath) {
|
|
131617
|
+
if (!absolutePath || !manifestPath || !projectPath) return false;
|
|
131256
131618
|
if (!fs__rspack_import_1.existsSync(manifestPath)) return false;
|
|
131257
131619
|
const manifest = parseJsonSafe(fs__rspack_import_1.readFileSync(manifestPath, 'utf8'));
|
|
131620
|
+
const scriptsDir = path__rspack_import_0.resolve(projectPath, "scripts");
|
|
131621
|
+
const absPathNormalized = path__rspack_import_0.resolve(absolutePath);
|
|
131622
|
+
const relToScripts = path__rspack_import_0.relative(scriptsDir, absPathNormalized);
|
|
131623
|
+
const isScriptsFolderScript = relToScripts && !relToScripts.startsWith('..') && !path__rspack_import_0.isAbsolute(relToScripts);
|
|
131624
|
+
if (isScriptsFolderScript) return true;
|
|
131258
131625
|
for (const content of manifest.content_scripts || [])if (content.js?.length) for (const js of content.js){
|
|
131259
131626
|
const contentPath = path__rspack_import_0.resolve(path__rspack_import_0.dirname(manifestPath), js);
|
|
131260
|
-
if (contentPath ===
|
|
131627
|
+
if (contentPath === absPathNormalized) return true;
|
|
131261
131628
|
}
|
|
131262
131629
|
return false;
|
|
131263
131630
|
}
|
|
@@ -131418,43 +131785,170 @@ var __webpack_modules__ = {
|
|
|
131418
131785
|
generator: {
|
|
131419
131786
|
filename: "content_scripts/[name].[contenthash:8].css"
|
|
131420
131787
|
},
|
|
131421
|
-
issuer: (issuer)=>(0, _css_lib_is_content_script__rspack_import_4.z)(issuer, resolvedManifestPath)
|
|
131788
|
+
issuer: (issuer)=>(0, _css_lib_is_content_script__rspack_import_4.z)(issuer, resolvedManifestPath, projectPath)
|
|
131789
|
+
}
|
|
131790
|
+
];
|
|
131791
|
+
}
|
|
131792
|
+
},
|
|
131793
|
+
"./webpack/plugin-css/css-tools/postcss.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
131794
|
+
"use strict";
|
|
131795
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
131796
|
+
A: ()=>isUsingPostCss,
|
|
131797
|
+
t: ()=>maybeUsePostCss
|
|
131798
|
+
});
|
|
131799
|
+
var path__rspack_import_0 = __webpack_require__("path");
|
|
131800
|
+
var fs__rspack_import_1 = __webpack_require__("fs");
|
|
131801
|
+
var module__rspack_import_2 = __webpack_require__("module");
|
|
131802
|
+
var pintor__rspack_import_3 = __webpack_require__("pintor");
|
|
131803
|
+
var pintor__rspack_import_3_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_3);
|
|
131804
|
+
var _css_lib_messages__rspack_import_4 = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
|
|
131805
|
+
var _css_lib_integrations__rspack_import_5 = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
|
|
131806
|
+
var _tailwind__rspack_import_6 = __webpack_require__("./webpack/plugin-css/css-tools/tailwind.ts");
|
|
131807
|
+
var _sass__rspack_import_7 = __webpack_require__("./webpack/plugin-css/css-tools/sass.ts");
|
|
131808
|
+
var _less__rspack_import_8 = __webpack_require__("./webpack/plugin-css/css-tools/less.ts");
|
|
131809
|
+
let userMessageDelivered = false;
|
|
131810
|
+
const postCssConfigFiles = [
|
|
131811
|
+
'.postcssrc',
|
|
131812
|
+
'.postcssrc.json',
|
|
131813
|
+
'.postcssrc.yaml',
|
|
131814
|
+
'.postcssrc.yml',
|
|
131815
|
+
'postcss.config.mjs',
|
|
131816
|
+
'.postcssrc.js',
|
|
131817
|
+
'.postcssrc.cjs',
|
|
131818
|
+
'postcss.config.js',
|
|
131819
|
+
'postcss.config.cjs'
|
|
131820
|
+
];
|
|
131821
|
+
function findPostCssConfig(projectPath) {
|
|
131822
|
+
const ordered = isTypeModuleProject(projectPath) ? [
|
|
131823
|
+
'.postcssrc',
|
|
131824
|
+
'.postcssrc.json',
|
|
131825
|
+
'.postcssrc.yaml',
|
|
131826
|
+
'.postcssrc.yml',
|
|
131827
|
+
'postcss.config.mjs',
|
|
131828
|
+
'.postcssrc.cjs',
|
|
131829
|
+
'postcss.config.cjs',
|
|
131830
|
+
'.postcssrc.js',
|
|
131831
|
+
'postcss.config.js'
|
|
131832
|
+
] : postCssConfigFiles;
|
|
131833
|
+
for (const configFile of ordered){
|
|
131834
|
+
const configPath = path__rspack_import_0.join(projectPath, configFile);
|
|
131835
|
+
if (fs__rspack_import_1.existsSync(configPath)) return configPath;
|
|
131836
|
+
}
|
|
131837
|
+
}
|
|
131838
|
+
function isTypeModuleProject(projectPath) {
|
|
131839
|
+
try {
|
|
131840
|
+
const raw = fs__rspack_import_1.readFileSync(path__rspack_import_0.join(projectPath, 'package.json'), 'utf8');
|
|
131841
|
+
const pkg = JSON.parse(raw || '{}');
|
|
131842
|
+
return pkg?.type === 'module';
|
|
131843
|
+
} catch {
|
|
131844
|
+
return false;
|
|
131845
|
+
}
|
|
131846
|
+
}
|
|
131847
|
+
function isLikelyCjsConfigInEsmProject(projectPath, postCssConfigPath) {
|
|
131848
|
+
if (!postCssConfigPath || !postCssConfigPath.endsWith('postcss.config.js')) return false;
|
|
131849
|
+
if (!isTypeModuleProject(projectPath)) return false;
|
|
131850
|
+
try {
|
|
131851
|
+
const text = fs__rspack_import_1.readFileSync(postCssConfigPath, 'utf8');
|
|
131852
|
+
return /module\.exports|require\(/.test(text);
|
|
131853
|
+
} catch {
|
|
131854
|
+
return false;
|
|
131855
|
+
}
|
|
131856
|
+
}
|
|
131857
|
+
function isLikelyCjsTailwindConfig(tailwindConfigPath) {
|
|
131858
|
+
if (!tailwindConfigPath) return false;
|
|
131859
|
+
if (!tailwindConfigPath.endsWith('.js') && !tailwindConfigPath.endsWith('.cjs')) return false;
|
|
131860
|
+
try {
|
|
131861
|
+
const text = fs__rspack_import_1.readFileSync(tailwindConfigPath, 'utf8');
|
|
131862
|
+
return /module\.exports|require\(/.test(text);
|
|
131863
|
+
} catch {
|
|
131864
|
+
return false;
|
|
131865
|
+
}
|
|
131866
|
+
}
|
|
131867
|
+
function userConfigMentionsTailwindPlugin(postCssConfigPath) {
|
|
131868
|
+
if (!postCssConfigPath) return false;
|
|
131869
|
+
try {
|
|
131870
|
+
const text = fs__rspack_import_1.readFileSync(postCssConfigPath, 'utf8');
|
|
131871
|
+
return /@tailwindcss\/postcss|tailwindcss/.test(text);
|
|
131872
|
+
} catch {
|
|
131873
|
+
return false;
|
|
131874
|
+
}
|
|
131875
|
+
}
|
|
131876
|
+
function userConfigUsesDirectTailwindPluginReference(postCssConfigPath) {
|
|
131877
|
+
if (!postCssConfigPath) return false;
|
|
131878
|
+
try {
|
|
131879
|
+
const text = fs__rspack_import_1.readFileSync(postCssConfigPath, 'utf8');
|
|
131880
|
+
return /require\(\s*['"]tailwindcss['"]\s*\)/.test(text) || /plugins\s*:\s*\[[^\]]*\btailwindcss\b/.test(text);
|
|
131881
|
+
} catch {
|
|
131882
|
+
return false;
|
|
131883
|
+
}
|
|
131884
|
+
}
|
|
131885
|
+
function tailwindStringPluginDisableShims() {
|
|
131886
|
+
return [
|
|
131887
|
+
{
|
|
131888
|
+
'@tailwindcss/postcss': false
|
|
131889
|
+
},
|
|
131890
|
+
{
|
|
131891
|
+
tailwindcss: false
|
|
131422
131892
|
}
|
|
131423
131893
|
];
|
|
131424
131894
|
}
|
|
131425
|
-
|
|
131426
|
-
|
|
131427
|
-
|
|
131428
|
-
|
|
131429
|
-
|
|
131430
|
-
|
|
131431
|
-
|
|
131432
|
-
|
|
131433
|
-
|
|
131434
|
-
|
|
131435
|
-
|
|
131436
|
-
|
|
131437
|
-
|
|
131438
|
-
|
|
131439
|
-
|
|
131440
|
-
|
|
131441
|
-
|
|
131442
|
-
|
|
131443
|
-
|
|
131444
|
-
|
|
131445
|
-
|
|
131446
|
-
|
|
131447
|
-
|
|
131448
|
-
|
|
131449
|
-
|
|
131450
|
-
|
|
131451
|
-
|
|
131452
|
-
|
|
131453
|
-
|
|
131454
|
-
|
|
131455
|
-
|
|
131456
|
-
|
|
131457
|
-
|
|
131895
|
+
function tryLoadCjsConfig(configPath) {
|
|
131896
|
+
try {
|
|
131897
|
+
const source = fs__rspack_import_1.readFileSync(configPath, 'utf8');
|
|
131898
|
+
const moduleObj = {
|
|
131899
|
+
exports: {}
|
|
131900
|
+
};
|
|
131901
|
+
const exportsObj = moduleObj.exports;
|
|
131902
|
+
const req = (0, module__rspack_import_2.createRequire)(configPath);
|
|
131903
|
+
const fn = new Function('require', 'module', 'exports', '__filename', '__dirname', source);
|
|
131904
|
+
fn(req, moduleObj, exportsObj, configPath, path__rspack_import_0.dirname(configPath));
|
|
131905
|
+
return moduleObj.exports;
|
|
131906
|
+
} catch {
|
|
131907
|
+
return;
|
|
131908
|
+
}
|
|
131909
|
+
}
|
|
131910
|
+
function normalizeTailwindContentGlobs(config, projectPath) {
|
|
131911
|
+
if (!config || 'object' != typeof config) return config;
|
|
131912
|
+
const normalizeEntry = (entry)=>{
|
|
131913
|
+
if ('string' != typeof entry) return entry;
|
|
131914
|
+
if (entry.startsWith('!')) {
|
|
131915
|
+
const raw = entry.slice(1);
|
|
131916
|
+
if (path__rspack_import_0.isAbsolute(raw)) return entry;
|
|
131917
|
+
return `!${path__rspack_import_0.join(projectPath, raw)}`;
|
|
131918
|
+
}
|
|
131919
|
+
return path__rspack_import_0.isAbsolute(entry) ? entry : path__rspack_import_0.join(projectPath, entry);
|
|
131920
|
+
};
|
|
131921
|
+
const out = {
|
|
131922
|
+
...config
|
|
131923
|
+
};
|
|
131924
|
+
const content = out.content;
|
|
131925
|
+
if ('string' == typeof content) {
|
|
131926
|
+
out.content = [
|
|
131927
|
+
normalizeEntry(content)
|
|
131928
|
+
];
|
|
131929
|
+
return out;
|
|
131930
|
+
}
|
|
131931
|
+
if (Array.isArray(content)) {
|
|
131932
|
+
out.content = content.map(normalizeEntry);
|
|
131933
|
+
return out;
|
|
131934
|
+
}
|
|
131935
|
+
if (content && 'object' == typeof content && Array.isArray(content.files)) out.content = {
|
|
131936
|
+
...content,
|
|
131937
|
+
files: content.files.map(normalizeEntry)
|
|
131938
|
+
};
|
|
131939
|
+
return out;
|
|
131940
|
+
}
|
|
131941
|
+
function getDeclaredTailwindMajor(projectPath) {
|
|
131942
|
+
try {
|
|
131943
|
+
const raw = fs__rspack_import_1.readFileSync(path__rspack_import_0.join(projectPath, 'package.json'), 'utf8');
|
|
131944
|
+
const pkg = JSON.parse(raw || '{}');
|
|
131945
|
+
const version1 = pkg?.dependencies?.tailwindcss || pkg?.devDependencies?.tailwindcss;
|
|
131946
|
+
if ('string' != typeof version1) return;
|
|
131947
|
+
const match = version1.match(/(\d+)/);
|
|
131948
|
+
if (!match) return;
|
|
131949
|
+
return parseInt(match[1], 10);
|
|
131950
|
+
} catch {
|
|
131951
|
+
return;
|
|
131458
131952
|
}
|
|
131459
131953
|
}
|
|
131460
131954
|
function isUsingPostCss(projectPath) {
|
|
@@ -131483,6 +131977,9 @@ var __webpack_modules__ = {
|
|
|
131483
131977
|
}
|
|
131484
131978
|
async function maybeUsePostCss(projectPath, opts) {
|
|
131485
131979
|
const userPostCssConfig = findPostCssConfig(projectPath);
|
|
131980
|
+
const userConfigMentionsTailwind = userConfigMentionsTailwindPlugin(userPostCssConfig);
|
|
131981
|
+
const userConfigUsesDirectTailwindReference = userConfigUsesDirectTailwindPluginReference(userPostCssConfig);
|
|
131982
|
+
const userConfigIsCjsInEsm = isLikelyCjsConfigInEsmProject(projectPath, userPostCssConfig);
|
|
131486
131983
|
function getPackageJsonConfig(p) {
|
|
131487
131984
|
try {
|
|
131488
131985
|
const raw = fs__rspack_import_1.readFileSync(path__rspack_import_0.join(p, 'package.json'), 'utf8');
|
|
@@ -131497,12 +131994,13 @@ var __webpack_modules__ = {
|
|
|
131497
131994
|
};
|
|
131498
131995
|
}
|
|
131499
131996
|
}
|
|
131500
|
-
const { hasPostCss: pkgHasPostCss
|
|
131997
|
+
const { hasPostCss: pkgHasPostCss } = getPackageJsonConfig(projectPath);
|
|
131501
131998
|
const tailwindPresent = (0, _tailwind__rspack_import_6.F)(projectPath);
|
|
131999
|
+
const tailwindConfigured = tailwindPresent || userConfigMentionsTailwind;
|
|
131502
132000
|
if (!userPostCssConfig && !pkgHasPostCss && !tailwindPresent) return {};
|
|
131503
132001
|
try {
|
|
131504
132002
|
require.resolve('postcss-loader');
|
|
131505
|
-
} catch (
|
|
132003
|
+
} catch (_error) {
|
|
131506
132004
|
if (!(0, _sass__rspack_import_7.fZ)(projectPath) && !(0, _less__rspack_import_8.K)(projectPath)) {
|
|
131507
132005
|
const postCssDependencies = [
|
|
131508
132006
|
'postcss',
|
|
@@ -131515,39 +132013,102 @@ var __webpack_modules__ = {
|
|
|
131515
132013
|
process.exit(0);
|
|
131516
132014
|
}
|
|
131517
132015
|
let pluginsFromOptions;
|
|
131518
|
-
|
|
131519
|
-
|
|
132016
|
+
const shouldInjectTailwindPlugin = tailwindConfigured && !pkgHasPostCss && (!userPostCssConfig || userConfigIsCjsInEsm || userConfigMentionsTailwind);
|
|
132017
|
+
const declaredTailwindMajor = getDeclaredTailwindMajor(projectPath);
|
|
132018
|
+
if (shouldInjectTailwindPlugin) try {
|
|
132019
|
+
const bases = Array.from(new Set([
|
|
131520
132020
|
projectPath,
|
|
132021
|
+
userPostCssConfig ? path__rspack_import_0.dirname(userPostCssConfig) : '',
|
|
131521
132022
|
process.cwd()
|
|
132023
|
+
].filter(Boolean)));
|
|
132024
|
+
const pluginCandidates = 'number' == typeof declaredTailwindMajor && declaredTailwindMajor < 4 ? [
|
|
132025
|
+
'tailwindcss',
|
|
132026
|
+
'@tailwindcss/postcss'
|
|
132027
|
+
] : [
|
|
132028
|
+
'@tailwindcss/postcss',
|
|
132029
|
+
'tailwindcss'
|
|
131522
132030
|
];
|
|
131523
132031
|
let tailwindMod;
|
|
132032
|
+
let tailwindPluginId;
|
|
131524
132033
|
for (const base of bases)try {
|
|
131525
|
-
const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(base, '
|
|
131526
|
-
|
|
131527
|
-
|
|
131528
|
-
|
|
132034
|
+
const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(base, '__extensionjs__.js'));
|
|
132035
|
+
for (const id of pluginCandidates)try {
|
|
132036
|
+
tailwindMod = req(id);
|
|
132037
|
+
tailwindPluginId = id;
|
|
132038
|
+
break;
|
|
132039
|
+
} catch {}
|
|
132040
|
+
if (tailwindMod) break;
|
|
132041
|
+
} catch {}
|
|
131529
132042
|
if (tailwindMod) {
|
|
131530
132043
|
if (tailwindMod && 'object' == typeof tailwindMod && 'default' in tailwindMod) tailwindMod = tailwindMod.default;
|
|
131531
132044
|
if ('function' == typeof tailwindMod) {
|
|
131532
|
-
|
|
131533
|
-
|
|
131534
|
-
{
|
|
131535
|
-
|
|
131536
|
-
|
|
132045
|
+
let instance;
|
|
132046
|
+
try {
|
|
132047
|
+
if ('tailwindcss' === tailwindPluginId) {
|
|
132048
|
+
const configFile = (0, _tailwind__rspack_import_6.r)(projectPath);
|
|
132049
|
+
if (configFile) if (isLikelyCjsTailwindConfig(configFile)) {
|
|
132050
|
+
const loaded = tryLoadCjsConfig(configFile);
|
|
132051
|
+
if (loaded && 'object' == typeof loaded) {
|
|
132052
|
+
const normalized = normalizeTailwindContentGlobs(loaded, projectPath);
|
|
132053
|
+
instance = tailwindMod(normalized);
|
|
132054
|
+
} else instance = tailwindMod({
|
|
132055
|
+
config: configFile
|
|
132056
|
+
});
|
|
132057
|
+
} else instance = tailwindMod({
|
|
132058
|
+
config: configFile
|
|
132059
|
+
});
|
|
132060
|
+
else instance = tailwindMod();
|
|
132061
|
+
} else instance = tailwindMod({
|
|
132062
|
+
base: projectPath
|
|
132063
|
+
});
|
|
132064
|
+
} catch {
|
|
132065
|
+
try {
|
|
132066
|
+
instance = tailwindMod();
|
|
132067
|
+
} catch {
|
|
132068
|
+
if ('tailwindcss' === tailwindPluginId) for (const base of bases)try {
|
|
132069
|
+
const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(base, '__extensionjs__.js'));
|
|
132070
|
+
let postcssMod = req('@tailwindcss/postcss');
|
|
132071
|
+
if (postcssMod && 'object' == typeof postcssMod && 'default' in postcssMod) postcssMod = postcssMod.default;
|
|
132072
|
+
if ('function' == typeof postcssMod) {
|
|
132073
|
+
instance = postcssMod({
|
|
132074
|
+
base: projectPath
|
|
132075
|
+
});
|
|
132076
|
+
tailwindPluginId = '@tailwindcss/postcss';
|
|
132077
|
+
break;
|
|
132078
|
+
}
|
|
132079
|
+
} catch {}
|
|
132080
|
+
}
|
|
132081
|
+
}
|
|
132082
|
+
if (instance) pluginsFromOptions = userConfigIsCjsInEsm ? [
|
|
132083
|
+
instance
|
|
132084
|
+
] : [
|
|
132085
|
+
...tailwindStringPluginDisableShims(),
|
|
131537
132086
|
instance
|
|
131538
132087
|
];
|
|
131539
|
-
} else if (tailwindMod && 'object' == typeof tailwindMod && 'postcssPlugin' in tailwindMod) pluginsFromOptions = [
|
|
131540
|
-
{
|
|
131541
|
-
'@tailwindcss/postcss': false
|
|
131542
|
-
},
|
|
132088
|
+
} else if (tailwindMod && 'object' == typeof tailwindMod && 'postcssPlugin' in tailwindMod) pluginsFromOptions = userConfigIsCjsInEsm ? [
|
|
131543
132089
|
tailwindMod
|
|
132090
|
+
] : [
|
|
132091
|
+
...tailwindStringPluginDisableShims(),
|
|
132092
|
+
tailwindMod
|
|
132093
|
+
];
|
|
132094
|
+
}
|
|
132095
|
+
} catch {}
|
|
132096
|
+
const bypassUserConfigForTailwindCompat = !!pluginsFromOptions && !!userPostCssConfig && userConfigMentionsTailwind && userConfigUsesDirectTailwindReference;
|
|
132097
|
+
if (userConfigIsCjsInEsm || bypassUserConfigForTailwindCompat) try {
|
|
132098
|
+
if ((0, _css_lib_integrations__rspack_import_5.ws)(projectPath, 'autoprefixer')) {
|
|
132099
|
+
const req = (0, module__rspack_import_2.createRequire)(path__rspack_import_0.join(projectPath, 'package.json'));
|
|
132100
|
+
const autoprefixerMod = req('autoprefixer');
|
|
132101
|
+
const autoprefixerPlugin = 'function' == typeof autoprefixerMod ? autoprefixerMod() : autoprefixerMod?.default && 'function' == typeof autoprefixerMod.default ? autoprefixerMod.default() : void 0;
|
|
132102
|
+
if (autoprefixerPlugin) pluginsFromOptions = [
|
|
132103
|
+
...pluginsFromOptions || [],
|
|
132104
|
+
autoprefixerPlugin
|
|
131544
132105
|
];
|
|
131545
132106
|
}
|
|
131546
132107
|
} catch {}
|
|
131547
132108
|
const postcssOptions = {
|
|
131548
132109
|
ident: 'postcss',
|
|
131549
132110
|
cwd: projectPath,
|
|
131550
|
-
config: projectPath
|
|
132111
|
+
config: userConfigIsCjsInEsm || bypassUserConfigForTailwindCompat ? false : projectPath
|
|
131551
132112
|
};
|
|
131552
132113
|
if (pluginsFromOptions) postcssOptions.plugins = pluginsFromOptions;
|
|
131553
132114
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
@@ -131811,10 +132372,12 @@ var __webpack_modules__ = {
|
|
|
131811
132372
|
K: ()=>isUsingPreact,
|
|
131812
132373
|
b: ()=>maybeUsePreact
|
|
131813
132374
|
});
|
|
131814
|
-
var
|
|
131815
|
-
var
|
|
131816
|
-
var
|
|
131817
|
-
var
|
|
132375
|
+
var path__rspack_import_0 = __webpack_require__("path");
|
|
132376
|
+
var module__rspack_import_1 = __webpack_require__("module");
|
|
132377
|
+
var pintor__rspack_import_2 = __webpack_require__("pintor");
|
|
132378
|
+
var pintor__rspack_import_2_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_2);
|
|
132379
|
+
var _js_frameworks_lib_messages__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
|
|
132380
|
+
var _frameworks_lib_integrations__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
|
|
131818
132381
|
let userMessageDelivered = false;
|
|
131819
132382
|
let cachedPreactRefreshPlugin;
|
|
131820
132383
|
function getPreactRefreshPlugin() {
|
|
@@ -131827,9 +132390,9 @@ var __webpack_modules__ = {
|
|
|
131827
132390
|
} catch {}
|
|
131828
132391
|
}
|
|
131829
132392
|
function isUsingPreact(projectPath) {
|
|
131830
|
-
if ((0,
|
|
132393
|
+
if ((0, _frameworks_lib_integrations__rspack_import_4.ws)(projectPath, 'preact')) {
|
|
131831
132394
|
if (!userMessageDelivered) {
|
|
131832
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${
|
|
132395
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_2_default().brightMagenta('►►► Author says')} ${_js_frameworks_lib_messages__rspack_import_3.zA('Preact')}`);
|
|
131833
132396
|
userMessageDelivered = true;
|
|
131834
132397
|
}
|
|
131835
132398
|
return true;
|
|
@@ -131847,9 +132410,9 @@ var __webpack_modules__ = {
|
|
|
131847
132410
|
'@rspack/plugin-preact-refresh',
|
|
131848
132411
|
'preact'
|
|
131849
132412
|
];
|
|
131850
|
-
const didInstall = await (0,
|
|
132413
|
+
const didInstall = await (0, _frameworks_lib_integrations__rspack_import_4.tm)('Preact', preactDependencies);
|
|
131851
132414
|
if (!didInstall) throw new Error('[Preact] Optional dependencies failed to install.');
|
|
131852
|
-
console.log(
|
|
132415
|
+
console.log(_js_frameworks_lib_messages__rspack_import_3.Jv('Preact'));
|
|
131853
132416
|
process.exit(0);
|
|
131854
132417
|
}
|
|
131855
132418
|
const PreactRefreshPlugin = getPreactRefreshPlugin();
|
|
@@ -131857,15 +132420,30 @@ var __webpack_modules__ = {
|
|
|
131857
132420
|
const preactPlugins = [
|
|
131858
132421
|
new PreactRefreshPlugin({})
|
|
131859
132422
|
];
|
|
132423
|
+
const requireFromProject = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(projectPath, 'package.json'));
|
|
132424
|
+
const resolveFromProject = (id)=>{
|
|
132425
|
+
try {
|
|
132426
|
+
return requireFromProject.resolve(id);
|
|
132427
|
+
} catch {
|
|
132428
|
+
return;
|
|
132429
|
+
}
|
|
132430
|
+
};
|
|
132431
|
+
const preactCompat = resolveFromProject('preact/compat');
|
|
132432
|
+
const preactTestUtils = resolveFromProject('preact/test-utils');
|
|
132433
|
+
const preactJsxRuntime = resolveFromProject('preact/jsx-runtime');
|
|
132434
|
+
const preactJsxDevRuntime = resolveFromProject('preact/jsx-dev-runtime');
|
|
132435
|
+
const alias = {};
|
|
132436
|
+
if (preactCompat) {
|
|
132437
|
+
alias.react = preactCompat;
|
|
132438
|
+
alias['react-dom'] = preactCompat;
|
|
132439
|
+
}
|
|
132440
|
+
if (preactTestUtils) alias['react-dom/test-utils'] = preactTestUtils;
|
|
132441
|
+
if (preactJsxRuntime) alias['react/jsx-runtime'] = preactJsxRuntime;
|
|
132442
|
+
if (preactJsxDevRuntime) alias['react/jsx-dev-runtime'] = preactJsxDevRuntime;
|
|
131860
132443
|
return {
|
|
131861
132444
|
plugins: preactPlugins,
|
|
131862
132445
|
loaders: void 0,
|
|
131863
|
-
alias
|
|
131864
|
-
react: 'preact/compat',
|
|
131865
|
-
'react-dom/test-utils': 'preact/test-utils',
|
|
131866
|
-
'react-dom': 'preact/compat',
|
|
131867
|
-
'react/jsx-runtime': 'preact/jsx-runtime'
|
|
131868
|
-
}
|
|
132446
|
+
alias
|
|
131869
132447
|
};
|
|
131870
132448
|
}
|
|
131871
132449
|
},
|
|
@@ -131928,6 +132506,7 @@ var __webpack_modules__ = {
|
|
|
131928
132506
|
let reactDomPath;
|
|
131929
132507
|
let reactDomClientPath;
|
|
131930
132508
|
let jsxRuntimePath;
|
|
132509
|
+
let jsxDevRuntimePath;
|
|
131931
132510
|
try {
|
|
131932
132511
|
reactPath = requireFromProject.resolve('react');
|
|
131933
132512
|
} catch {}
|
|
@@ -131940,11 +132519,15 @@ var __webpack_modules__ = {
|
|
|
131940
132519
|
try {
|
|
131941
132520
|
jsxRuntimePath = requireFromProject.resolve('react/jsx-runtime');
|
|
131942
132521
|
} catch {}
|
|
132522
|
+
try {
|
|
132523
|
+
jsxDevRuntimePath = requireFromProject.resolve('react/jsx-dev-runtime');
|
|
132524
|
+
} catch {}
|
|
131943
132525
|
const alias = {};
|
|
131944
132526
|
if (reactPath) alias['react$'] = reactPath;
|
|
131945
132527
|
if (reactDomPath) alias['react-dom$'] = reactDomPath;
|
|
131946
132528
|
if (reactDomClientPath) alias['react-dom/client'] = reactDomClientPath;
|
|
131947
132529
|
if (jsxRuntimePath) alias['react/jsx-runtime'] = jsxRuntimePath;
|
|
132530
|
+
if (jsxDevRuntimePath) alias['react/jsx-dev-runtime'] = jsxDevRuntimePath;
|
|
131948
132531
|
return {
|
|
131949
132532
|
plugins: reactPlugins,
|
|
131950
132533
|
loaders: void 0,
|
|
@@ -131959,9 +132542,10 @@ var __webpack_modules__ = {
|
|
|
131959
132542
|
a: ()=>isUsingSvelte
|
|
131960
132543
|
});
|
|
131961
132544
|
var path__rspack_import_0 = __webpack_require__("path");
|
|
131962
|
-
var
|
|
131963
|
-
var
|
|
131964
|
-
var
|
|
132545
|
+
var module__rspack_import_1 = __webpack_require__("module");
|
|
132546
|
+
var _js_frameworks_lib_messages__rspack_import_2 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
|
|
132547
|
+
var _frameworks_lib_integrations__rspack_import_3 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
|
|
132548
|
+
var _js_frameworks_lib_load_loader_options__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/load-loader-options.ts");
|
|
131965
132549
|
let userMessageDelivered = false;
|
|
131966
132550
|
function resolveFromProject(id, projectPath) {
|
|
131967
132551
|
try {
|
|
@@ -131976,9 +132560,9 @@ var __webpack_modules__ = {
|
|
|
131976
132560
|
}
|
|
131977
132561
|
}
|
|
131978
132562
|
function isUsingSvelte(projectPath) {
|
|
131979
|
-
const using = (0,
|
|
132563
|
+
const using = (0, _frameworks_lib_integrations__rspack_import_3.ws)(projectPath, 'svelte');
|
|
131980
132564
|
if (using && !userMessageDelivered) {
|
|
131981
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(
|
|
132565
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(_js_frameworks_lib_messages__rspack_import_2.zA('Svelte'));
|
|
131982
132566
|
userMessageDelivered = true;
|
|
131983
132567
|
}
|
|
131984
132568
|
return using;
|
|
@@ -131991,14 +132575,14 @@ var __webpack_modules__ = {
|
|
|
131991
132575
|
const typeScriptDependencies = [
|
|
131992
132576
|
"typescript"
|
|
131993
132577
|
];
|
|
131994
|
-
const didInstallTs = await (0,
|
|
132578
|
+
const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('TypeScript', typeScriptDependencies);
|
|
131995
132579
|
if (!didInstallTs) throw new Error('[TypeScript] Optional dependencies failed to install.');
|
|
131996
132580
|
const svelteDependencies = [
|
|
131997
132581
|
'svelte-loader'
|
|
131998
132582
|
];
|
|
131999
|
-
const didInstallSvelte = await (0,
|
|
132583
|
+
const didInstallSvelte = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('Svelte', svelteDependencies);
|
|
132000
132584
|
if (!didInstallSvelte) throw new Error('[Svelte] Optional dependencies failed to install.');
|
|
132001
|
-
console.log(
|
|
132585
|
+
console.log(_js_frameworks_lib_messages__rspack_import_2.Jv('Svelte'));
|
|
132002
132586
|
process.exit(0);
|
|
132003
132587
|
}
|
|
132004
132588
|
try {
|
|
@@ -132012,12 +132596,12 @@ var __webpack_modules__ = {
|
|
|
132012
132596
|
const typeScriptDependencies = [
|
|
132013
132597
|
"typescript"
|
|
132014
132598
|
];
|
|
132015
|
-
const didInstallTs = await (0,
|
|
132599
|
+
const didInstallTs = await (0, _frameworks_lib_integrations__rspack_import_3.tm)('TypeScript', typeScriptDependencies);
|
|
132016
132600
|
if (!didInstallTs) throw new Error('[TypeScript] Optional dependencies failed to install.');
|
|
132017
|
-
console.log(
|
|
132601
|
+
console.log(_js_frameworks_lib_messages__rspack_import_2.Jv('TypeScript'));
|
|
132018
132602
|
process.exit(0);
|
|
132019
132603
|
}
|
|
132020
|
-
const customOptions = await (0,
|
|
132604
|
+
const customOptions = await (0, _js_frameworks_lib_load_loader_options__rspack_import_4.g)(projectPath, 'svelte');
|
|
132021
132605
|
const svelteLoaderPath = resolveFromProject('svelte-loader', projectPath) || require.resolve('svelte-loader');
|
|
132022
132606
|
const defaultLoaders = [
|
|
132023
132607
|
{
|
|
@@ -132051,7 +132635,25 @@ var __webpack_modules__ = {
|
|
|
132051
132635
|
}
|
|
132052
132636
|
}
|
|
132053
132637
|
];
|
|
132054
|
-
const
|
|
132638
|
+
const requireFromProject = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(projectPath, 'package.json'));
|
|
132639
|
+
const resolveSvelteRuntime = (id)=>{
|
|
132640
|
+
try {
|
|
132641
|
+
return requireFromProject.resolve(id);
|
|
132642
|
+
} catch {
|
|
132643
|
+
return;
|
|
132644
|
+
}
|
|
132645
|
+
};
|
|
132646
|
+
const alias = {};
|
|
132647
|
+
const svelteEntry = resolveSvelteRuntime('svelte');
|
|
132648
|
+
const svelteInternal = resolveSvelteRuntime('svelte/internal');
|
|
132649
|
+
const svelteStore = resolveSvelteRuntime('svelte/store');
|
|
132650
|
+
const svelteMotion = resolveSvelteRuntime('svelte/motion');
|
|
132651
|
+
const svelteTransition = resolveSvelteRuntime('svelte/transition');
|
|
132652
|
+
if (svelteEntry) alias.svelte = svelteEntry;
|
|
132653
|
+
if (svelteInternal) alias['svelte/internal'] = svelteInternal;
|
|
132654
|
+
if (svelteStore) alias['svelte/store'] = svelteStore;
|
|
132655
|
+
if (svelteMotion) alias['svelte/motion'] = svelteMotion;
|
|
132656
|
+
if (svelteTransition) alias['svelte/transition'] = svelteTransition;
|
|
132055
132657
|
const resolverPlugin = {
|
|
132056
132658
|
apply (compiler) {
|
|
132057
132659
|
const existingMainFields = compiler.options.resolve && compiler.options.resolve.mainFields || [];
|
|
@@ -132219,12 +132821,14 @@ var __webpack_modules__ = {
|
|
|
132219
132821
|
K: ()=>maybeUseVue,
|
|
132220
132822
|
L: ()=>isUsingVue
|
|
132221
132823
|
});
|
|
132222
|
-
var
|
|
132223
|
-
var
|
|
132224
|
-
var
|
|
132225
|
-
var
|
|
132226
|
-
var
|
|
132227
|
-
var
|
|
132824
|
+
var path__rspack_import_0 = __webpack_require__("path");
|
|
132825
|
+
var module__rspack_import_1 = __webpack_require__("module");
|
|
132826
|
+
var _rspack_core__rspack_import_2 = __webpack_require__("@rspack/core");
|
|
132827
|
+
var pintor__rspack_import_3 = __webpack_require__("pintor");
|
|
132828
|
+
var pintor__rspack_import_3_default = /*#__PURE__*/ __webpack_require__.n(pintor__rspack_import_3);
|
|
132829
|
+
var _js_frameworks_lib_messages__rspack_import_4 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
|
|
132830
|
+
var _frameworks_lib_integrations__rspack_import_5 = __webpack_require__("./webpack/plugin-js-frameworks/frameworks-lib/integrations.ts");
|
|
132831
|
+
var _js_frameworks_lib_load_loader_options__rspack_import_6 = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/load-loader-options.ts");
|
|
132228
132832
|
let userMessageDelivered = false;
|
|
132229
132833
|
let cachedVueLoaderPlugin;
|
|
132230
132834
|
function getVueLoaderPlugin() {
|
|
@@ -132239,9 +132843,9 @@ var __webpack_modules__ = {
|
|
|
132239
132843
|
} catch {}
|
|
132240
132844
|
}
|
|
132241
132845
|
function isUsingVue(projectPath) {
|
|
132242
|
-
const using = (0,
|
|
132846
|
+
const using = (0, _frameworks_lib_integrations__rspack_import_5.ws)(projectPath, 'vue');
|
|
132243
132847
|
if (using && !userMessageDelivered) {
|
|
132244
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${
|
|
132848
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${pintor__rspack_import_3_default().brightMagenta('►►► Author says')} ${_js_frameworks_lib_messages__rspack_import_4.zA('Vue')}`);
|
|
132245
132849
|
userMessageDelivered = true;
|
|
132246
132850
|
}
|
|
132247
132851
|
return using;
|
|
@@ -132255,14 +132859,14 @@ var __webpack_modules__ = {
|
|
|
132255
132859
|
'vue-loader',
|
|
132256
132860
|
'@vue/compiler-sfc'
|
|
132257
132861
|
];
|
|
132258
|
-
const didInstall = await (0,
|
|
132862
|
+
const didInstall = await (0, _frameworks_lib_integrations__rspack_import_5.tm)('Vue', vueDependencies);
|
|
132259
132863
|
if (!didInstall) throw new Error('[Vue] Optional dependencies failed to install.');
|
|
132260
|
-
console.log(
|
|
132864
|
+
console.log(_js_frameworks_lib_messages__rspack_import_4.Jv('Vue'));
|
|
132261
132865
|
process.exit(0);
|
|
132262
132866
|
}
|
|
132263
132867
|
const VueLoaderPlugin = getVueLoaderPlugin();
|
|
132264
132868
|
if (!VueLoaderPlugin) throw new Error('[Vue] vue-loader is installed but VueLoaderPlugin could not be resolved.');
|
|
132265
|
-
const customOptions = await (0,
|
|
132869
|
+
const customOptions = await (0, _js_frameworks_lib_load_loader_options__rspack_import_6.g)(projectPath, 'vue');
|
|
132266
132870
|
const defaultLoaders = [
|
|
132267
132871
|
{
|
|
132268
132872
|
test: /\.vue$/,
|
|
@@ -132278,16 +132882,33 @@ var __webpack_modules__ = {
|
|
|
132278
132882
|
const isProd = 'production' === mode;
|
|
132279
132883
|
const defaultPlugins = [
|
|
132280
132884
|
new VueLoaderPlugin(),
|
|
132281
|
-
new
|
|
132885
|
+
new _rspack_core__rspack_import_2.DefinePlugin({
|
|
132282
132886
|
__VUE_OPTIONS_API__: JSON.stringify(true),
|
|
132283
132887
|
__VUE_PROD_DEVTOOLS__: JSON.stringify(!isProd),
|
|
132284
132888
|
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: JSON.stringify(!isProd)
|
|
132285
132889
|
})
|
|
132286
132890
|
];
|
|
132891
|
+
const requireFromProject = (0, module__rspack_import_1.createRequire)(path__rspack_import_0.join(projectPath, 'package.json'));
|
|
132892
|
+
const resolveFromProject = (id)=>{
|
|
132893
|
+
try {
|
|
132894
|
+
return requireFromProject.resolve(id);
|
|
132895
|
+
} catch {
|
|
132896
|
+
return;
|
|
132897
|
+
}
|
|
132898
|
+
};
|
|
132899
|
+
const alias = {};
|
|
132900
|
+
const vuePath = resolveFromProject('vue');
|
|
132901
|
+
const vueRuntimeDom = resolveFromProject('@vue/runtime-dom');
|
|
132902
|
+
const vueRuntimeCore = resolveFromProject('@vue/runtime-core');
|
|
132903
|
+
const vueShared = resolveFromProject('@vue/shared');
|
|
132904
|
+
if (vuePath) alias['vue$'] = vuePath;
|
|
132905
|
+
if (vueRuntimeDom) alias['@vue/runtime-dom'] = vueRuntimeDom;
|
|
132906
|
+
if (vueRuntimeCore) alias['@vue/runtime-core'] = vueRuntimeCore;
|
|
132907
|
+
if (vueShared) alias['@vue/shared'] = vueShared;
|
|
132287
132908
|
return {
|
|
132288
132909
|
plugins: defaultPlugins,
|
|
132289
132910
|
loaders: defaultLoaders,
|
|
132290
|
-
alias
|
|
132911
|
+
alias
|
|
132291
132912
|
};
|
|
132292
132913
|
}
|
|
132293
132914
|
},
|
|
@@ -132347,76 +132968,6 @@ var __webpack_modules__ = {
|
|
|
132347
132968
|
return Object.keys(dependencies).filter((dep)=>!isDependencyInstalled(dep, packageRoot));
|
|
132348
132969
|
}
|
|
132349
132970
|
},
|
|
132350
|
-
"./webpack/webpack-lib/companion-extensions.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
132351
|
-
"use strict";
|
|
132352
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
132353
|
-
A: ()=>resolveCompanionExtensionDirs
|
|
132354
|
-
});
|
|
132355
|
-
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
132356
|
-
var path__rspack_import_1 = __webpack_require__("path");
|
|
132357
|
-
function isDir(p) {
|
|
132358
|
-
try {
|
|
132359
|
-
return fs__rspack_import_0.existsSync(p) && fs__rspack_import_0.statSync(p).isDirectory();
|
|
132360
|
-
} catch {
|
|
132361
|
-
return false;
|
|
132362
|
-
}
|
|
132363
|
-
}
|
|
132364
|
-
function isFile(p) {
|
|
132365
|
-
try {
|
|
132366
|
-
return fs__rspack_import_0.existsSync(p) && fs__rspack_import_0.statSync(p).isFile();
|
|
132367
|
-
} catch {
|
|
132368
|
-
return false;
|
|
132369
|
-
}
|
|
132370
|
-
}
|
|
132371
|
-
function toAbs(projectRoot, p) {
|
|
132372
|
-
return path__rspack_import_1.isAbsolute(p) ? p : path__rspack_import_1.resolve(projectRoot, p);
|
|
132373
|
-
}
|
|
132374
|
-
function isValidExtensionRoot(dir) {
|
|
132375
|
-
if (!isDir(dir)) return false;
|
|
132376
|
-
return isFile(path__rspack_import_1.join(dir, 'manifest.json'));
|
|
132377
|
-
}
|
|
132378
|
-
function resolveCompanionExtensionDirs(opts) {
|
|
132379
|
-
const { projectRoot, config } = opts;
|
|
132380
|
-
const explicitPaths = [];
|
|
132381
|
-
let scanDir;
|
|
132382
|
-
if (Array.isArray(config)) explicitPaths.push(...config.filter((p)=>'string' == typeof p));
|
|
132383
|
-
else if (config && 'object' == typeof config) {
|
|
132384
|
-
if (Array.isArray(config.paths)) explicitPaths.push(...config.paths.filter((p)=>'string' == typeof p));
|
|
132385
|
-
if ('string' == typeof config.dir && config.dir.trim().length > 0) scanDir = config.dir.trim();
|
|
132386
|
-
}
|
|
132387
|
-
const found = [];
|
|
132388
|
-
for (const p of explicitPaths){
|
|
132389
|
-
const abs = toAbs(projectRoot, p);
|
|
132390
|
-
if (isValidExtensionRoot(abs)) found.push(abs);
|
|
132391
|
-
}
|
|
132392
|
-
if (scanDir) {
|
|
132393
|
-
const absScan = toAbs(projectRoot, scanDir);
|
|
132394
|
-
if (isDir(absScan)) {
|
|
132395
|
-
let entries = [];
|
|
132396
|
-
try {
|
|
132397
|
-
entries = fs__rspack_import_0.readdirSync(absScan, {
|
|
132398
|
-
withFileTypes: true
|
|
132399
|
-
});
|
|
132400
|
-
} catch {
|
|
132401
|
-
entries = [];
|
|
132402
|
-
}
|
|
132403
|
-
for (const ent of entries){
|
|
132404
|
-
if (!ent.isDirectory()) continue;
|
|
132405
|
-
if (ent.name.startsWith('.')) continue;
|
|
132406
|
-
const candidate = path__rspack_import_1.join(absScan, ent.name);
|
|
132407
|
-
if (isValidExtensionRoot(candidate)) found.push(candidate);
|
|
132408
|
-
}
|
|
132409
|
-
}
|
|
132410
|
-
}
|
|
132411
|
-
const unique = [];
|
|
132412
|
-
const seen = new Set();
|
|
132413
|
-
for (const p of found)if (!seen.has(p)) {
|
|
132414
|
-
seen.add(p);
|
|
132415
|
-
unique.push(p);
|
|
132416
|
-
}
|
|
132417
|
-
return unique;
|
|
132418
|
-
}
|
|
132419
|
-
},
|
|
132420
132971
|
"./webpack/webpack-lib/config-loader.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
132421
132972
|
"use strict";
|
|
132422
132973
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -132576,9 +133127,13 @@ var __webpack_modules__ = {
|
|
|
132576
133127
|
const baseExtensions = userConfig && userConfig.extensions ? {
|
|
132577
133128
|
extensions: userConfig.extensions
|
|
132578
133129
|
} : {};
|
|
133130
|
+
const baseTranspilePackages = userConfig && Array.isArray(userConfig.transpilePackages) ? {
|
|
133131
|
+
transpilePackages: userConfig.transpilePackages
|
|
133132
|
+
} : {};
|
|
132579
133133
|
const perCommand = userConfig && userConfig.commands && userConfig.commands[command] ? userConfig.commands[command] : {};
|
|
132580
133134
|
return {
|
|
132581
133135
|
...baseExtensions,
|
|
133136
|
+
...baseTranspilePackages,
|
|
132582
133137
|
...perCommand
|
|
132583
133138
|
};
|
|
132584
133139
|
} catch (err) {
|
|
@@ -132700,6 +133255,18 @@ var __webpack_modules__ = {
|
|
|
132700
133255
|
var fs__rspack_import_0 = __webpack_require__("fs");
|
|
132701
133256
|
var path__rspack_import_1 = __webpack_require__("path");
|
|
132702
133257
|
var _paths__rspack_import_2 = __webpack_require__("./webpack/webpack-lib/paths.ts");
|
|
133258
|
+
function hasNewTabOverride(extensionDir) {
|
|
133259
|
+
const manifestPath = path__rspack_import_1.join(extensionDir, 'manifest.json');
|
|
133260
|
+
if (!fs__rspack_import_0.existsSync(manifestPath)) return false;
|
|
133261
|
+
try {
|
|
133262
|
+
const raw = fs__rspack_import_0.readFileSync(manifestPath, 'utf-8');
|
|
133263
|
+
const manifest = JSON.parse(raw);
|
|
133264
|
+
const newtab = manifest?.chrome_url_overrides?.newtab;
|
|
133265
|
+
return 'string' == typeof newtab && newtab.trim().length > 0;
|
|
133266
|
+
} catch {
|
|
133267
|
+
return false;
|
|
133268
|
+
}
|
|
133269
|
+
}
|
|
132703
133270
|
function computeExtensionsToLoad(baseDir, mode, browser, userExtensionOutputPath, extraExtensionDirs = []) {
|
|
132704
133271
|
const list = [];
|
|
132705
133272
|
try {
|
|
@@ -132709,7 +133276,10 @@ var __webpack_modules__ = {
|
|
|
132709
133276
|
const themeRoot = path__rspack_import_1.join(distRoot, 'extension-js-theme');
|
|
132710
133277
|
const devtoolsForBrowser = path__rspack_import_1.join(devtoolsRoot, engine);
|
|
132711
133278
|
const themeForBrowser = path__rspack_import_1.join(themeRoot, engine);
|
|
132712
|
-
|
|
133279
|
+
const userHasNewTabOverride = hasNewTabOverride(userExtensionOutputPath);
|
|
133280
|
+
const devtoolsHasNewTabOverride = hasNewTabOverride(devtoolsForBrowser);
|
|
133281
|
+
const shouldSkipDevtoolsForNtpConflict = userHasNewTabOverride && devtoolsHasNewTabOverride;
|
|
133282
|
+
if ('production' !== mode && fs__rspack_import_0.existsSync(devtoolsForBrowser) && !shouldSkipDevtoolsForNtpConflict) list.push(devtoolsForBrowser);
|
|
132713
133283
|
if (fs__rspack_import_0.existsSync(themeForBrowser)) list.push(themeForBrowser);
|
|
132714
133284
|
} catch {}
|
|
132715
133285
|
for (const p of extraExtensionDirs)list.push(p);
|
|
@@ -133090,7 +133660,7 @@ var __webpack_modules__ = {
|
|
|
133090
133660
|
return `${getLoggingPrefix('info')} Using ${pintor__rspack_import_2_default().yellow(integration)}.`;
|
|
133091
133661
|
}
|
|
133092
133662
|
function installingDependencies() {
|
|
133093
|
-
return `${getLoggingPrefix('info')} Installing project dependencies
|
|
133663
|
+
return `${getLoggingPrefix('info')} Installing project dependencies... ${pintor__rspack_import_2_default().gray('(This may take a moment)')}`;
|
|
133094
133664
|
}
|
|
133095
133665
|
function debugDirs(manifestDir, packageJsonDir) {
|
|
133096
133666
|
return `${getLoggingPrefix('info')} Directories\n${pintor__rspack_import_2_default().gray('MANIFEST_DIR')} ${pintor__rspack_import_2_default().underline(manifestDir)}\n${pintor__rspack_import_2_default().gray('PACKAGE_JSON_DIR')} ${pintor__rspack_import_2_default().underline(packageJsonDir)}`;
|
|
@@ -133133,6 +133703,77 @@ var __webpack_modules__ = {
|
|
|
133133
133703
|
return `${getLoggingPrefix('error')} Your project declares dependencies that are managed by ${pintor__rspack_import_2_default().blue('Extension.js')} and referenced in ${pintor__rspack_import_2_default().underline('extension.config.js')}\n${pintor__rspack_import_2_default().red('This can cause version conflicts and break the development/build process.')}\n\n${pintor__rspack_import_2_default().gray('Managed dependencies (remove these from your package.json):')}\n${list}\n\n${pintor__rspack_import_2_default().gray('PATH')} ${pintor__rspack_import_2_default().underline(userPackageJsonPath)}\nIf you need a different version, open an issue so we can consider bundling it safely.\nOperation aborted.`;
|
|
133134
133704
|
}
|
|
133135
133705
|
},
|
|
133706
|
+
"./webpack/webpack-lib/package-json.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
133707
|
+
"use strict";
|
|
133708
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
133709
|
+
Pb: ()=>findNearestPackageJsonSync,
|
|
133710
|
+
cy: ()=>findNearestPackageJson,
|
|
133711
|
+
t7: ()=>validatePackageJson
|
|
133712
|
+
});
|
|
133713
|
+
var path__rspack_import_0 = __webpack_require__("path");
|
|
133714
|
+
var fs__rspack_import_1 = __webpack_require__("fs");
|
|
133715
|
+
async function findUpLocal(filename, options) {
|
|
133716
|
+
const root = path__rspack_import_0.parse(options.cwd).root;
|
|
133717
|
+
let currentDir = options.cwd;
|
|
133718
|
+
while(true){
|
|
133719
|
+
const candidate = path__rspack_import_0.join(currentDir, filename);
|
|
133720
|
+
try {
|
|
133721
|
+
const stat = await fs__rspack_import_1.promises.stat(candidate);
|
|
133722
|
+
if (stat.isFile()) return candidate;
|
|
133723
|
+
} catch {}
|
|
133724
|
+
if (currentDir === root) return;
|
|
133725
|
+
currentDir = path__rspack_import_0.dirname(currentDir);
|
|
133726
|
+
}
|
|
133727
|
+
}
|
|
133728
|
+
function findUpLocalSync(filename, options) {
|
|
133729
|
+
const root = path__rspack_import_0.parse(options.cwd).root;
|
|
133730
|
+
let currentDir = options.cwd;
|
|
133731
|
+
while(true){
|
|
133732
|
+
const candidate = path__rspack_import_0.join(currentDir, filename);
|
|
133733
|
+
try {
|
|
133734
|
+
const stat = fs__rspack_import_1.statSync(candidate);
|
|
133735
|
+
if (stat.isFile()) return candidate;
|
|
133736
|
+
} catch {}
|
|
133737
|
+
if (currentDir === root) return;
|
|
133738
|
+
currentDir = path__rspack_import_0.dirname(currentDir);
|
|
133739
|
+
}
|
|
133740
|
+
}
|
|
133741
|
+
async function findNearestPackageJson(manifestPath) {
|
|
133742
|
+
try {
|
|
133743
|
+
const manifestDir = path__rspack_import_0.dirname(manifestPath);
|
|
133744
|
+
const packageJsonPath = await findUpLocal('package.json', {
|
|
133745
|
+
cwd: manifestDir
|
|
133746
|
+
});
|
|
133747
|
+
return packageJsonPath || null;
|
|
133748
|
+
} catch (error) {
|
|
133749
|
+
console.warn('Failed to find package.json:', error);
|
|
133750
|
+
return null;
|
|
133751
|
+
}
|
|
133752
|
+
}
|
|
133753
|
+
function findNearestPackageJsonSync(manifestPath) {
|
|
133754
|
+
try {
|
|
133755
|
+
const manifestDir = path__rspack_import_0.dirname(manifestPath);
|
|
133756
|
+
const packageJsonPath = findUpLocalSync('package.json', {
|
|
133757
|
+
cwd: manifestDir
|
|
133758
|
+
});
|
|
133759
|
+
return packageJsonPath || null;
|
|
133760
|
+
} catch (error) {
|
|
133761
|
+
console.warn('Failed to find package.json:', error);
|
|
133762
|
+
return null;
|
|
133763
|
+
}
|
|
133764
|
+
}
|
|
133765
|
+
function validatePackageJson(packageJsonPath) {
|
|
133766
|
+
try {
|
|
133767
|
+
if (!fs__rspack_import_1.existsSync(packageJsonPath)) return false;
|
|
133768
|
+
const content = fs__rspack_import_1.readFileSync(packageJsonPath, 'utf-8');
|
|
133769
|
+
JSON.parse(content);
|
|
133770
|
+
return true;
|
|
133771
|
+
} catch (error) {
|
|
133772
|
+
console.warn('Invalid package.json at:', packageJsonPath, error);
|
|
133773
|
+
return false;
|
|
133774
|
+
}
|
|
133775
|
+
}
|
|
133776
|
+
},
|
|
133136
133777
|
"./webpack/webpack-lib/package-manager.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
133137
133778
|
"use strict";
|
|
133138
133779
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -133452,12 +134093,15 @@ var __webpack_modules__ = {
|
|
|
133452
134093
|
const depsCount = Object.keys(packageJson?.dependencies || {}).length;
|
|
133453
134094
|
const devDepsCount = Object.keys(packageJson?.devDependencies || {}).length;
|
|
133454
134095
|
if (depsCount + devDepsCount === 0) return false;
|
|
133455
|
-
if ((0, _install_cache__rspack_import_2.Q)(packageJsonDir)) return false;
|
|
133456
134096
|
if (!fs__rspack_import_0.existsSync(nm)) return true;
|
|
133457
134097
|
const deps = Object.keys(packageJson?.dependencies || {});
|
|
133458
134098
|
const devDeps = Object.keys(packageJson?.devDependencies || {});
|
|
134099
|
+
const hasMarker = (0, _install_cache__rspack_import_2.Q)(packageJsonDir);
|
|
133459
134100
|
if (fs__rspack_import_0.existsSync(path__rspack_import_1.join(nm, '.pnpm'))) return false;
|
|
133460
134101
|
if (fs__rspack_import_0.existsSync(path__rspack_import_1.join(nm, '.modules.yaml'))) return false;
|
|
134102
|
+
if (hasMarker) try {
|
|
134103
|
+
if (fs__rspack_import_0.readdirSync(nm).length > 0) return false;
|
|
134104
|
+
} catch {}
|
|
133461
134105
|
const hasInstalledDep = [
|
|
133462
134106
|
...deps,
|
|
133463
134107
|
...devDeps
|
|
@@ -133536,6 +134180,11 @@ var __webpack_modules__ = {
|
|
|
133536
134180
|
J: ()=>startProgressBar,
|
|
133537
134181
|
u: ()=>shouldShowProgress
|
|
133538
134182
|
});
|
|
134183
|
+
function clearLine() {
|
|
134184
|
+
if (!process.stdout.isTTY) return;
|
|
134185
|
+
process.stdout.write('\r');
|
|
134186
|
+
process.stdout.write('\x1b[2K');
|
|
134187
|
+
}
|
|
133539
134188
|
function stripAnsi(input) {
|
|
133540
134189
|
return input.replace(/\x1b\[[0-9;]*m/g, '');
|
|
133541
134190
|
}
|
|
@@ -133557,7 +134206,8 @@ var __webpack_modules__ = {
|
|
|
133557
134206
|
const bar = `[${'='.repeat(filled)}${' '.repeat(empty)}]`;
|
|
133558
134207
|
const line = `${label} ${bar}`;
|
|
133559
134208
|
lastVisibleLength = stripAnsi(line).length;
|
|
133560
|
-
|
|
134209
|
+
clearLine();
|
|
134210
|
+
process.stdout.write(line);
|
|
133561
134211
|
tick = (tick + 1) % (width + 1);
|
|
133562
134212
|
};
|
|
133563
134213
|
render();
|
|
@@ -133566,7 +134216,11 @@ var __webpack_modules__ = {
|
|
|
133566
134216
|
stop: ()=>{
|
|
133567
134217
|
clearInterval(timer);
|
|
133568
134218
|
if (process.stdout.isTTY) {
|
|
133569
|
-
|
|
134219
|
+
clearLine();
|
|
134220
|
+
if (lastVisibleLength > 0) {
|
|
134221
|
+
process.stdout.write(' '.repeat(lastVisibleLength));
|
|
134222
|
+
process.stdout.write('\r');
|
|
134223
|
+
}
|
|
133570
134224
|
if (options?.persistLabel) process.stdout.write(`${label}\n`);
|
|
133571
134225
|
}
|
|
133572
134226
|
}
|
|
@@ -133716,7 +134370,7 @@ var __webpack_modules__ = {
|
|
|
133716
134370
|
},
|
|
133717
134371
|
"./package.json" (module) {
|
|
133718
134372
|
"use strict";
|
|
133719
|
-
module.exports = JSON.parse('{"rE":"3.
|
|
134373
|
+
module.exports = JSON.parse('{"rE":"3.6.0","El":{"@rspack/core":"^1.7.5","@rspack/dev-server":"^1.1.5","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chrome-location2":"4.0.0","chromium-location":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","edge-location":"2.2.0","extension-from-store":"^0.1.1","firefox-location2":"3.0.0","go-git-it":"^5.1.1","ignore":"^7.0.5","loader-utils":"^3.3.1","magic-string":"^0.30.21","parse5":"^8.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.3.3","tiny-glob":"^0.2.9","unique-names-generator":"^4.7.1","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.19.0"}}');
|
|
133720
134374
|
}
|
|
133721
134375
|
};
|
|
133722
134376
|
var __webpack_module_cache__ = {};
|
|
@@ -133811,42 +134465,7 @@ var __webpack_exports__ = {};
|
|
|
133811
134465
|
var external_path_ = __webpack_require__("path");
|
|
133812
134466
|
var external_fs_ = __webpack_require__("fs");
|
|
133813
134467
|
var messages = __webpack_require__("./webpack/webpack-lib/messages.ts");
|
|
133814
|
-
|
|
133815
|
-
const root = external_path_.parse(options.cwd).root;
|
|
133816
|
-
let currentDir = options.cwd;
|
|
133817
|
-
while(true){
|
|
133818
|
-
const candidate = external_path_.join(currentDir, filename);
|
|
133819
|
-
try {
|
|
133820
|
-
const stat = await external_fs_.promises.stat(candidate);
|
|
133821
|
-
if (stat.isFile()) return candidate;
|
|
133822
|
-
} catch {}
|
|
133823
|
-
if (currentDir === root) return;
|
|
133824
|
-
currentDir = external_path_.dirname(currentDir);
|
|
133825
|
-
}
|
|
133826
|
-
}
|
|
133827
|
-
async function findNearestPackageJson(manifestPath) {
|
|
133828
|
-
try {
|
|
133829
|
-
const manifestDir = external_path_.dirname(manifestPath);
|
|
133830
|
-
const packageJsonPath = await findUpLocal('package.json', {
|
|
133831
|
-
cwd: manifestDir
|
|
133832
|
-
});
|
|
133833
|
-
return packageJsonPath || null;
|
|
133834
|
-
} catch (error) {
|
|
133835
|
-
console.warn('Failed to find package.json:', error);
|
|
133836
|
-
return null;
|
|
133837
|
-
}
|
|
133838
|
-
}
|
|
133839
|
-
function validatePackageJson(packageJsonPath) {
|
|
133840
|
-
try {
|
|
133841
|
-
if (!external_fs_.existsSync(packageJsonPath)) return false;
|
|
133842
|
-
const content = external_fs_.readFileSync(packageJsonPath, 'utf-8');
|
|
133843
|
-
JSON.parse(content);
|
|
133844
|
-
return true;
|
|
133845
|
-
} catch (error) {
|
|
133846
|
-
console.warn('Invalid package.json at:', packageJsonPath, error);
|
|
133847
|
-
return false;
|
|
133848
|
-
}
|
|
133849
|
-
}
|
|
134468
|
+
var package_json = __webpack_require__("./webpack/webpack-lib/package-json.ts");
|
|
133850
134469
|
const isUrl = (url)=>{
|
|
133851
134470
|
try {
|
|
133852
134471
|
new URL(url);
|
|
@@ -133968,15 +134587,24 @@ var __webpack_exports__ = {};
|
|
|
133968
134587
|
}
|
|
133969
134588
|
async function getProjectStructure(pathOrRemoteUrl) {
|
|
133970
134589
|
const projectPath = await getProjectPath(pathOrRemoteUrl);
|
|
133971
|
-
|
|
134590
|
+
const isUnderDir = (baseDir, candidatePath)=>{
|
|
134591
|
+
const rel = external_path_.relative(baseDir, candidatePath);
|
|
134592
|
+
return Boolean(rel && !rel.startsWith('..') && !external_path_.isAbsolute(rel));
|
|
134593
|
+
};
|
|
134594
|
+
const packageJsonPathFromProject = await (0, package_json.cy)(external_path_.join(projectPath, 'manifest.json'));
|
|
134595
|
+
const packageJsonDirFromProject = packageJsonPathFromProject ? external_path_.dirname(packageJsonPathFromProject) : void 0;
|
|
134596
|
+
const rootManifestPath = external_path_.join(projectPath, 'manifest.json');
|
|
134597
|
+
const srcManifestPath = external_path_.join(projectPath, 'src', 'manifest.json');
|
|
134598
|
+
let manifestPath = external_fs_.existsSync(srcManifestPath) ? srcManifestPath : rootManifestPath;
|
|
133972
134599
|
if (!external_fs_.existsSync(manifestPath)) {
|
|
134600
|
+
if (packageJsonDirFromProject) throw new Error(messages.dx(manifestPath));
|
|
133973
134601
|
const findManifest = (dir)=>{
|
|
133974
134602
|
const files = external_fs_.readdirSync(dir, {
|
|
133975
134603
|
withFileTypes: true
|
|
133976
134604
|
});
|
|
133977
134605
|
for (const file of files){
|
|
133978
134606
|
if (file.isFile() && 'manifest.json' === file.name) return external_path_.join(dir, file.name);
|
|
133979
|
-
if (file.isDirectory() && !file.name.startsWith('.') && 'node_modules' !== file.name && 'dist' !== file.name) {
|
|
134607
|
+
if (file.isDirectory() && !file.name.startsWith('.') && 'node_modules' !== file.name && 'dist' !== file.name && 'public' !== file.name) {
|
|
133980
134608
|
const found = findManifest(external_path_.join(dir, file.name));
|
|
133981
134609
|
if (found) return found;
|
|
133982
134610
|
}
|
|
@@ -133987,8 +134615,19 @@ var __webpack_exports__ = {};
|
|
|
133987
134615
|
if (foundManifest) manifestPath = foundManifest;
|
|
133988
134616
|
else throw new Error(messages.dx(manifestPath));
|
|
133989
134617
|
}
|
|
133990
|
-
const packageJsonPath = await
|
|
133991
|
-
|
|
134618
|
+
const packageJsonPath = await (0, package_json.cy)(manifestPath);
|
|
134619
|
+
const packageJsonDir = packageJsonPath ? external_path_.dirname(packageJsonPath) : void 0;
|
|
134620
|
+
if (packageJsonDir) {
|
|
134621
|
+
const publicRoot = external_path_.join(packageJsonDir, 'public');
|
|
134622
|
+
if (isUnderDir(publicRoot, manifestPath)) {
|
|
134623
|
+
const fallbackSrc = external_path_.join(packageJsonDir, 'src', 'manifest.json');
|
|
134624
|
+
const fallbackRoot = external_path_.join(packageJsonDir, 'manifest.json');
|
|
134625
|
+
if (external_fs_.existsSync(fallbackSrc)) manifestPath = fallbackSrc;
|
|
134626
|
+
else if (external_fs_.existsSync(fallbackRoot)) manifestPath = fallbackRoot;
|
|
134627
|
+
else throw new Error(messages.dx(fallbackRoot));
|
|
134628
|
+
}
|
|
134629
|
+
}
|
|
134630
|
+
if (!packageJsonPath || !(0, package_json.t7)(packageJsonPath)) return {
|
|
133992
134631
|
manifestPath
|
|
133993
134632
|
};
|
|
133994
134633
|
return {
|
|
@@ -134455,6 +135094,8 @@ var __webpack_exports__ = {};
|
|
|
134455
135094
|
stdio
|
|
134456
135095
|
});
|
|
134457
135096
|
}
|
|
135097
|
+
var resolve_config = __webpack_require__("./webpack/feature-special-folders/folder-extensions/resolve-config.ts");
|
|
135098
|
+
var get_data = __webpack_require__("./webpack/feature-special-folders/get-data.ts");
|
|
134458
135099
|
async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
134459
135100
|
const require1 = (0, external_module_.createRequire)(__rslib_import_meta_url__);
|
|
134460
135101
|
const projectStructure = await getProjectStructure(pathOrRemoteUrl);
|
|
@@ -134483,21 +135124,29 @@ var __webpack_exports__ = {};
|
|
|
134483
135124
|
__webpack_require__.e("552").then(__webpack_require__.bind(__webpack_require__, "./webpack/webpack-lib/stats-handler.ts")),
|
|
134484
135125
|
Promise.all([
|
|
134485
135126
|
__webpack_require__.e("215"),
|
|
134486
|
-
__webpack_require__.e("
|
|
135127
|
+
__webpack_require__.e("535")
|
|
134487
135128
|
]).then(__webpack_require__.bind(__webpack_require__, "./webpack/webpack-config.ts"))
|
|
134488
135129
|
]);
|
|
134489
135130
|
const debug = isAuthor;
|
|
134490
135131
|
if (projectStructure.packageJsonPath) assertNoManagedDependencyConflicts(projectStructure.packageJsonPath, manifestDir);
|
|
134491
135132
|
const commandConfig = await (0, config_loader.eY)(manifestDir, 'build');
|
|
135133
|
+
const specialFoldersData = (0, get_data.H)(packageJsonDir);
|
|
134492
135134
|
const distPath = (0, webpack_lib_paths.q4)(packageJsonDir, browser);
|
|
134493
135135
|
if (debug) {
|
|
134494
135136
|
console.log(messages.SG(manifestDir, packageJsonDir));
|
|
134495
135137
|
console.log(messages._A(browser, buildOptions?.chromiumBinary, buildOptions?.geckoBinary || buildOptions?.firefoxBinary));
|
|
134496
135138
|
console.log(messages.AC(distPath));
|
|
134497
135139
|
}
|
|
135140
|
+
const mergedExtensionsConfig = buildOptions?.extensions ?? commandConfig.extensions ?? specialFoldersData.extensions;
|
|
135141
|
+
const resolvedExtensionsConfig = await (0, resolve_config.R)({
|
|
135142
|
+
projectRoot: packageJsonDir,
|
|
135143
|
+
browser,
|
|
135144
|
+
config: mergedExtensionsConfig
|
|
135145
|
+
});
|
|
134498
135146
|
const baseConfig = webpackConfig(projectStructure, {
|
|
134499
135147
|
...commandConfig,
|
|
134500
135148
|
...buildOptions,
|
|
135149
|
+
extensions: resolvedExtensionsConfig,
|
|
134501
135150
|
browser,
|
|
134502
135151
|
mode: 'production',
|
|
134503
135152
|
output: {
|
|
@@ -134613,7 +135262,7 @@ var __webpack_exports__ = {};
|
|
|
134613
135262
|
if ('true' === process.env.EXTENSION_DEV_DRY_RUN) return;
|
|
134614
135263
|
const { devServer } = await Promise.all([
|
|
134615
135264
|
__webpack_require__.e("215"),
|
|
134616
|
-
__webpack_require__.e("
|
|
135265
|
+
__webpack_require__.e("535"),
|
|
134617
135266
|
__webpack_require__.e("928")
|
|
134618
135267
|
]).then(__webpack_require__.bind(__webpack_require__, "./webpack/dev-server/index.ts"));
|
|
134619
135268
|
await devServer(projectStructure, {
|
|
@@ -134628,7 +135277,61 @@ var __webpack_exports__ = {};
|
|
|
134628
135277
|
}
|
|
134629
135278
|
}
|
|
134630
135279
|
var sanitize = __webpack_require__("./webpack/webpack-lib/sanitize.ts");
|
|
134631
|
-
var
|
|
135280
|
+
var utils = __webpack_require__("./webpack/feature-special-folders/folder-extensions/utils.ts");
|
|
135281
|
+
function resolveCompanionExtensionDirs(opts) {
|
|
135282
|
+
const { projectRoot, config } = opts;
|
|
135283
|
+
const normalized = (0, utils.cz)(config);
|
|
135284
|
+
const explicitPaths = normalized.paths;
|
|
135285
|
+
const scanDir = normalized.dir;
|
|
135286
|
+
const found = [];
|
|
135287
|
+
for (const p of explicitPaths){
|
|
135288
|
+
const abs = (0, utils.A$)(projectRoot, p);
|
|
135289
|
+
if ((0, utils.Uy)(abs)) found.push(abs);
|
|
135290
|
+
}
|
|
135291
|
+
if (scanDir) {
|
|
135292
|
+
const absScan = (0, utils.A$)(projectRoot, scanDir);
|
|
135293
|
+
if ((0, utils.Q7)(absScan)) {
|
|
135294
|
+
let entries = [];
|
|
135295
|
+
try {
|
|
135296
|
+
entries = external_fs_.readdirSync(absScan, {
|
|
135297
|
+
withFileTypes: true
|
|
135298
|
+
});
|
|
135299
|
+
} catch {
|
|
135300
|
+
entries = [];
|
|
135301
|
+
}
|
|
135302
|
+
const scanOneLevel = (rootDir)=>{
|
|
135303
|
+
let dirEntries = [];
|
|
135304
|
+
try {
|
|
135305
|
+
dirEntries = external_fs_.readdirSync(rootDir, {
|
|
135306
|
+
withFileTypes: true
|
|
135307
|
+
});
|
|
135308
|
+
} catch {
|
|
135309
|
+
dirEntries = [];
|
|
135310
|
+
}
|
|
135311
|
+
for (const ent of dirEntries){
|
|
135312
|
+
if (!ent.isDirectory()) continue;
|
|
135313
|
+
if (ent.name.startsWith('.')) continue;
|
|
135314
|
+
const candidate = external_path_.join(rootDir, ent.name);
|
|
135315
|
+
if ((0, utils.Uy)(candidate)) found.push(candidate);
|
|
135316
|
+
}
|
|
135317
|
+
};
|
|
135318
|
+
scanOneLevel(absScan);
|
|
135319
|
+
if ('extensions' === external_path_.basename(absScan)) for (const ent of entries){
|
|
135320
|
+
if (!ent.isDirectory()) continue;
|
|
135321
|
+
if (ent.name.startsWith('.')) continue;
|
|
135322
|
+
const browserDir = external_path_.join(absScan, ent.name);
|
|
135323
|
+
scanOneLevel(browserDir);
|
|
135324
|
+
}
|
|
135325
|
+
}
|
|
135326
|
+
}
|
|
135327
|
+
const unique = [];
|
|
135328
|
+
const seen = new Set();
|
|
135329
|
+
for (const p of found)if (!seen.has(p)) {
|
|
135330
|
+
seen.add(p);
|
|
135331
|
+
unique.push(p);
|
|
135332
|
+
}
|
|
135333
|
+
return unique;
|
|
135334
|
+
}
|
|
134632
135335
|
var extensions_to_load = __webpack_require__("./webpack/webpack-lib/extensions-to-load.ts");
|
|
134633
135336
|
var dark_mode = __webpack_require__("./webpack/webpack-lib/dark-mode.ts");
|
|
134634
135337
|
var output_binaries_resolver = __webpack_require__("./webpack/plugin-browsers/browsers-lib/output-binaries-resolver.ts");
|
|
@@ -134731,12 +135434,20 @@ var __webpack_exports__ = {};
|
|
|
134731
135434
|
const safeBrowserConfig = (0, sanitize.a)(browserConfig);
|
|
134732
135435
|
const safeCommandConfig = (0, sanitize.a)(commandConfig);
|
|
134733
135436
|
const safePreviewOptions = (0, sanitize.a)(previewOptions);
|
|
135437
|
+
const specialFoldersData = (0, get_data.H)(packageJsonDir);
|
|
135438
|
+
const mergedExtensionsConfig = safePreviewOptions.extensions ?? safeCommandConfig.extensions ?? safeBrowserConfig.extensions ?? specialFoldersData.extensions;
|
|
135439
|
+
const resolvedExtensionsConfig = await (0, resolve_config.R)({
|
|
135440
|
+
projectRoot: packageJsonDir,
|
|
135441
|
+
browser,
|
|
135442
|
+
config: mergedExtensionsConfig
|
|
135443
|
+
});
|
|
134734
135444
|
const mergedGeckoBinary = safePreviewOptions.geckoBinary || safePreviewOptions.firefoxBinary || safeCommandConfig.geckoBinary || safeCommandConfig.firefoxBinary || safeBrowserConfig.geckoBinary || safeBrowserConfig.firefoxBinary;
|
|
134735
135445
|
const mergedChromiumBinary = safePreviewOptions.chromiumBinary || safeCommandConfig.chromiumBinary || safeBrowserConfig.chromiumBinary;
|
|
134736
135446
|
const merged = {
|
|
134737
135447
|
...safeBrowserConfig,
|
|
134738
135448
|
...safeCommandConfig,
|
|
134739
135449
|
...safePreviewOptions,
|
|
135450
|
+
extensions: resolvedExtensionsConfig,
|
|
134740
135451
|
chromiumBinary: mergedChromiumBinary,
|
|
134741
135452
|
geckoBinary: mergedGeckoBinary
|
|
134742
135453
|
};
|
|
@@ -134745,7 +135456,7 @@ var __webpack_exports__ = {};
|
|
|
134745
135456
|
browserFlags: merged.browserFlags,
|
|
134746
135457
|
preferences: merged.preferences
|
|
134747
135458
|
});
|
|
134748
|
-
const companionUnpackedExtensionDirs = (
|
|
135459
|
+
const companionUnpackedExtensionDirs = resolveCompanionExtensionDirs({
|
|
134749
135460
|
projectRoot: packageJsonDir,
|
|
134750
135461
|
config: merged.extensions
|
|
134751
135462
|
});
|