extension-develop 2.0.0-rc.27 → 2.0.0-rc.29
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/commands/commands-lib/messages.d.ts +2 -1
- package/dist/ensure-hmr-for-scripts.js +59 -66
- package/dist/module.js +205 -134
- package/dist/webpack/plugin-extension/feature-html/__spec__/html-lib/test-utils.d.ts +18 -0
- package/dist/webpack/plugin-extension/feature-html/html-lib/parse-html.d.ts +3 -2
- package/dist/webpack/plugin-extension/feature-html/html-lib/patch-html.d.ts +1 -1
- package/dist/webpack/plugin-extension/feature-html/html-lib/utils.d.ts +3 -3
- package/dist/webpack/plugin-extension/feature-html/steps/add-assets-to-compilation.d.ts +1 -0
- package/package.json +2 -2
- package/dist/webpack/plugin-reload/steps/setup-reload-strategy/generate-reloader-extension.d.ts +0 -9
|
@@ -2,7 +2,7 @@ import { Manifest } from '../../types';
|
|
|
2
2
|
import { type DevOptions } from '../commands-lib/config-types';
|
|
3
3
|
export declare function manifestNotFoundError(manifestPath: string): string;
|
|
4
4
|
export declare function building(browser: DevOptions['browser']): string;
|
|
5
|
-
export declare function runningInProduction(
|
|
5
|
+
export declare function runningInProduction(outputPath: string): string;
|
|
6
6
|
export declare function ready(mode: DevOptions['mode'], browser: DevOptions['browser']): string;
|
|
7
7
|
export declare function previewing(browser: DevOptions['browser']): string;
|
|
8
8
|
export declare function previewWebpack(): string;
|
|
@@ -29,3 +29,4 @@ export declare function installingDependencies(): string;
|
|
|
29
29
|
export declare function installingDependenciesFailed(gitCommand: string, gitArgs: string[], code: number | null): string;
|
|
30
30
|
export declare function installingDependenciesProcessError(error: any): string;
|
|
31
31
|
export declare function cantInstallDependencies(error: any): string;
|
|
32
|
+
export declare function portInUse(requestedPort: number, newPort: number): string;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
3
|
(()=>{
|
|
13
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
14
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -39,8 +30,7 @@ const external_path_namespaceObject = require("path");
|
|
|
39
30
|
const external_fs_namespaceObject = require("fs");
|
|
40
31
|
const external_loader_utils_namespaceObject = require("loader-utils");
|
|
41
32
|
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
42
|
-
const
|
|
43
|
-
var external_parse5_utils_default = /*#__PURE__*/ __webpack_require__.n(external_parse5_utils_namespaceObject);
|
|
33
|
+
const external_parse5_utilities_namespaceObject = require("parse5-utilities");
|
|
44
34
|
function isUrl(src) {
|
|
45
35
|
try {
|
|
46
36
|
new URL(src);
|
|
@@ -50,51 +40,57 @@ function isUrl(src) {
|
|
|
50
40
|
}
|
|
51
41
|
}
|
|
52
42
|
function parseHtml(node, onResourceFound) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (
|
|
43
|
+
if ('#comment' === node.nodeName || '#text' === node.nodeName) return;
|
|
44
|
+
if ("script" === node.nodeName) {
|
|
45
|
+
var _node_attrs_find, _node_attrs;
|
|
46
|
+
const src = null == (_node_attrs = node.attrs) ? void 0 : null == (_node_attrs_find = _node_attrs.find((attr)=>'src' === attr.name)) ? void 0 : _node_attrs_find.value;
|
|
47
|
+
if (!src) return;
|
|
48
|
+
if (isUrl(src)) return;
|
|
58
49
|
onResourceFound({
|
|
59
50
|
filePath: src,
|
|
60
|
-
childNode,
|
|
51
|
+
childNode: node,
|
|
61
52
|
assetType: "script"
|
|
62
53
|
});
|
|
63
|
-
} else if ('link' ===
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
if (
|
|
54
|
+
} else if ('link' === node.nodeName) {
|
|
55
|
+
var _node_attrs_find1, _node_attrs1, _node_attrs_find2, _node_attrs2;
|
|
56
|
+
const href = null == (_node_attrs1 = node.attrs) ? void 0 : null == (_node_attrs_find1 = _node_attrs1.find((attr)=>'href' === attr.name)) ? void 0 : _node_attrs_find1.value;
|
|
57
|
+
const rel = null == (_node_attrs2 = node.attrs) ? void 0 : null == (_node_attrs_find2 = _node_attrs2.find((attr)=>'rel' === attr.name)) ? void 0 : _node_attrs_find2.value;
|
|
58
|
+
if (!href) return;
|
|
59
|
+
if (isUrl(href)) return;
|
|
68
60
|
onResourceFound('dns-prefetch' === rel || 'icon' === rel || 'manifest' === rel || 'modulepreload' === rel || 'preconnect' === rel || 'prefetch' === rel || 'preload' === rel || 'prerender' === rel ? {
|
|
69
61
|
filePath: href,
|
|
70
|
-
childNode,
|
|
62
|
+
childNode: node,
|
|
71
63
|
assetType: 'staticHref'
|
|
72
64
|
} : {
|
|
73
65
|
filePath: href,
|
|
74
|
-
childNode,
|
|
66
|
+
childNode: node,
|
|
75
67
|
assetType: 'css'
|
|
76
68
|
});
|
|
77
|
-
} else if ('a' ===
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (
|
|
69
|
+
} else if ('a' === node.nodeName || 'area' === node.nodeName) {
|
|
70
|
+
var _node_attrs_find3, _node_attrs3;
|
|
71
|
+
const href = null == (_node_attrs3 = node.attrs) ? void 0 : null == (_node_attrs_find3 = _node_attrs3.find((attr)=>'href' === attr.name)) ? void 0 : _node_attrs_find3.value;
|
|
72
|
+
if (!href) return;
|
|
73
|
+
if (isUrl(href)) return;
|
|
81
74
|
onResourceFound({
|
|
82
75
|
filePath: href,
|
|
83
|
-
childNode,
|
|
76
|
+
childNode: node,
|
|
84
77
|
assetType: 'staticHref'
|
|
85
78
|
});
|
|
86
|
-
} else if ('audio' ===
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (
|
|
79
|
+
} else if ('audio' === node.nodeName || 'embed' === node.nodeName || 'iframe' === node.nodeName || 'img' === node.nodeName || 'input' === node.nodeName || 'source' === node.nodeName || 'track' === node.nodeName || 'video' === node.nodeName) {
|
|
80
|
+
var _node_attrs_find4, _node_attrs4;
|
|
81
|
+
const src = null == (_node_attrs4 = node.attrs) ? void 0 : null == (_node_attrs_find4 = _node_attrs4.find((attr)=>'src' === attr.name)) ? void 0 : _node_attrs_find4.value;
|
|
82
|
+
if (!src) return;
|
|
83
|
+
if (isUrl(src)) return;
|
|
90
84
|
onResourceFound({
|
|
91
85
|
filePath: src,
|
|
92
|
-
childNode,
|
|
86
|
+
childNode: node,
|
|
93
87
|
assetType: 'staticSrc'
|
|
94
88
|
});
|
|
95
|
-
}
|
|
89
|
+
}
|
|
90
|
+
const { childNodes = [] } = node;
|
|
91
|
+
for (const childNode of childNodes)if ('#comment' !== childNode.nodeName && '#text' !== childNode.nodeName) parseHtml(childNode, onResourceFound);
|
|
96
92
|
}
|
|
97
|
-
function getAssetsFromHtml(htmlFilePath, htmlContent) {
|
|
93
|
+
function getAssetsFromHtml(htmlFilePath, htmlContent, publicPath = 'public') {
|
|
98
94
|
const assets = {
|
|
99
95
|
css: [],
|
|
100
96
|
js: [],
|
|
@@ -104,36 +100,33 @@ function getAssetsFromHtml(htmlFilePath, htmlContent) {
|
|
|
104
100
|
const htmlString = htmlContent || external_fs_namespaceObject.readFileSync(htmlFilePath, {
|
|
105
101
|
encoding: 'utf8'
|
|
106
102
|
});
|
|
107
|
-
const htmlDocument =
|
|
108
|
-
const getAbsolutePath = (htmlFilePath, filePath)=>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
static: assets.static
|
|
135
|
-
};
|
|
136
|
-
}
|
|
103
|
+
const htmlDocument = external_parse5_utilities_namespaceObject.parse(htmlString);
|
|
104
|
+
const getAbsolutePath = (htmlFilePath, filePath)=>{
|
|
105
|
+
if (filePath.startsWith('/')) return filePath;
|
|
106
|
+
return external_path_namespaceObject.join(external_path_namespaceObject.dirname(htmlFilePath), filePath);
|
|
107
|
+
};
|
|
108
|
+
parseHtml(htmlDocument, ({ filePath, assetType })=>{
|
|
109
|
+
const fileAbsolutePath = getAbsolutePath(htmlFilePath, filePath);
|
|
110
|
+
switch(assetType){
|
|
111
|
+
case "script":
|
|
112
|
+
var _assets_js;
|
|
113
|
+
null == (_assets_js = assets.js) || _assets_js.push(fileAbsolutePath);
|
|
114
|
+
break;
|
|
115
|
+
case 'css':
|
|
116
|
+
var _assets_css;
|
|
117
|
+
null == (_assets_css = assets.css) || _assets_css.push(fileAbsolutePath);
|
|
118
|
+
break;
|
|
119
|
+
case 'staticSrc':
|
|
120
|
+
case 'staticHref':
|
|
121
|
+
var _assets_static;
|
|
122
|
+
if (filePath.startsWith('#')) break;
|
|
123
|
+
null == (_assets_static = assets.static) || _assets_static.push(fileAbsolutePath);
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
return assets;
|
|
137
130
|
}
|
|
138
131
|
require("child_process");
|
|
139
132
|
require("package-manager-detector");
|
package/dist/module.js
CHANGED
|
@@ -164,7 +164,7 @@ const GECKO_BASED_BROWSERS = [
|
|
|
164
164
|
];
|
|
165
165
|
const external_console_namespaceObject = require("console");
|
|
166
166
|
var package_namespaceObject = {
|
|
167
|
-
i8: "2.0.0-rc.
|
|
167
|
+
i8: "2.0.0-rc.29"
|
|
168
168
|
};
|
|
169
169
|
function getLoggingPrefix(feature, type) {
|
|
170
170
|
if ('error' === type) return `${external_chalk_default().bold(external_chalk_default().red('ERROR'))} in ${feature} ${external_chalk_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
@@ -1116,6 +1116,8 @@ async function maybeUseVue(projectPath) {
|
|
|
1116
1116
|
process.exit(0);
|
|
1117
1117
|
}
|
|
1118
1118
|
const customOptions = await loadLoaderOptions(projectPath, 'vue');
|
|
1119
|
+
const vueLoaderPath = external_path_namespaceObject.join(projectPath, 'vue.loader.js');
|
|
1120
|
+
if (external_fs_namespaceObject.existsSync(vueLoaderPath)) console.log(isUsingIntegration('vue.loader.js'));
|
|
1119
1121
|
const defaultLoaders = [
|
|
1120
1122
|
{
|
|
1121
1123
|
test: /\.vue$/,
|
|
@@ -1226,6 +1228,8 @@ async function maybeUseSvelte(projectPath, mode) {
|
|
|
1226
1228
|
process.exit(0);
|
|
1227
1229
|
}
|
|
1228
1230
|
const customOptions = await loadLoaderOptions(projectPath, 'svelte');
|
|
1231
|
+
const svelteLoaderPath = external_path_namespaceObject.join(projectPath, 'svelte.loader.js');
|
|
1232
|
+
if (external_fs_namespaceObject.existsSync(svelteLoaderPath)) console.log(isUsingIntegration('svelte.loader.js'));
|
|
1229
1233
|
const defaultLoaders = [
|
|
1230
1234
|
{
|
|
1231
1235
|
test: /\.svelte\.ts$/,
|
|
@@ -2269,8 +2273,7 @@ class ManifestPlugin {
|
|
|
2269
2273
|
this.excludeList = options.excludeList;
|
|
2270
2274
|
}
|
|
2271
2275
|
}
|
|
2272
|
-
const
|
|
2273
|
-
var external_parse5_utils_default = /*#__PURE__*/ __webpack_require__.n(external_parse5_utils_namespaceObject);
|
|
2276
|
+
const external_parse5_utilities_namespaceObject = require("parse5-utilities");
|
|
2274
2277
|
function isUrl(src) {
|
|
2275
2278
|
try {
|
|
2276
2279
|
new URL(src);
|
|
@@ -2280,51 +2283,57 @@ function isUrl(src) {
|
|
|
2280
2283
|
}
|
|
2281
2284
|
}
|
|
2282
2285
|
function parseHtml(node, onResourceFound) {
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
if (
|
|
2286
|
+
if ('#comment' === node.nodeName || '#text' === node.nodeName) return;
|
|
2287
|
+
if ("script" === node.nodeName) {
|
|
2288
|
+
var _node_attrs_find, _node_attrs;
|
|
2289
|
+
const src = null == (_node_attrs = node.attrs) ? void 0 : null == (_node_attrs_find = _node_attrs.find((attr)=>'src' === attr.name)) ? void 0 : _node_attrs_find.value;
|
|
2290
|
+
if (!src) return;
|
|
2291
|
+
if (isUrl(src)) return;
|
|
2288
2292
|
onResourceFound({
|
|
2289
2293
|
filePath: src,
|
|
2290
|
-
childNode,
|
|
2294
|
+
childNode: node,
|
|
2291
2295
|
assetType: "script"
|
|
2292
2296
|
});
|
|
2293
|
-
} else if ('link' ===
|
|
2294
|
-
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
if (
|
|
2297
|
+
} else if ('link' === node.nodeName) {
|
|
2298
|
+
var _node_attrs_find1, _node_attrs1, _node_attrs_find2, _node_attrs2;
|
|
2299
|
+
const href = null == (_node_attrs1 = node.attrs) ? void 0 : null == (_node_attrs_find1 = _node_attrs1.find((attr)=>'href' === attr.name)) ? void 0 : _node_attrs_find1.value;
|
|
2300
|
+
const rel = null == (_node_attrs2 = node.attrs) ? void 0 : null == (_node_attrs_find2 = _node_attrs2.find((attr)=>'rel' === attr.name)) ? void 0 : _node_attrs_find2.value;
|
|
2301
|
+
if (!href) return;
|
|
2302
|
+
if (isUrl(href)) return;
|
|
2298
2303
|
onResourceFound('dns-prefetch' === rel || 'icon' === rel || 'manifest' === rel || 'modulepreload' === rel || 'preconnect' === rel || 'prefetch' === rel || 'preload' === rel || 'prerender' === rel ? {
|
|
2299
2304
|
filePath: href,
|
|
2300
|
-
childNode,
|
|
2305
|
+
childNode: node,
|
|
2301
2306
|
assetType: 'staticHref'
|
|
2302
2307
|
} : {
|
|
2303
2308
|
filePath: href,
|
|
2304
|
-
childNode,
|
|
2309
|
+
childNode: node,
|
|
2305
2310
|
assetType: 'css'
|
|
2306
2311
|
});
|
|
2307
|
-
} else if ('a' ===
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
if (
|
|
2312
|
+
} else if ('a' === node.nodeName || 'area' === node.nodeName) {
|
|
2313
|
+
var _node_attrs_find3, _node_attrs3;
|
|
2314
|
+
const href = null == (_node_attrs3 = node.attrs) ? void 0 : null == (_node_attrs_find3 = _node_attrs3.find((attr)=>'href' === attr.name)) ? void 0 : _node_attrs_find3.value;
|
|
2315
|
+
if (!href) return;
|
|
2316
|
+
if (isUrl(href)) return;
|
|
2311
2317
|
onResourceFound({
|
|
2312
2318
|
filePath: href,
|
|
2313
|
-
childNode,
|
|
2319
|
+
childNode: node,
|
|
2314
2320
|
assetType: 'staticHref'
|
|
2315
2321
|
});
|
|
2316
|
-
} else if ('audio' ===
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
if (
|
|
2322
|
+
} else if ('audio' === node.nodeName || 'embed' === node.nodeName || 'iframe' === node.nodeName || 'img' === node.nodeName || 'input' === node.nodeName || 'source' === node.nodeName || 'track' === node.nodeName || 'video' === node.nodeName) {
|
|
2323
|
+
var _node_attrs_find4, _node_attrs4;
|
|
2324
|
+
const src = null == (_node_attrs4 = node.attrs) ? void 0 : null == (_node_attrs_find4 = _node_attrs4.find((attr)=>'src' === attr.name)) ? void 0 : _node_attrs_find4.value;
|
|
2325
|
+
if (!src) return;
|
|
2326
|
+
if (isUrl(src)) return;
|
|
2320
2327
|
onResourceFound({
|
|
2321
2328
|
filePath: src,
|
|
2322
|
-
childNode,
|
|
2329
|
+
childNode: node,
|
|
2323
2330
|
assetType: 'staticSrc'
|
|
2324
2331
|
});
|
|
2325
|
-
}
|
|
2332
|
+
}
|
|
2333
|
+
const { childNodes = [] } = node;
|
|
2334
|
+
for (const childNode of childNodes)if ('#comment' !== childNode.nodeName && '#text' !== childNode.nodeName) parseHtml(childNode, onResourceFound);
|
|
2326
2335
|
}
|
|
2327
|
-
function getAssetsFromHtml(htmlFilePath, htmlContent) {
|
|
2336
|
+
function getAssetsFromHtml(htmlFilePath, htmlContent, publicPath = 'public') {
|
|
2328
2337
|
const assets = {
|
|
2329
2338
|
css: [],
|
|
2330
2339
|
js: [],
|
|
@@ -2334,36 +2343,33 @@ function getAssetsFromHtml(htmlFilePath, htmlContent) {
|
|
|
2334
2343
|
const htmlString = htmlContent || external_fs_namespaceObject.readFileSync(htmlFilePath, {
|
|
2335
2344
|
encoding: 'utf8'
|
|
2336
2345
|
});
|
|
2337
|
-
const htmlDocument =
|
|
2338
|
-
const getAbsolutePath = (htmlFilePath, filePath)=>
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
static: assets.static
|
|
2365
|
-
};
|
|
2366
|
-
}
|
|
2346
|
+
const htmlDocument = external_parse5_utilities_namespaceObject.parse(htmlString);
|
|
2347
|
+
const getAbsolutePath = (htmlFilePath, filePath)=>{
|
|
2348
|
+
if (filePath.startsWith('/')) return filePath;
|
|
2349
|
+
return external_path_namespaceObject.join(external_path_namespaceObject.dirname(htmlFilePath), filePath);
|
|
2350
|
+
};
|
|
2351
|
+
parseHtml(htmlDocument, ({ filePath, assetType })=>{
|
|
2352
|
+
const fileAbsolutePath = getAbsolutePath(htmlFilePath, filePath);
|
|
2353
|
+
switch(assetType){
|
|
2354
|
+
case "script":
|
|
2355
|
+
var _assets_js;
|
|
2356
|
+
null == (_assets_js = assets.js) || _assets_js.push(fileAbsolutePath);
|
|
2357
|
+
break;
|
|
2358
|
+
case 'css':
|
|
2359
|
+
var _assets_css;
|
|
2360
|
+
null == (_assets_css = assets.css) || _assets_css.push(fileAbsolutePath);
|
|
2361
|
+
break;
|
|
2362
|
+
case 'staticSrc':
|
|
2363
|
+
case 'staticHref':
|
|
2364
|
+
var _assets_static;
|
|
2365
|
+
if (filePath.startsWith('#')) break;
|
|
2366
|
+
null == (_assets_static = assets.static) || _assets_static.push(fileAbsolutePath);
|
|
2367
|
+
break;
|
|
2368
|
+
default:
|
|
2369
|
+
break;
|
|
2370
|
+
}
|
|
2371
|
+
});
|
|
2372
|
+
return assets;
|
|
2367
2373
|
}
|
|
2368
2374
|
function getHtmlPageDeclaredAssetPath(filepathList, filePath, extension) {
|
|
2369
2375
|
const entryname = Object.keys(filepathList).find((key)=>{
|
|
@@ -2376,26 +2382,11 @@ function getHtmlPageDeclaredAssetPath(filepathList, filePath, extension) {
|
|
|
2376
2382
|
return `/${entryname.replace(extname, '')}${extension}`;
|
|
2377
2383
|
}
|
|
2378
2384
|
function getExtname(filePath) {
|
|
2379
|
-
|
|
2380
|
-
switch(extname){
|
|
2381
|
-
case '.js':
|
|
2382
|
-
case '.mjs':
|
|
2383
|
-
case '.ts':
|
|
2384
|
-
case '.tsx':
|
|
2385
|
-
return '.js';
|
|
2386
|
-
case '.css':
|
|
2387
|
-
case '.scss':
|
|
2388
|
-
case '.sass':
|
|
2389
|
-
case '.less':
|
|
2390
|
-
return '.css';
|
|
2391
|
-
case '.html':
|
|
2392
|
-
return '.html';
|
|
2393
|
-
default:
|
|
2394
|
-
return '.js';
|
|
2395
|
-
}
|
|
2385
|
+
return external_path_namespaceObject.extname(filePath);
|
|
2396
2386
|
}
|
|
2397
|
-
function getFilePath(
|
|
2398
|
-
|
|
2387
|
+
function getFilePath(filePath, extension, isPublic) {
|
|
2388
|
+
if (isPublic) return `/${filePath}${extension}`;
|
|
2389
|
+
return `${filePath}${extension}`;
|
|
2399
2390
|
}
|
|
2400
2391
|
function isFromIncludeList(filePath, includeList) {
|
|
2401
2392
|
return Object.values(includeList || {}).some((value)=>value === filePath);
|
|
@@ -2432,7 +2423,7 @@ class EmitHtmlFile {
|
|
|
2432
2423
|
const rawHtml = external_fs_namespaceObject.readFileSync(resource, 'utf8');
|
|
2433
2424
|
if (!shouldExclude(resource, this.excludeList)) {
|
|
2434
2425
|
const rawSource = new core_namespaceObject.sources.RawSource(rawHtml);
|
|
2435
|
-
const filepath = getFilePath(featureName, '.html');
|
|
2426
|
+
const filepath = getFilePath(featureName, '.html', false);
|
|
2436
2427
|
compilation.emitAsset(filepath, rawSource);
|
|
2437
2428
|
}
|
|
2438
2429
|
}
|
|
@@ -2464,15 +2455,14 @@ class AddAssetsToCompilation {
|
|
|
2464
2455
|
compiler.hooks.thisCompilation.tap('html:add-assets-to-compilation', (compilation)=>{
|
|
2465
2456
|
compilation.hooks.processAssets.tap({
|
|
2466
2457
|
name: 'html:add-assets-to-compilation',
|
|
2467
|
-
stage: core_namespaceObject.Compilation.
|
|
2458
|
+
stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
2468
2459
|
}, ()=>{
|
|
2469
2460
|
if (compilation.errors.length > 0) return;
|
|
2470
|
-
const
|
|
2471
|
-
for (const field of
|
|
2472
|
-
const [
|
|
2473
|
-
const featureWithHtml = feature + '.html';
|
|
2461
|
+
const allEntries = this.includeList || {};
|
|
2462
|
+
for (const field of Object.entries(allEntries)){
|
|
2463
|
+
const [, resource] = field;
|
|
2474
2464
|
if (resource) {
|
|
2475
|
-
const compilationAsset = compilation.getAsset(
|
|
2465
|
+
const compilationAsset = compilation.getAsset(external_path_namespaceObject.basename(resource));
|
|
2476
2466
|
if (compilationAsset) {
|
|
2477
2467
|
var _getAssetsFromHtml;
|
|
2478
2468
|
const htmlSource = compilationAsset.source.source().toString();
|
|
@@ -2480,35 +2470,41 @@ class AddAssetsToCompilation {
|
|
|
2480
2470
|
const fileAssets = [
|
|
2481
2471
|
...new Set(staticAssets)
|
|
2482
2472
|
];
|
|
2483
|
-
for (const asset of fileAssets)
|
|
2484
|
-
|
|
2473
|
+
for (const asset of fileAssets){
|
|
2474
|
+
const isPublicPath = asset.startsWith('/');
|
|
2475
|
+
const assetPath = isPublicPath ? external_path_namespaceObject.posix.join('public', asset.slice(1)) : asset;
|
|
2476
|
+
if (!external_fs_namespaceObject.existsSync(assetPath)) {
|
|
2485
2477
|
const FilepathListEntry = isFromIncludeList(asset, this.includeList);
|
|
2486
2478
|
if (!FilepathListEntry) {
|
|
2487
2479
|
if (!external_path_namespaceObject.basename(asset).startsWith('#')) {
|
|
2488
2480
|
const errorMessage = fileNotFound(resource, asset);
|
|
2489
|
-
|
|
2481
|
+
compilation.warnings.push(new (core_default()).WebpackError(errorMessage));
|
|
2490
2482
|
return;
|
|
2491
2483
|
}
|
|
2492
2484
|
}
|
|
2493
2485
|
}
|
|
2494
|
-
const source = external_fs_namespaceObject.readFileSync(
|
|
2486
|
+
const source = external_fs_namespaceObject.readFileSync(assetPath);
|
|
2495
2487
|
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
2496
|
-
const filepath = external_path_namespaceObject.join('assets', external_path_namespaceObject.basename(asset));
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2488
|
+
const filepath = isPublicPath ? asset.slice(1) : external_path_namespaceObject.join('assets', external_path_namespaceObject.basename(asset));
|
|
2489
|
+
const isNestedHtml = asset.endsWith('.html');
|
|
2490
|
+
const nestedHtmlAsset = isNestedHtml ? compilation.getAsset(external_path_namespaceObject.basename(asset)) : null;
|
|
2491
|
+
if (!isFromIncludeList(asset, this.includeList) || nestedHtmlAsset) {
|
|
2492
|
+
if (!compilation.getAsset(filepath)) if (asset.endsWith('.html')) {
|
|
2493
|
+
const htmlAssets = getAssetsFromHtml(assetPath);
|
|
2494
|
+
const assetsFromHtml = [
|
|
2495
|
+
...(null == htmlAssets ? void 0 : htmlAssets.js) || [],
|
|
2496
|
+
...(null == htmlAssets ? void 0 : htmlAssets.css) || [],
|
|
2497
|
+
...(null == htmlAssets ? void 0 : htmlAssets.static) || []
|
|
2498
|
+
];
|
|
2499
|
+
compilation.emitAsset(filepath, rawSource);
|
|
2500
|
+
assetsFromHtml.forEach((assetFromHtml)=>{
|
|
2501
|
+
const source = external_fs_namespaceObject.readFileSync(assetFromHtml);
|
|
2502
|
+
const rawSource = new core_namespaceObject.sources.RawSource(source);
|
|
2503
|
+
const assetFilepath = external_path_namespaceObject.join('assets', external_path_namespaceObject.basename(assetFromHtml));
|
|
2504
|
+
if (!compilation.getAsset(assetFilepath)) compilation.emitAsset(assetFilepath, rawSource);
|
|
2505
|
+
});
|
|
2506
|
+
} else compilation.emitAsset(filepath, rawSource);
|
|
2507
|
+
}
|
|
2512
2508
|
}
|
|
2513
2509
|
}
|
|
2514
2510
|
}
|
|
@@ -2519,8 +2515,10 @@ class AddAssetsToCompilation {
|
|
|
2519
2515
|
constructor(options){
|
|
2520
2516
|
add_assets_to_compilation_define_property(this, "manifestPath", void 0);
|
|
2521
2517
|
add_assets_to_compilation_define_property(this, "includeList", void 0);
|
|
2518
|
+
add_assets_to_compilation_define_property(this, "excludeList", void 0);
|
|
2522
2519
|
this.manifestPath = options.manifestPath;
|
|
2523
2520
|
this.includeList = options.includeList;
|
|
2521
|
+
this.excludeList = options.excludeList;
|
|
2524
2522
|
}
|
|
2525
2523
|
}
|
|
2526
2524
|
function add_scripts_and_styles_to_compilation_define_property(obj, key, value) {
|
|
@@ -2575,7 +2573,7 @@ function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
|
|
|
2575
2573
|
const htmlFile = external_fs_namespaceObject.readFileSync(htmlEntry, {
|
|
2576
2574
|
encoding: 'utf8'
|
|
2577
2575
|
});
|
|
2578
|
-
const htmlDocument =
|
|
2576
|
+
const htmlDocument = external_parse5_utilities_namespaceObject.parse(htmlFile);
|
|
2579
2577
|
let hasCssEntry = !!compilation.getAsset(feature + '.css');
|
|
2580
2578
|
let hasJsEntry = false;
|
|
2581
2579
|
for (let node of htmlDocument.childNodes)if ('html' === node.nodeName) {
|
|
@@ -2587,30 +2585,32 @@ function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
|
|
|
2587
2585
|
const isExcludedPath = shouldExclude(external_path_namespaceObject.resolve(htmlDir, filePath), excludeList);
|
|
2588
2586
|
const excludedFilePath = external_path_namespaceObject.join('/', external_path_namespaceObject.normalize(filePath));
|
|
2589
2587
|
const isFilepathListEntry = isFromFilepathList(absolutePath, includeList);
|
|
2588
|
+
let thisChildNode = childNode;
|
|
2590
2589
|
switch(assetType){
|
|
2591
2590
|
case "script":
|
|
2592
|
-
if (isExcludedPath)
|
|
2591
|
+
if (isExcludedPath) thisChildNode = external_parse5_utilities_namespaceObject.setAttribute(thisChildNode, 'src', excludedFilePath);
|
|
2593
2592
|
else {
|
|
2594
|
-
|
|
2593
|
+
thisChildNode = external_parse5_utilities_namespaceObject.remove(thisChildNode);
|
|
2595
2594
|
hasJsEntry = true;
|
|
2596
2595
|
}
|
|
2597
2596
|
break;
|
|
2598
2597
|
case 'css':
|
|
2599
|
-
if (isExcludedPath)
|
|
2598
|
+
if (isExcludedPath) thisChildNode = external_parse5_utilities_namespaceObject.setAttribute(thisChildNode, 'href', excludedFilePath);
|
|
2600
2599
|
else {
|
|
2601
|
-
|
|
2600
|
+
thisChildNode = external_parse5_utilities_namespaceObject.remove(thisChildNode);
|
|
2602
2601
|
hasCssEntry = true;
|
|
2603
2602
|
}
|
|
2604
2603
|
break;
|
|
2605
2604
|
case 'staticHref':
|
|
2606
2605
|
case 'staticSrc':
|
|
2607
|
-
if (isExcludedPath)
|
|
2606
|
+
if (isExcludedPath) thisChildNode = external_parse5_utilities_namespaceObject.setAttribute(thisChildNode, 'staticSrc' === assetType ? 'src' : 'href', excludedFilePath);
|
|
2608
2607
|
else if (isFilepathListEntry) {
|
|
2609
2608
|
const filepath = getHtmlPageDeclaredAssetPath(includeList, absolutePath, extname);
|
|
2610
|
-
|
|
2611
|
-
} else
|
|
2609
|
+
thisChildNode = external_parse5_utilities_namespaceObject.setAttribute(thisChildNode, 'staticSrc' === assetType ? 'src' : 'href', filepath);
|
|
2610
|
+
} else if (filePath.startsWith('/')) thisChildNode = external_parse5_utilities_namespaceObject.setAttribute(thisChildNode, 'staticSrc' === assetType ? 'src' : 'href', filePath);
|
|
2611
|
+
else {
|
|
2612
2612
|
const filepath = external_path_namespaceObject.join('assets', external_path_namespaceObject.basename(absolutePath, extname));
|
|
2613
|
-
if (external_fs_namespaceObject.existsSync(absolutePath))
|
|
2613
|
+
if (external_fs_namespaceObject.existsSync(absolutePath)) thisChildNode = external_parse5_utilities_namespaceObject.setAttribute(thisChildNode, 'staticSrc' === assetType ? 'src' : 'href', getFilePath(filepath, '', true));
|
|
2614
2614
|
}
|
|
2615
2615
|
break;
|
|
2616
2616
|
default:
|
|
@@ -2619,7 +2619,7 @@ function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
|
|
|
2619
2619
|
});
|
|
2620
2620
|
if ('head' === htmlChildNode.nodeName) {
|
|
2621
2621
|
if (hasCssEntry) {
|
|
2622
|
-
const linkTag =
|
|
2622
|
+
const linkTag = external_parse5_utilities_namespaceObject.createNode('link');
|
|
2623
2623
|
linkTag.attrs = [
|
|
2624
2624
|
{
|
|
2625
2625
|
name: 'rel',
|
|
@@ -2630,24 +2630,25 @@ function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
|
|
|
2630
2630
|
value: getFilePath(feature, '.css', true)
|
|
2631
2631
|
}
|
|
2632
2632
|
];
|
|
2633
|
-
|
|
2633
|
+
external_parse5_utilities_namespaceObject.append(htmlChildNode, linkTag);
|
|
2634
2634
|
}
|
|
2635
2635
|
}
|
|
2636
2636
|
if ('body' === htmlChildNode.nodeName) {
|
|
2637
2637
|
if (hasJsEntry || 'production' !== compilation.options.mode) {
|
|
2638
|
-
const scriptTag =
|
|
2638
|
+
const scriptTag = external_parse5_utilities_namespaceObject.createNode("script");
|
|
2639
2639
|
scriptTag.attrs = [
|
|
2640
2640
|
{
|
|
2641
2641
|
name: 'src',
|
|
2642
2642
|
value: getFilePath(feature, '.js', true)
|
|
2643
2643
|
}
|
|
2644
2644
|
];
|
|
2645
|
-
|
|
2645
|
+
external_parse5_utilities_namespaceObject.append(htmlChildNode, scriptTag);
|
|
2646
2646
|
}
|
|
2647
2647
|
}
|
|
2648
2648
|
}
|
|
2649
|
-
return
|
|
2649
|
+
return external_parse5_utilities_namespaceObject.stringify(htmlDocument);
|
|
2650
2650
|
}
|
|
2651
|
+
return '';
|
|
2651
2652
|
}
|
|
2652
2653
|
function update_html_file_define_property(obj, key, value) {
|
|
2653
2654
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -2674,8 +2675,8 @@ class UpdateHtmlFile {
|
|
|
2674
2675
|
const updatedHtml = patchHtml(compilation, feature, resource, htmlEntries, this.excludeList || {});
|
|
2675
2676
|
if (!shouldExclude(resource, this.excludeList)) {
|
|
2676
2677
|
if (updatedHtml) {
|
|
2677
|
-
const rawSource = new core_namespaceObject.sources.RawSource(updatedHtml);
|
|
2678
|
-
const filepath = getFilePath(feature, '.html');
|
|
2678
|
+
const rawSource = new core_namespaceObject.sources.RawSource(updatedHtml.toString());
|
|
2679
|
+
const filepath = getFilePath(feature, '.html', false);
|
|
2679
2680
|
compilation.updateAsset(filepath, rawSource);
|
|
2680
2681
|
}
|
|
2681
2682
|
}
|
|
@@ -4007,13 +4008,24 @@ function SetupFirefoxReloadClient(compiler, browser, manifestPath) {
|
|
|
4007
4008
|
const external_content_security_policy_parser_namespaceObject = require("content-security-policy-parser");
|
|
4008
4009
|
var external_content_security_policy_parser_default = /*#__PURE__*/ __webpack_require__.n(external_content_security_policy_parser_namespaceObject);
|
|
4009
4010
|
function buildCSP(cspObject) {
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
return policy.trim();
|
|
4011
|
+
const directives = Object.entries(cspObject).map(([directive, values])=>`${directive} ${values.join(' ')}`);
|
|
4012
|
+
return directives.join('; ') + '; ';
|
|
4013
4013
|
}
|
|
4014
4014
|
function patchV2CSP(manifest) {
|
|
4015
4015
|
let policy = manifest.content_security_policy;
|
|
4016
|
-
if (!policy) return
|
|
4016
|
+
if (!policy) return buildCSP({
|
|
4017
|
+
"script-src": [
|
|
4018
|
+
"'self'",
|
|
4019
|
+
"'unsafe-eval'",
|
|
4020
|
+
'blob:',
|
|
4021
|
+
'filesystem:'
|
|
4022
|
+
],
|
|
4023
|
+
'object-src': [
|
|
4024
|
+
"'self'",
|
|
4025
|
+
'blob:',
|
|
4026
|
+
'filesystem:'
|
|
4027
|
+
]
|
|
4028
|
+
});
|
|
4017
4029
|
const csp = external_content_security_policy_parser_default()(policy);
|
|
4018
4030
|
if (csp.get("script-src")) {
|
|
4019
4031
|
const scriptSrc = csp.get("script-src") || [];
|
|
@@ -4027,7 +4039,12 @@ function patchV2CSP(manifest) {
|
|
|
4027
4039
|
'blob:',
|
|
4028
4040
|
'filesystem:'
|
|
4029
4041
|
]);
|
|
4030
|
-
if (
|
|
4042
|
+
if (csp.get('object-src')) {
|
|
4043
|
+
const objectSrc = csp.get('object-src') || [];
|
|
4044
|
+
if (!objectSrc.includes('blob:')) objectSrc.push('blob:');
|
|
4045
|
+
if (!objectSrc.includes('filesystem:')) objectSrc.push('filesystem:');
|
|
4046
|
+
csp.set('object-src', objectSrc);
|
|
4047
|
+
} else csp.set('object-src', [
|
|
4031
4048
|
"'self'",
|
|
4032
4049
|
'blob:',
|
|
4033
4050
|
'filesystem:'
|
|
@@ -4038,7 +4055,14 @@ function patchV2CSP(manifest) {
|
|
|
4038
4055
|
function patchV3CSP(manifest) {
|
|
4039
4056
|
const policy = manifest.content_security_policy;
|
|
4040
4057
|
if (!policy) return {
|
|
4041
|
-
extension_pages:
|
|
4058
|
+
extension_pages: buildCSP({
|
|
4059
|
+
"script-src": [
|
|
4060
|
+
"'self'"
|
|
4061
|
+
],
|
|
4062
|
+
'object-src': [
|
|
4063
|
+
"'self'"
|
|
4064
|
+
]
|
|
4065
|
+
})
|
|
4042
4066
|
};
|
|
4043
4067
|
const csp = external_content_security_policy_parser_default()(policy.extension_pages || '');
|
|
4044
4068
|
const defaultDirectives = {
|
|
@@ -4717,7 +4741,8 @@ const DEFAULT_BROWSER_FLAGS = [
|
|
|
4717
4741
|
'--disable-features=OptimizationHints',
|
|
4718
4742
|
'--disable-features=DialMediaRouteProvider',
|
|
4719
4743
|
'--no-pings',
|
|
4720
|
-
'--enable-features=SidePanelUpdates'
|
|
4744
|
+
'--enable-features=SidePanelUpdates',
|
|
4745
|
+
'--disable-features=DisableLoadExtensionCommandLineSwitch'
|
|
4721
4746
|
];
|
|
4722
4747
|
function browser_config_browserConfig(configOptions) {
|
|
4723
4748
|
const extensionsToLoad = Array.isArray(configOptions.extension) ? configOptions.extension : [
|
|
@@ -4887,8 +4912,7 @@ function commands_lib_messages_getLoggingPrefix(type) {
|
|
|
4887
4912
|
function messages_manifestNotFoundError(manifestPath) {
|
|
4888
4913
|
return `${commands_lib_messages_getLoggingPrefix('error')} Manifest file not found.\n\nEnsure the path to your extension exists and try again.\n${external_chalk_default().red('NOT FOUND')} ${external_chalk_default().underline(manifestPath)}`;
|
|
4889
4914
|
}
|
|
4890
|
-
function runningInProduction(
|
|
4891
|
-
const outputPath = external_path_namespaceObject.join(projectDir, 'dist');
|
|
4915
|
+
function runningInProduction(outputPath) {
|
|
4892
4916
|
const manifestPath = external_path_namespaceObject.join(outputPath, 'manifest.json');
|
|
4893
4917
|
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf-8'));
|
|
4894
4918
|
const { name, version, hostPermissions, permissions } = manifest;
|
|
@@ -5025,6 +5049,9 @@ function installingDependenciesFailed(gitCommand, gitArgs, code) {
|
|
|
5025
5049
|
function cantInstallDependencies(error) {
|
|
5026
5050
|
return `${commands_lib_messages_getLoggingPrefix('error')} Can't install project dependencies. ${external_chalk_default().red(error.message || error.toString())}`;
|
|
5027
5051
|
}
|
|
5052
|
+
function portInUse(requestedPort, newPort) {
|
|
5053
|
+
return `${commands_lib_messages_getLoggingPrefix('warn')} Port ${external_chalk_default().yellow(requestedPort.toString())} is in use. Using port ${external_chalk_default().green(newPort.toString())} instead.`;
|
|
5054
|
+
}
|
|
5028
5055
|
async function loadConfigFile(configPath) {
|
|
5029
5056
|
const absolutePath = external_path_namespaceObject.resolve(configPath);
|
|
5030
5057
|
try {
|
|
@@ -6028,6 +6055,24 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
6028
6055
|
}
|
|
6029
6056
|
}
|
|
6030
6057
|
const dev_server_namespaceObject = require("@rspack/dev-server");
|
|
6058
|
+
function isPortInUse(port) {
|
|
6059
|
+
return new Promise((resolve)=>{
|
|
6060
|
+
const server = external_net_namespaceObject.createServer();
|
|
6061
|
+
server.once('error', ()=>{
|
|
6062
|
+
resolve(true);
|
|
6063
|
+
});
|
|
6064
|
+
server.once('listening', ()=>{
|
|
6065
|
+
server.close();
|
|
6066
|
+
resolve(false);
|
|
6067
|
+
});
|
|
6068
|
+
server.listen(port);
|
|
6069
|
+
});
|
|
6070
|
+
}
|
|
6071
|
+
async function findAvailablePort(startPort) {
|
|
6072
|
+
let port = startPort;
|
|
6073
|
+
while(await isPortInUse(port))port++;
|
|
6074
|
+
return port;
|
|
6075
|
+
}
|
|
6031
6076
|
function closeAll(devServer) {
|
|
6032
6077
|
devServer.stop().then(()=>{
|
|
6033
6078
|
process.exit();
|
|
@@ -6044,13 +6089,21 @@ async function dev_server_devServer(projectPath, devOptions) {
|
|
|
6044
6089
|
...browserConfig,
|
|
6045
6090
|
mode: 'development',
|
|
6046
6091
|
output: {
|
|
6047
|
-
clean:
|
|
6092
|
+
clean: false
|
|
6048
6093
|
}
|
|
6049
6094
|
});
|
|
6050
6095
|
const customWebpackConfig = await loadCustomWebpackConfig(projectPath);
|
|
6051
6096
|
const finalConfig = customWebpackConfig(baseConfig);
|
|
6052
6097
|
const compilerConfig = (0, external_webpack_merge_namespaceObject.merge)(finalConfig);
|
|
6053
6098
|
const compiler = (0, core_namespaceObject.rspack)(compilerConfig);
|
|
6099
|
+
let port = devOptions.port || 'auto';
|
|
6100
|
+
if ('number' == typeof port) {
|
|
6101
|
+
if (await isPortInUse(port)) {
|
|
6102
|
+
const newPort = await findAvailablePort(port + 1);
|
|
6103
|
+
console.log(portInUse(port, newPort));
|
|
6104
|
+
port = newPort;
|
|
6105
|
+
}
|
|
6106
|
+
}
|
|
6054
6107
|
const serverConfig = {
|
|
6055
6108
|
host: '127.0.0.1',
|
|
6056
6109
|
allowedHosts: 'all',
|
|
@@ -6080,12 +6133,30 @@ async function dev_server_devServer(projectPath, devOptions) {
|
|
|
6080
6133
|
headers: {
|
|
6081
6134
|
'Access-Control-Allow-Origin': '*'
|
|
6082
6135
|
},
|
|
6083
|
-
port
|
|
6084
|
-
hot: true
|
|
6136
|
+
port,
|
|
6137
|
+
hot: true,
|
|
6138
|
+
webSocketServer: {
|
|
6139
|
+
type: 'ws',
|
|
6140
|
+
options: {
|
|
6141
|
+
port: 'number' == typeof port ? port : void 0
|
|
6142
|
+
}
|
|
6143
|
+
}
|
|
6085
6144
|
};
|
|
6086
6145
|
const devServer = new dev_server_namespaceObject.RspackDevServer(serverConfig, compiler);
|
|
6146
|
+
if ('number' == typeof port) {
|
|
6147
|
+
var _compiler_options_plugins;
|
|
6148
|
+
null == (_compiler_options_plugins = compiler.options.plugins) || _compiler_options_plugins.forEach((plugin)=>{
|
|
6149
|
+
if (plugin && 'object' == typeof plugin && 'constructor' in plugin && 'ReloadPlugin' === plugin.constructor.name) plugin.port = port;
|
|
6150
|
+
});
|
|
6151
|
+
}
|
|
6087
6152
|
devServer.startCallback((error)=>{
|
|
6088
|
-
if (null != error)
|
|
6153
|
+
if (null != error) {
|
|
6154
|
+
if ('EADDRINUSE' === error.code) {
|
|
6155
|
+
console.log(portInUse(port, port + 1));
|
|
6156
|
+
process.exit(1);
|
|
6157
|
+
}
|
|
6158
|
+
console.log(`Error in the Extension.js runner: ${error.stack || ''}`);
|
|
6159
|
+
}
|
|
6089
6160
|
});
|
|
6090
6161
|
process.on('ERROR', ()=>{
|
|
6091
6162
|
closeAll(devServer);
|
|
@@ -6189,7 +6260,7 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions) {
|
|
|
6189
6260
|
colors: true
|
|
6190
6261
|
}));
|
|
6191
6262
|
process.exit(1);
|
|
6192
|
-
} else console.log(runningInProduction(projectPath));
|
|
6263
|
+
} else console.log(runningInProduction(external_path_namespaceObject.join(projectPath, 'dist', browser)));
|
|
6193
6264
|
});
|
|
6194
6265
|
} catch (error) {
|
|
6195
6266
|
if ('development' === process.env.EXTENSION_ENV) console.error(error);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface HtmlNode {
|
|
2
|
+
nodeName: string;
|
|
3
|
+
attrs: Array<{
|
|
4
|
+
name: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}>;
|
|
7
|
+
childNodes: HtmlNode[];
|
|
8
|
+
value?: string;
|
|
9
|
+
data?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createHtmlNode(options: Partial<HtmlNode>): HtmlNode;
|
|
12
|
+
export declare function createHtmlDocument(childNodes: HtmlNode[]): HtmlNode;
|
|
13
|
+
export declare function createScriptNode(src: string): HtmlNode;
|
|
14
|
+
export declare function createLinkNode(href: string, rel?: string): HtmlNode;
|
|
15
|
+
export declare function createImageNode(src: string): HtmlNode;
|
|
16
|
+
export declare function createAnchorNode(href: string): HtmlNode;
|
|
17
|
+
export declare function createCommentNode(text: string): HtmlNode;
|
|
18
|
+
export declare function createTextNode(text: string): HtmlNode;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import * as parse5utilities from 'parse5-utilities';
|
|
1
2
|
interface OnResourceFoundOptions {
|
|
2
3
|
filePath: string;
|
|
3
|
-
childNode:
|
|
4
|
+
childNode: ReturnType<typeof parse5utilities.createNode>;
|
|
4
5
|
assetType: 'script' | 'css' | 'staticSrc' | 'staticHref';
|
|
5
6
|
}
|
|
6
|
-
export declare function parseHtml(node:
|
|
7
|
+
export declare function parseHtml(node: ReturnType<typeof parse5utilities.createNode>, onResourceFound: (options: OnResourceFoundOptions) => void): void;
|
|
7
8
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Compilation } from '@rspack/core';
|
|
2
2
|
import { type FilepathList } from '../../../webpack-types';
|
|
3
|
-
export declare function patchHtml(compilation: Compilation, feature: string, htmlEntry: string, includeList: FilepathList, excludeList: FilepathList):
|
|
3
|
+
export declare function patchHtml(compilation: Compilation, feature: string, htmlEntry: string, includeList: FilepathList, excludeList: FilepathList): string;
|
|
@@ -4,8 +4,8 @@ export interface ParsedHtmlAsset {
|
|
|
4
4
|
js?: string[];
|
|
5
5
|
static?: string[];
|
|
6
6
|
}
|
|
7
|
-
export declare function getAssetsFromHtml(htmlFilePath: string | undefined, htmlContent?: string): ParsedHtmlAsset
|
|
7
|
+
export declare function getAssetsFromHtml(htmlFilePath: string | undefined, htmlContent?: string, publicPath?: string): ParsedHtmlAsset;
|
|
8
8
|
export declare function getHtmlPageDeclaredAssetPath(filepathList: FilepathList, filePath: string, extension: string): string;
|
|
9
|
-
export declare function getExtname(filePath: string):
|
|
10
|
-
export declare function getFilePath(
|
|
9
|
+
export declare function getExtname(filePath: string): string;
|
|
10
|
+
export declare function getFilePath(filePath: string, extension: string, isPublic: boolean): string;
|
|
11
11
|
export declare function isFromIncludeList(filePath: string, includeList?: FilepathList): boolean;
|
|
@@ -3,6 +3,7 @@ import { type FilepathList, type PluginInterface } from '../../../webpack-types'
|
|
|
3
3
|
export declare class AddAssetsToCompilation {
|
|
4
4
|
readonly manifestPath: string;
|
|
5
5
|
readonly includeList?: FilepathList;
|
|
6
|
+
readonly excludeList?: FilepathList;
|
|
6
7
|
constructor(options: PluginInterface);
|
|
7
8
|
apply(compiler: Compiler): void;
|
|
8
9
|
}
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"name": "extension-develop",
|
|
24
|
-
"version": "2.0.0-rc.
|
|
24
|
+
"version": "2.0.0-rc.29",
|
|
25
25
|
"description": "The develop step of Extension.js",
|
|
26
26
|
"author": {
|
|
27
27
|
"name": "Cezar Augusto",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"micromatch": "^4.0.8",
|
|
56
56
|
"package-manager-detector": "^0.2.7",
|
|
57
57
|
"parse5": "^7.2.1",
|
|
58
|
-
"parse5-
|
|
58
|
+
"parse5-utilities": "^1.0.0",
|
|
59
59
|
"postcss": "^8.4.49",
|
|
60
60
|
"preact": "^10.22.0",
|
|
61
61
|
"progress": "^2.0.3",
|
package/dist/webpack/plugin-reload/steps/setup-reload-strategy/generate-reloader-extension.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Compiler } from '@rspack/core';
|
|
2
|
-
import { type PluginInterface } from '../../reload-types';
|
|
3
|
-
export declare class GenerateReloaderExtension {
|
|
4
|
-
private readonly browser;
|
|
5
|
-
constructor(options: PluginInterface);
|
|
6
|
-
private copyRecursively;
|
|
7
|
-
private copyExtensionFiles;
|
|
8
|
-
apply(compiler: Compiler): void;
|
|
9
|
-
}
|