extension-develop 3.14.0 → 3.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/144.cjs
CHANGED
|
@@ -9066,7 +9066,7 @@ Set background.noDynamicEntryWarning to true to disable this warning.
|
|
|
9066
9066
|
minimize: 'production' === devOptions.mode,
|
|
9067
9067
|
sideEffects: true,
|
|
9068
9068
|
usedExports: 'global',
|
|
9069
|
-
concatenateModules:
|
|
9069
|
+
concatenateModules: 'production' === devOptions.mode,
|
|
9070
9070
|
splitChunks: false,
|
|
9071
9071
|
runtimeChunk: false,
|
|
9072
9072
|
moduleIds: 'deterministic',
|
|
@@ -68,6 +68,12 @@ function findNearestPackageJsonSync(manifestPath) {
|
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
const external_pintor_namespaceObject = require("pintor");
|
|
72
|
+
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_namespaceObject);
|
|
73
|
+
function reservedScriptsFolder(relPath, indicators) {
|
|
74
|
+
const reasons = indicators.map((r)=>`- ${external_pintor_default().gray(r)}`).join('\n');
|
|
75
|
+
return `${external_pintor_default().red('ERROR')} scripts/ is a reserved folder in Extension.js.\nEvery file under ${external_pintor_default().yellow("scripts/")} is wrapped with the browser content-script mount runtime, so Node.js-only files placed here will fail to parse or run.\nRename the folder at the project root (for example ${external_pintor_default().yellow('bin/')}, ${external_pintor_default().yellow('tools/')}, ${external_pintor_default().yellow('ops/')}, ${external_pintor_default().yellow('tasks/')}, or ${external_pintor_default().yellow("ci-scripts/")}) or move the file out of scripts/.\n\n${external_pintor_default().red('NODE.JS SHAPE')}\n${reasons}\n${external_pintor_default().red('NOT ALLOWED')} ${external_pintor_default().underline(relPath)}`;
|
|
76
|
+
}
|
|
71
77
|
const schema = {
|
|
72
78
|
type: 'object',
|
|
73
79
|
properties: {
|
|
@@ -100,6 +106,12 @@ function createBuildToken(source) {
|
|
|
100
106
|
for(let index = 0; index < source.length; index++)hash = 31 * hash + source.charCodeAt(index) >>> 0;
|
|
101
107
|
return hash.toString(16);
|
|
102
108
|
}
|
|
109
|
+
function detectNodeJsShapedScript(source) {
|
|
110
|
+
const indicators = [];
|
|
111
|
+
if ('string' == typeof source && source.startsWith('#!')) indicators.push('shebang on line 1 (#!/usr/bin/env node ...)');
|
|
112
|
+
if ('string' == typeof source && /(?:^|\n)\s*(?:import[^\n;]*?from\s*|import\s*\(\s*|require\s*\(\s*)["']node:[\w/-]+["']/m.test(source)) indicators.push("import from the 'node:' protocol");
|
|
113
|
+
return indicators;
|
|
114
|
+
}
|
|
103
115
|
function collectStyleAssetSpecifiers(source) {
|
|
104
116
|
const SAFE_SPECIFIER = /^[\w./@~\-?&=#+%]+$/;
|
|
105
117
|
const styleSpecifiers = new Set();
|
|
@@ -207,6 +219,13 @@ function contentScriptWrapper(source) {
|
|
|
207
219
|
const scriptsDir = external_path_default().resolve(packageJsonDir, "scripts");
|
|
208
220
|
const relToScripts = external_path_default().relative(scriptsDir, resourceAbsPath);
|
|
209
221
|
const isScriptsFolderScript = relToScripts && !relToScripts.startsWith('..') && !external_path_default().isAbsolute(relToScripts);
|
|
222
|
+
if (isScriptsFolderScript && !declaredEntry) {
|
|
223
|
+
const nodeIndicators = detectNodeJsShapedScript(rewrittenSource);
|
|
224
|
+
if (nodeIndicators.length > 0) {
|
|
225
|
+
const relFromProject = external_path_default().relative(packageJsonDir, resourceAbsPath).split(external_path_default().sep).join('/');
|
|
226
|
+
throw new Error(reservedScriptsFolder(relFromProject, nodeIndicators));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
210
229
|
const isContentScriptLike = Boolean(declaredEntry || isScriptsFolderScript);
|
|
211
230
|
if (!isContentScriptLike) return rewrittenSource;
|
|
212
231
|
const runAt = declaredEntry?.runAt || 'document_idle';
|
|
@@ -68,6 +68,12 @@ function findNearestPackageJsonSync(manifestPath) {
|
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
const external_pintor_namespaceObject = require("pintor");
|
|
72
|
+
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_namespaceObject);
|
|
73
|
+
function reservedScriptsFolder(relPath, indicators) {
|
|
74
|
+
const reasons = indicators.map((r)=>`- ${external_pintor_default().gray(r)}`).join('\n');
|
|
75
|
+
return `${external_pintor_default().red('ERROR')} scripts/ is a reserved folder in Extension.js.\nEvery file under ${external_pintor_default().yellow("scripts/")} is wrapped with the browser content-script mount runtime, so Node.js-only files placed here will fail to parse or run.\nRename the folder at the project root (for example ${external_pintor_default().yellow('bin/')}, ${external_pintor_default().yellow('tools/')}, ${external_pintor_default().yellow('ops/')}, ${external_pintor_default().yellow('tasks/')}, or ${external_pintor_default().yellow("ci-scripts/")}) or move the file out of scripts/.\n\n${external_pintor_default().red('NODE.JS SHAPE')}\n${reasons}\n${external_pintor_default().red('NOT ALLOWED')} ${external_pintor_default().underline(relPath)}`;
|
|
76
|
+
}
|
|
71
77
|
const schema = {
|
|
72
78
|
type: 'object',
|
|
73
79
|
properties: {
|
|
@@ -100,6 +106,12 @@ function createBuildToken(source) {
|
|
|
100
106
|
for(let index = 0; index < source.length; index++)hash = 31 * hash + source.charCodeAt(index) >>> 0;
|
|
101
107
|
return hash.toString(16);
|
|
102
108
|
}
|
|
109
|
+
function detectNodeJsShapedScript(source) {
|
|
110
|
+
const indicators = [];
|
|
111
|
+
if ('string' == typeof source && source.startsWith('#!')) indicators.push('shebang on line 1 (#!/usr/bin/env node ...)');
|
|
112
|
+
if ('string' == typeof source && /(?:^|\n)\s*(?:import[^\n;]*?from\s*|import\s*\(\s*|require\s*\(\s*)["']node:[\w/-]+["']/m.test(source)) indicators.push("import from the 'node:' protocol");
|
|
113
|
+
return indicators;
|
|
114
|
+
}
|
|
103
115
|
function collectStyleAssetSpecifiers(source) {
|
|
104
116
|
const SAFE_SPECIFIER = /^[\w./@~\-?&=#+%]+$/;
|
|
105
117
|
const styleSpecifiers = new Set();
|
|
@@ -207,6 +219,13 @@ function contentScriptWrapper(source) {
|
|
|
207
219
|
const scriptsDir = external_path_default().resolve(packageJsonDir, "scripts");
|
|
208
220
|
const relToScripts = external_path_default().relative(scriptsDir, resourceAbsPath);
|
|
209
221
|
const isScriptsFolderScript = relToScripts && !relToScripts.startsWith('..') && !external_path_default().isAbsolute(relToScripts);
|
|
222
|
+
if (isScriptsFolderScript && !declaredEntry) {
|
|
223
|
+
const nodeIndicators = detectNodeJsShapedScript(rewrittenSource);
|
|
224
|
+
if (nodeIndicators.length > 0) {
|
|
225
|
+
const relFromProject = external_path_default().relative(packageJsonDir, resourceAbsPath).split(external_path_default().sep).join('/');
|
|
226
|
+
throw new Error(reservedScriptsFolder(relFromProject, nodeIndicators));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
210
229
|
const isContentScriptLike = Boolean(declaredEntry || isScriptsFolderScript);
|
|
211
230
|
if (!isContentScriptLike) return rewrittenSource;
|
|
212
231
|
const runAt = declaredEntry?.runAt || 'document_idle';
|
package/dist/module.cjs
CHANGED
|
@@ -2216,7 +2216,7 @@ var __webpack_modules__ = {
|
|
|
2216
2216
|
module.exports = require("webpack-merge");
|
|
2217
2217
|
},
|
|
2218
2218
|
"./package.json" (module) {
|
|
2219
|
-
module.exports = JSON.parse('{"rE":"3.14.
|
|
2219
|
+
module.exports = JSON.parse('{"rE":"3.14.2","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^1.7.5","@rspack/dev-server":"^1.2.1","@rspack/plugin-preact-refresh":"1.1.4","@rspack/plugin-react-refresh":"1.6.0","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","@vue/compiler-sfc":"3.5.26","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","extension-from-store":"^0.1.1","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.5.1","less-loader":"12.3.0","loader-utils":"^3.3.1","magic-string":"^0.30.21","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.6","postcss-loader":"8.2.0","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"10.27.3","react-refresh":"0.18.0","sass-loader":"16.0.6","schema-utils":"^4.3.3","svelte-loader":"3.2.4","tiny-glob":"^0.2.9","typescript":"5.9.3","unique-names-generator":"^4.7.1","vue":"3.5.26","vue-loader":"17.4.2","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3"}}');
|
|
2220
2220
|
}
|
|
2221
2221
|
};
|
|
2222
2222
|
var __webpack_module_cache__ = {};
|
|
@@ -3008,6 +3008,7 @@ var __webpack_exports__ = {};
|
|
|
3008
3008
|
}
|
|
3009
3009
|
}
|
|
3010
3010
|
}
|
|
3011
|
+
var sanitize = __webpack_require__("./lib/sanitize.ts");
|
|
3011
3012
|
const external_node_events_namespaceObject = require("node:events");
|
|
3012
3013
|
function _define_property(obj, key, value) {
|
|
3013
3014
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -3123,47 +3124,7 @@ var __webpack_exports__ = {};
|
|
|
3123
3124
|
var typescript = __webpack_require__("./plugin-js-frameworks/js-tools/typescript.ts");
|
|
3124
3125
|
async function extensionDev(pathOrRemoteUrl, devOptions) {
|
|
3125
3126
|
let browsersPlugin;
|
|
3126
|
-
let emitter;
|
|
3127
|
-
if (devOptions.launcher && !devOptions.noBrowser) {
|
|
3128
|
-
browsersPlugin = new BrowsersPlugin({
|
|
3129
|
-
launcher: devOptions.launcher,
|
|
3130
|
-
browserOptions: {
|
|
3131
|
-
browser: devOptions.browser,
|
|
3132
|
-
mode: 'development',
|
|
3133
|
-
enableDevtools: true,
|
|
3134
|
-
noOpen: devOptions.noOpen,
|
|
3135
|
-
profile: devOptions.profile,
|
|
3136
|
-
persistProfile: devOptions.persistProfile,
|
|
3137
|
-
preferences: devOptions.preferences,
|
|
3138
|
-
browserFlags: devOptions.browserFlags,
|
|
3139
|
-
startingUrl: devOptions.startingUrl,
|
|
3140
|
-
chromiumBinary: devOptions.chromiumBinary,
|
|
3141
|
-
geckoBinary: devOptions.geckoBinary || devOptions.firefoxBinary,
|
|
3142
|
-
port: devOptions.port,
|
|
3143
|
-
source: devOptions.source,
|
|
3144
|
-
watchSource: devOptions.watchSource,
|
|
3145
|
-
sourceFormat: devOptions.sourceFormat,
|
|
3146
|
-
sourceSummary: devOptions.sourceSummary,
|
|
3147
|
-
sourceMeta: devOptions.sourceMeta,
|
|
3148
|
-
sourceProbe: devOptions.sourceProbe,
|
|
3149
|
-
sourceTree: devOptions.sourceTree,
|
|
3150
|
-
sourceConsole: devOptions.sourceConsole,
|
|
3151
|
-
sourceDom: devOptions.sourceDom,
|
|
3152
|
-
sourceMaxBytes: devOptions.sourceMaxBytes,
|
|
3153
|
-
sourceRedact: devOptions.sourceRedact,
|
|
3154
|
-
sourceIncludeShadow: devOptions.sourceIncludeShadow,
|
|
3155
|
-
sourceDiff: devOptions.sourceDiff,
|
|
3156
|
-
logLevel: devOptions.logLevel,
|
|
3157
|
-
logContexts: devOptions.logContexts,
|
|
3158
|
-
logFormat: devOptions.logFormat,
|
|
3159
|
-
logTimestamps: devOptions.logTimestamps,
|
|
3160
|
-
logColor: devOptions.logColor,
|
|
3161
|
-
logUrl: devOptions.logUrl,
|
|
3162
|
-
logTab: devOptions.logTab
|
|
3163
|
-
}
|
|
3164
|
-
});
|
|
3165
|
-
emitter = browsersPlugin.emitter;
|
|
3166
|
-
} else emitter = new BuildEmitter();
|
|
3127
|
+
let emitter = new BuildEmitter();
|
|
3167
3128
|
const projectStructure = await getProjectStructure(pathOrRemoteUrl);
|
|
3168
3129
|
try {
|
|
3169
3130
|
const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
@@ -3179,6 +3140,54 @@ var __webpack_exports__ = {};
|
|
|
3179
3140
|
console.log(messages.SG(manifestDir, packageJsonDir));
|
|
3180
3141
|
console.log(messages._A(browser, devOptions.chromiumBinary, geckoBinary));
|
|
3181
3142
|
}
|
|
3143
|
+
const browserConfig = await (0, config_loader.xY)(packageJsonDir, browser);
|
|
3144
|
+
const commandConfig = await (0, config_loader.eY)(packageJsonDir, 'dev');
|
|
3145
|
+
const merged = {
|
|
3146
|
+
...(0, sanitize.a)(browserConfig),
|
|
3147
|
+
...(0, sanitize.a)(commandConfig),
|
|
3148
|
+
...(0, sanitize.a)(devOptions)
|
|
3149
|
+
};
|
|
3150
|
+
if (devOptions.launcher && !devOptions.noBrowser) {
|
|
3151
|
+
browsersPlugin = new BrowsersPlugin({
|
|
3152
|
+
launcher: devOptions.launcher,
|
|
3153
|
+
browserOptions: {
|
|
3154
|
+
browser,
|
|
3155
|
+
mode: 'development',
|
|
3156
|
+
enableDevtools: true,
|
|
3157
|
+
noOpen: merged.noOpen,
|
|
3158
|
+
profile: merged.profile,
|
|
3159
|
+
persistProfile: merged.persistProfile,
|
|
3160
|
+
preferences: merged.preferences,
|
|
3161
|
+
browserFlags: merged.browserFlags,
|
|
3162
|
+
excludeBrowserFlags: merged.excludeBrowserFlags,
|
|
3163
|
+
startingUrl: merged.startingUrl,
|
|
3164
|
+
chromiumBinary: merged.chromiumBinary,
|
|
3165
|
+
geckoBinary: merged.geckoBinary || merged.firefoxBinary,
|
|
3166
|
+
port: merged.port,
|
|
3167
|
+
source: merged.source,
|
|
3168
|
+
watchSource: merged.watchSource,
|
|
3169
|
+
sourceFormat: merged.sourceFormat,
|
|
3170
|
+
sourceSummary: merged.sourceSummary,
|
|
3171
|
+
sourceMeta: merged.sourceMeta,
|
|
3172
|
+
sourceProbe: merged.sourceProbe,
|
|
3173
|
+
sourceTree: merged.sourceTree,
|
|
3174
|
+
sourceConsole: merged.sourceConsole,
|
|
3175
|
+
sourceDom: merged.sourceDom,
|
|
3176
|
+
sourceMaxBytes: merged.sourceMaxBytes,
|
|
3177
|
+
sourceRedact: merged.sourceRedact,
|
|
3178
|
+
sourceIncludeShadow: merged.sourceIncludeShadow,
|
|
3179
|
+
sourceDiff: merged.sourceDiff,
|
|
3180
|
+
logLevel: merged.logLevel,
|
|
3181
|
+
logContexts: merged.logContexts,
|
|
3182
|
+
logFormat: merged.logFormat,
|
|
3183
|
+
logTimestamps: merged.logTimestamps,
|
|
3184
|
+
logColor: merged.logColor,
|
|
3185
|
+
logUrl: merged.logUrl,
|
|
3186
|
+
logTab: merged.logTab
|
|
3187
|
+
}
|
|
3188
|
+
});
|
|
3189
|
+
emitter = browsersPlugin.emitter;
|
|
3190
|
+
}
|
|
3182
3191
|
if ('true' === process.env.EXTENSION_DEV_DRY_RUN) return emitter;
|
|
3183
3192
|
const { devServer } = await Promise.all([
|
|
3184
3193
|
__webpack_require__.e("144"),
|
|
@@ -3191,14 +3200,13 @@ var __webpack_exports__ = {};
|
|
|
3191
3200
|
geckoBinary,
|
|
3192
3201
|
browsersPlugin
|
|
3193
3202
|
});
|
|
3203
|
+
return emitter;
|
|
3194
3204
|
} catch (error) {
|
|
3195
3205
|
console.error(error);
|
|
3196
3206
|
process.exit(1);
|
|
3197
3207
|
}
|
|
3198
|
-
return emitter;
|
|
3199
3208
|
}
|
|
3200
3209
|
var plugin_playwright = __webpack_require__("./plugin-playwright/index.ts");
|
|
3201
|
-
var sanitize = __webpack_require__("./lib/sanitize.ts");
|
|
3202
3210
|
var utils = __webpack_require__("./plugin-special-folders/folder-extensions/utils.ts");
|
|
3203
3211
|
function resolveCompanionExtensionDirs(opts) {
|
|
3204
3212
|
const { projectRoot, config } = opts;
|
|
@@ -3285,7 +3293,7 @@ var __webpack_exports__ = {};
|
|
|
3285
3293
|
metadata.writeError('preview_manifest_missing', `Expected manifest at ${manifestAtOutput}`);
|
|
3286
3294
|
throw new Error(`Preview is run-only and does not compile.\nExpected an unpacked extension at:\n ${manifestAtOutput}\n\nRun \`extension build\` or \`extension dev\` first, or pass --output-path to an existing unpacked extension directory.`);
|
|
3287
3295
|
}
|
|
3288
|
-
const commandConfig = await (0, config_loader.eY)(packageJsonDir,
|
|
3296
|
+
const commandConfig = await (0, config_loader.eY)(packageJsonDir, metadataCommand);
|
|
3289
3297
|
const browserConfig = await (0, config_loader.xY)(packageJsonDir, browser);
|
|
3290
3298
|
console.log(messages.V_(browser));
|
|
3291
3299
|
if (previewOptions.noBrowser) {
|
package/dist/preview.cjs
CHANGED
|
@@ -150,7 +150,7 @@ var __webpack_modules__ = {
|
|
|
150
150
|
module.exports = require("pintor");
|
|
151
151
|
},
|
|
152
152
|
"./package.json" (module) {
|
|
153
|
-
module.exports = JSON.parse('{"rE":"3.14.
|
|
153
|
+
module.exports = JSON.parse('{"rE":"3.14.2","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^1.7.5","@rspack/dev-server":"^1.2.1","@rspack/plugin-preact-refresh":"1.1.4","@rspack/plugin-react-refresh":"1.6.0","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","@vue/compiler-sfc":"3.5.26","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","extension-from-store":"^0.1.1","go-git-it":"^5.1.5","ignore":"^7.0.5","less":"4.5.1","less-loader":"12.3.0","loader-utils":"^3.3.1","magic-string":"^0.30.21","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.6","postcss-loader":"8.2.0","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"10.27.3","react-refresh":"0.18.0","sass-loader":"16.0.6","schema-utils":"^4.3.3","svelte-loader":"3.2.4","tiny-glob":"^0.2.9","typescript":"5.9.3","unique-names-generator":"^4.7.1","vue":"3.5.26","vue-loader":"17.4.2","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3"}}');
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
var __webpack_module_cache__ = {};
|
|
@@ -1363,7 +1363,7 @@ var __webpack_exports__ = {};
|
|
|
1363
1363
|
metadata.writeError('preview_manifest_missing', `Expected manifest at ${manifestAtOutput}`);
|
|
1364
1364
|
throw new Error(`Preview is run-only and does not compile.\nExpected an unpacked extension at:\n ${manifestAtOutput}\n\nRun \`extension build\` or \`extension dev\` first, or pass --output-path to an existing unpacked extension directory.`);
|
|
1365
1365
|
}
|
|
1366
|
-
const commandConfig = await loadCommandConfig(packageJsonDir,
|
|
1366
|
+
const commandConfig = await loadCommandConfig(packageJsonDir, metadataCommand);
|
|
1367
1367
|
const browserConfig = await loadBrowserConfig(packageJsonDir, browser);
|
|
1368
1368
|
console.log(lib_messages.V_(browser));
|
|
1369
1369
|
if (previewOptions.noBrowser) {
|