extension-develop 3.16.1 → 3.17.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/dist/0~rspack-config.mjs +54 -33
- package/dist/946.mjs +1 -1
- package/package.json +2 -2
package/dist/0~rspack-config.mjs
CHANGED
|
@@ -4109,12 +4109,6 @@ function normalizeManifestFile(filePath) {
|
|
|
4109
4109
|
if (/[*?[\]{}]/.test(normalized)) return;
|
|
4110
4110
|
return normalized;
|
|
4111
4111
|
}
|
|
4112
|
-
function compilationHasAsset(compilation, filename) {
|
|
4113
|
-
if ('function' == typeof compilation.getAsset) {
|
|
4114
|
-
if (compilation.getAsset(filename)) return true;
|
|
4115
|
-
}
|
|
4116
|
-
return Boolean(compilation.assets?.[filename]);
|
|
4117
|
-
}
|
|
4118
4112
|
function collectRequiredManifestFiles(manifest) {
|
|
4119
4113
|
const required = new Set();
|
|
4120
4114
|
const addFile = (filePath)=>{
|
|
@@ -4133,12 +4127,10 @@ function collectRequiredManifestFiles(manifest) {
|
|
|
4133
4127
|
...required
|
|
4134
4128
|
];
|
|
4135
4129
|
}
|
|
4136
|
-
function
|
|
4137
|
-
const
|
|
4138
|
-
if (!
|
|
4139
|
-
|
|
4140
|
-
if (0 === requiredFiles.length) return true;
|
|
4141
|
-
return requiredFiles.every((filename)=>compilationHasAsset(compilation, filename));
|
|
4130
|
+
function findMissingFilesOnDisk(outputPath, required) {
|
|
4131
|
+
const missing = [];
|
|
4132
|
+
for (const relativeFile of required)if (!__rspack_external_fs.existsSync(__rspack_external_path.join(outputPath, relativeFile))) missing.push(relativeFile);
|
|
4133
|
+
return missing;
|
|
4142
4134
|
}
|
|
4143
4135
|
function writeFileAtomically(targetPath, content) {
|
|
4144
4136
|
const directory = __rspack_external_path.dirname(targetPath);
|
|
@@ -4151,32 +4143,61 @@ function writeFileAtomically(targetPath, content) {
|
|
|
4151
4143
|
}
|
|
4152
4144
|
class PersistManifestToDisk {
|
|
4153
4145
|
apply(compiler) {
|
|
4154
|
-
|
|
4146
|
+
let pendingManifestSource;
|
|
4147
|
+
let pendingOutputPath;
|
|
4148
|
+
let pendingHadErrors = false;
|
|
4149
|
+
compiler.hooks.thisCompilation.tap('manifest:persist-manifest:capture', (compilation)=>{
|
|
4155
4150
|
compilation.hooks.processAssets.tap({
|
|
4156
|
-
name: 'manifest:persist-manifest',
|
|
4151
|
+
name: 'manifest:persist-manifest:capture',
|
|
4157
4152
|
stage: core_Compilation.PROCESS_ASSETS_STAGE_REPORT + 1000
|
|
4158
4153
|
}, ()=>{
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
if (!outputPath) return;
|
|
4154
|
+
pendingHadErrors = compilation.errors.length > 0;
|
|
4155
|
+
pendingOutputPath = compilation.outputOptions.path || compiler.options.output?.path;
|
|
4162
4156
|
const manifestAsset = compilation.getAsset('manifest.json');
|
|
4163
4157
|
const manifestSource = getCurrentManifestContent(compilation) || manifestAsset?.source?.source?.().toString();
|
|
4164
|
-
|
|
4165
|
-
if (!isFinalManifestReadyForDisk(compilation, manifestSource)) return;
|
|
4166
|
-
const manifestOutputPath = __rspack_external_path.join(outputPath, 'manifest.json');
|
|
4167
|
-
try {
|
|
4168
|
-
try {
|
|
4169
|
-
const currentOnDisk = __rspack_external_fs.readFileSync(manifestOutputPath, 'utf-8');
|
|
4170
|
-
if (currentOnDisk === manifestSource) return;
|
|
4171
|
-
} catch {}
|
|
4172
|
-
writeFileAtomically(manifestOutputPath, manifestSource);
|
|
4173
|
-
} catch (error) {
|
|
4174
|
-
const err = new core.WebpackError(`Failed to persist manifest.json to disk: ${error.message}`);
|
|
4175
|
-
err.file = 'manifest.json';
|
|
4176
|
-
compilation.errors.push(err);
|
|
4177
|
-
}
|
|
4158
|
+
pendingManifestSource = 'string' == typeof manifestSource ? manifestSource : void 0;
|
|
4178
4159
|
});
|
|
4179
4160
|
});
|
|
4161
|
+
compiler.hooks.afterEmit.tap('manifest:persist-manifest:flush', (compilation)=>{
|
|
4162
|
+
const outputPath = pendingOutputPath;
|
|
4163
|
+
const manifestSource = pendingManifestSource;
|
|
4164
|
+
const hadErrors = pendingHadErrors;
|
|
4165
|
+
pendingManifestSource = void 0;
|
|
4166
|
+
pendingOutputPath = void 0;
|
|
4167
|
+
pendingHadErrors = false;
|
|
4168
|
+
if (hadErrors || !outputPath || !manifestSource) return;
|
|
4169
|
+
const manifest = readJsonSafe(manifestSource);
|
|
4170
|
+
if (!manifest) return;
|
|
4171
|
+
const requiredFiles = collectRequiredManifestFiles(manifest);
|
|
4172
|
+
const missingFiles = findMissingFilesOnDisk(outputPath, requiredFiles);
|
|
4173
|
+
if (missingFiles.length > 0) {
|
|
4174
|
+
const sample = missingFiles.slice(0, 5).join('\n - ');
|
|
4175
|
+
const more = missingFiles.length > 5 ? `\n ... and ${missingFiles.length - 5} more` : '';
|
|
4176
|
+
const err = new core.WebpackError([
|
|
4177
|
+
'manifest.json references files that were not emitted to disk for this build:',
|
|
4178
|
+
` - ${sample}${more}`,
|
|
4179
|
+
'',
|
|
4180
|
+
'The previous manifest.json was kept to avoid loading a broken extension.',
|
|
4181
|
+
'This usually means the bundler skipped a chunk during an incremental rebuild.',
|
|
4182
|
+
'Try saving any source file again, or restart `extension dev` if it persists.'
|
|
4183
|
+
].join('\n'));
|
|
4184
|
+
err.file = 'manifest.json';
|
|
4185
|
+
compilation.errors.push(err);
|
|
4186
|
+
return;
|
|
4187
|
+
}
|
|
4188
|
+
const manifestOutputPath = __rspack_external_path.join(outputPath, 'manifest.json');
|
|
4189
|
+
try {
|
|
4190
|
+
try {
|
|
4191
|
+
const currentOnDisk = __rspack_external_fs.readFileSync(manifestOutputPath, 'utf-8');
|
|
4192
|
+
if (currentOnDisk === manifestSource) return;
|
|
4193
|
+
} catch {}
|
|
4194
|
+
writeFileAtomically(manifestOutputPath, manifestSource);
|
|
4195
|
+
} catch (error) {
|
|
4196
|
+
const err = new core.WebpackError(`Failed to persist manifest.json to disk: ${error.message}`);
|
|
4197
|
+
err.file = 'manifest.json';
|
|
4198
|
+
compilation.errors.push(err);
|
|
4199
|
+
}
|
|
4200
|
+
});
|
|
4180
4201
|
}
|
|
4181
4202
|
}
|
|
4182
4203
|
class AddDependencies {
|
|
@@ -8699,9 +8720,9 @@ function webpackConfig(projectStructure, devOptions) {
|
|
|
8699
8720
|
clean: devOptions.output.clean,
|
|
8700
8721
|
path: primaryExtensionOutputDir,
|
|
8701
8722
|
publicPath: '/',
|
|
8702
|
-
filename: 'development' === (devOptions.mode || 'development') ? (pathData)=>{
|
|
8723
|
+
filename: 'development' === (devOptions.mode || 'development') && false !== devOptions.hashContentScripts ? (pathData)=>{
|
|
8703
8724
|
const chunkName = pathData.chunk?.name;
|
|
8704
|
-
if ('string' == typeof chunkName && /^content_scripts\/content-\d+$/.test(chunkName)) return `${chunkName}.[
|
|
8725
|
+
if ('string' == typeof chunkName && /^content_scripts\/content-\d+$/.test(chunkName)) return `${chunkName}.[contenthash:8].js`;
|
|
8705
8726
|
return '[name].js';
|
|
8706
8727
|
} : '[name].js',
|
|
8707
8728
|
hotUpdateChunkFilename: 'hot/[id].[fullhash].hot-update.js',
|
package/dist/946.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import * as __rspack_external_path from "path";
|
|
|
12
12
|
import * as __rspack_external_fs from "fs";
|
|
13
13
|
import * as __rspack_external_os from "os";
|
|
14
14
|
import * as __rspack_external_vm from "vm";
|
|
15
|
-
var package_namespaceObject = JSON.parse('{"rE":"3.
|
|
15
|
+
var package_namespaceObject = JSON.parse('{"rE":"3.17.0","El":{"@prefresh/core":"1.5.9","@prefresh/utils":"1.2.1","@rspack/core":"^2.0.1","@rspack/dev-server":"^2.0.1","@rspack/plugin-preact-refresh":"1.1.5","@rspack/plugin-react-refresh":"1.6.2","@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.3","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.2","loader-utils":"^3.3.1","magic-string":"^0.30.21","parse5-utilities":"^1.0.0","pintor":"0.3.0","postcss":"8.5.10","postcss-loader":"8.2.1","postcss-preset-env":"11.1.1","postcss-scss":"4.0.9","preact":"10.27.3","react-refresh":"0.18.0","sass-loader":"16.0.7","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"}}');
|
|
16
16
|
const fmt = {
|
|
17
17
|
heading: (title)=>pintor.underline(pintor.blue(title)),
|
|
18
18
|
label: (key)=>pintor.gray(key.toUpperCase()),
|
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"name": "extension-develop",
|
|
31
|
-
"version": "3.
|
|
31
|
+
"version": "3.17.0",
|
|
32
32
|
"description": "Develop, build, preview, and package Extension.js projects.",
|
|
33
33
|
"author": {
|
|
34
34
|
"name": "Cezar Augusto",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"@types/node": "^25.2.0",
|
|
130
130
|
"@types/sass-loader": "8.0.10",
|
|
131
131
|
"@types/webextension-polyfill": "0.12.4",
|
|
132
|
-
"svelte": "5.
|
|
132
|
+
"svelte": "5.55.9",
|
|
133
133
|
"tsup": "^8.5.1",
|
|
134
134
|
"typescript": "6.0.2",
|
|
135
135
|
"vitest": "^4.1.3",
|