extension-develop 2.0.0-rc.26 → 2.0.0-rc.28

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.
@@ -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(projectDir: string): string;
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 external_parse5_utils_namespaceObject = require("parse5-utils");
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
- const { childNodes = [] } = node;
54
- for (const childNode of childNodes)if ("script" === childNode.nodeName) {
55
- const src = external_parse5_utils_default().getAttribute(childNode, 'src');
56
- if (!src) continue;
57
- if (isUrl(src)) continue;
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' === childNode.nodeName) {
64
- const href = external_parse5_utils_default().getAttribute(childNode, 'href');
65
- const rel = external_parse5_utils_default().getAttribute(childNode, 'rel');
66
- if (!href) continue;
67
- if (isUrl(href)) continue;
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' === childNode.nodeName || 'area' === childNode.nodeName) {
78
- const href = external_parse5_utils_default().getAttribute(childNode, 'href');
79
- if (!href) continue;
80
- if (isUrl(href)) continue;
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' === childNode.nodeName || 'embed' === childNode.nodeName || 'iframe' === childNode.nodeName || 'img' === childNode.nodeName || 'input' === childNode.nodeName || 'source' === childNode.nodeName || 'track' === childNode.nodeName || 'video' === childNode.nodeName) {
87
- const src = external_parse5_utils_default().getAttribute(childNode, 'src');
88
- if (!src) continue;
89
- if (isUrl(src)) continue;
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
- } else parseHtml(childNode, onResourceFound);
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 = external_parse5_utils_default().parse(htmlString);
108
- const getAbsolutePath = (htmlFilePath, filePath)=>external_path_namespaceObject.join(external_path_namespaceObject.dirname(htmlFilePath), filePath.startsWith('/') ? external_path_namespaceObject.relative(external_path_namespaceObject.dirname(htmlFilePath), filePath) : filePath);
109
- for (const node of htmlDocument.childNodes)if ('html' === node.nodeName) {
110
- for (const childNode of node.childNodes)if ('head' === childNode.nodeName || 'body' === childNode.nodeName) parseHtml(childNode, ({ filePath, assetType })=>{
111
- const fileAbsolutePath = getAbsolutePath(htmlFilePath, filePath);
112
- switch(assetType){
113
- case "script":
114
- var _assets_js;
115
- null == (_assets_js = assets.js) || _assets_js.push(fileAbsolutePath);
116
- break;
117
- case 'css':
118
- var _assets_css;
119
- null == (_assets_css = assets.css) || _assets_css.push(fileAbsolutePath);
120
- break;
121
- case 'staticSrc':
122
- case 'staticHref':
123
- var _assets_static;
124
- if (filePath.startsWith('#')) break;
125
- null == (_assets_static = assets.static) || _assets_static.push(fileAbsolutePath);
126
- break;
127
- default:
128
- break;
129
- }
130
- });
131
- return {
132
- css: assets.css,
133
- js: assets.js,
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.26"
167
+ i8: "2.0.0-rc.28"
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")}`;
@@ -307,6 +307,11 @@ function defaultPortInUse(port) {
307
307
  function noExtensionIdError() {
308
308
  return `${getLoggingPrefix('manifest.json', 'error')} Extension ID Not Defined\n\nFor MAIN world content_scripts, the extension ID must be specified.\nEnsure your extension have a fixed ID and that the ${external_chalk_default().yellow('publicPath')}\nof your ${external_chalk_default().yellow('extension.config.js')} is defined as your extension URL.`;
309
309
  }
310
+ function isUsingCustomLoader(file) {
311
+ const loaderName = file.split('.').shift() || 'custom';
312
+ const capitalizedLoaderName = loaderName.charAt(0).toUpperCase() + loaderName.slice(1);
313
+ return `${getLoggingPrefix(capitalizedLoaderName, 'info')} Using custom loader configuration from ${file}`;
314
+ }
310
315
  function plugin_compilation_define_property(obj, key, value) {
311
316
  if (key in obj) Object.defineProperty(obj, key, {
312
317
  value: value,
@@ -1060,6 +1065,27 @@ async function maybeUseReact(projectPath) {
1060
1065
  };
1061
1066
  }
1062
1067
  const external_vue_loader_namespaceObject = require("vue-loader");
1068
+ let load_loader_options_userMessageDelivered = false;
1069
+ async function loadLoaderOptions(projectPath, framework) {
1070
+ const loaderPath = external_path_namespaceObject.join(projectPath, `${framework}.loader.js`);
1071
+ const moduleLoaderPath = external_path_namespaceObject.join(projectPath, `${framework}.loader.mjs`);
1072
+ if (external_fs_namespaceObject.existsSync(loaderPath) || external_fs_namespaceObject.existsSync(moduleLoaderPath)) {
1073
+ const configPath = external_fs_namespaceObject.existsSync(loaderPath) ? loaderPath : moduleLoaderPath;
1074
+ if (!load_loader_options_userMessageDelivered) {
1075
+ console.log(isUsingCustomLoader(`${framework}.loader.js`));
1076
+ load_loader_options_userMessageDelivered = true;
1077
+ }
1078
+ try {
1079
+ const module = await import(configPath);
1080
+ return module.default || module;
1081
+ } catch (err) {
1082
+ const error = err;
1083
+ console.error(`Error loading ${framework} loader options: ${error.message}`);
1084
+ throw err;
1085
+ }
1086
+ }
1087
+ return null;
1088
+ }
1063
1089
  let vue_userMessageDelivered = false;
1064
1090
  function isUsingVue(projectPath) {
1065
1091
  const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
@@ -1089,23 +1115,27 @@ async function maybeUseVue(projectPath) {
1089
1115
  console.log(youAreAllSet('Vue'));
1090
1116
  process.exit(0);
1091
1117
  }
1092
- const vueLoaders = [
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'));
1121
+ const defaultLoaders = [
1093
1122
  {
1094
1123
  test: /\.vue$/,
1095
1124
  loader: require.resolve('vue-loader'),
1096
1125
  options: {
1097
- experimentalInlineMatchResource: true
1126
+ experimentalInlineMatchResource: true,
1127
+ ...customOptions || {}
1098
1128
  },
1099
1129
  include: projectPath,
1100
1130
  exclude: /node_modules/
1101
1131
  }
1102
1132
  ];
1103
- const vuePlugins = [
1133
+ const defaultPlugins = [
1104
1134
  new external_vue_loader_namespaceObject.VueLoaderPlugin()
1105
1135
  ];
1106
1136
  return {
1107
- plugins: vuePlugins,
1108
- loaders: vueLoaders,
1137
+ plugins: defaultPlugins,
1138
+ loaders: defaultLoaders,
1109
1139
  alias: void 0
1110
1140
  };
1111
1141
  }
@@ -1197,7 +1227,10 @@ async function maybeUseSvelte(projectPath, mode) {
1197
1227
  console.log(youAreAllSet('Svelte'));
1198
1228
  process.exit(0);
1199
1229
  }
1200
- const svelteLoaders = [
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'));
1233
+ const defaultLoaders = [
1201
1234
  {
1202
1235
  test: /\.svelte\.ts$/,
1203
1236
  use: [
@@ -1216,7 +1249,8 @@ async function maybeUseSvelte(projectPath, mode) {
1216
1249
  dev: 'development' === mode,
1217
1250
  css: 'injected'
1218
1251
  },
1219
- hotReload: 'development' === mode
1252
+ hotReload: 'development' === mode,
1253
+ ...customOptions || {}
1220
1254
  }
1221
1255
  },
1222
1256
  include: projectPath,
@@ -1231,7 +1265,7 @@ async function maybeUseSvelte(projectPath, mode) {
1231
1265
  ];
1232
1266
  return {
1233
1267
  plugins: void 0,
1234
- loaders: svelteLoaders,
1268
+ loaders: defaultLoaders,
1235
1269
  alias: void 0
1236
1270
  };
1237
1271
  }
@@ -2239,8 +2273,7 @@ class ManifestPlugin {
2239
2273
  this.excludeList = options.excludeList;
2240
2274
  }
2241
2275
  }
2242
- const external_parse5_utils_namespaceObject = require("parse5-utils");
2243
- var external_parse5_utils_default = /*#__PURE__*/ __webpack_require__.n(external_parse5_utils_namespaceObject);
2276
+ const external_parse5_utilities_namespaceObject = require("parse5-utilities");
2244
2277
  function isUrl(src) {
2245
2278
  try {
2246
2279
  new URL(src);
@@ -2250,51 +2283,57 @@ function isUrl(src) {
2250
2283
  }
2251
2284
  }
2252
2285
  function parseHtml(node, onResourceFound) {
2253
- const { childNodes = [] } = node;
2254
- for (const childNode of childNodes)if ("script" === childNode.nodeName) {
2255
- const src = external_parse5_utils_default().getAttribute(childNode, 'src');
2256
- if (!src) continue;
2257
- if (isUrl(src)) continue;
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;
2258
2292
  onResourceFound({
2259
2293
  filePath: src,
2260
- childNode,
2294
+ childNode: node,
2261
2295
  assetType: "script"
2262
2296
  });
2263
- } else if ('link' === childNode.nodeName) {
2264
- const href = external_parse5_utils_default().getAttribute(childNode, 'href');
2265
- const rel = external_parse5_utils_default().getAttribute(childNode, 'rel');
2266
- if (!href) continue;
2267
- if (isUrl(href)) continue;
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;
2268
2303
  onResourceFound('dns-prefetch' === rel || 'icon' === rel || 'manifest' === rel || 'modulepreload' === rel || 'preconnect' === rel || 'prefetch' === rel || 'preload' === rel || 'prerender' === rel ? {
2269
2304
  filePath: href,
2270
- childNode,
2305
+ childNode: node,
2271
2306
  assetType: 'staticHref'
2272
2307
  } : {
2273
2308
  filePath: href,
2274
- childNode,
2309
+ childNode: node,
2275
2310
  assetType: 'css'
2276
2311
  });
2277
- } else if ('a' === childNode.nodeName || 'area' === childNode.nodeName) {
2278
- const href = external_parse5_utils_default().getAttribute(childNode, 'href');
2279
- if (!href) continue;
2280
- if (isUrl(href)) continue;
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;
2281
2317
  onResourceFound({
2282
2318
  filePath: href,
2283
- childNode,
2319
+ childNode: node,
2284
2320
  assetType: 'staticHref'
2285
2321
  });
2286
- } else if ('audio' === childNode.nodeName || 'embed' === childNode.nodeName || 'iframe' === childNode.nodeName || 'img' === childNode.nodeName || 'input' === childNode.nodeName || 'source' === childNode.nodeName || 'track' === childNode.nodeName || 'video' === childNode.nodeName) {
2287
- const src = external_parse5_utils_default().getAttribute(childNode, 'src');
2288
- if (!src) continue;
2289
- if (isUrl(src)) continue;
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;
2290
2327
  onResourceFound({
2291
2328
  filePath: src,
2292
- childNode,
2329
+ childNode: node,
2293
2330
  assetType: 'staticSrc'
2294
2331
  });
2295
- } else parseHtml(childNode, onResourceFound);
2332
+ }
2333
+ const { childNodes = [] } = node;
2334
+ for (const childNode of childNodes)if ('#comment' !== childNode.nodeName && '#text' !== childNode.nodeName) parseHtml(childNode, onResourceFound);
2296
2335
  }
2297
- function getAssetsFromHtml(htmlFilePath, htmlContent) {
2336
+ function getAssetsFromHtml(htmlFilePath, htmlContent, publicPath = 'public') {
2298
2337
  const assets = {
2299
2338
  css: [],
2300
2339
  js: [],
@@ -2304,36 +2343,33 @@ function getAssetsFromHtml(htmlFilePath, htmlContent) {
2304
2343
  const htmlString = htmlContent || external_fs_namespaceObject.readFileSync(htmlFilePath, {
2305
2344
  encoding: 'utf8'
2306
2345
  });
2307
- const htmlDocument = external_parse5_utils_default().parse(htmlString);
2308
- const getAbsolutePath = (htmlFilePath, filePath)=>external_path_namespaceObject.join(external_path_namespaceObject.dirname(htmlFilePath), filePath.startsWith('/') ? external_path_namespaceObject.relative(external_path_namespaceObject.dirname(htmlFilePath), filePath) : filePath);
2309
- for (const node of htmlDocument.childNodes)if ('html' === node.nodeName) {
2310
- for (const childNode of node.childNodes)if ('head' === childNode.nodeName || 'body' === childNode.nodeName) parseHtml(childNode, ({ filePath, assetType })=>{
2311
- const fileAbsolutePath = getAbsolutePath(htmlFilePath, filePath);
2312
- switch(assetType){
2313
- case "script":
2314
- var _assets_js;
2315
- null == (_assets_js = assets.js) || _assets_js.push(fileAbsolutePath);
2316
- break;
2317
- case 'css':
2318
- var _assets_css;
2319
- null == (_assets_css = assets.css) || _assets_css.push(fileAbsolutePath);
2320
- break;
2321
- case 'staticSrc':
2322
- case 'staticHref':
2323
- var _assets_static;
2324
- if (filePath.startsWith('#')) break;
2325
- null == (_assets_static = assets.static) || _assets_static.push(fileAbsolutePath);
2326
- break;
2327
- default:
2328
- break;
2329
- }
2330
- });
2331
- return {
2332
- css: assets.css,
2333
- js: assets.js,
2334
- static: assets.static
2335
- };
2336
- }
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;
2337
2373
  }
2338
2374
  function getHtmlPageDeclaredAssetPath(filepathList, filePath, extension) {
2339
2375
  const entryname = Object.keys(filepathList).find((key)=>{
@@ -2346,26 +2382,11 @@ function getHtmlPageDeclaredAssetPath(filepathList, filePath, extension) {
2346
2382
  return `/${entryname.replace(extname, '')}${extension}`;
2347
2383
  }
2348
2384
  function getExtname(filePath) {
2349
- const extname = external_path_namespaceObject.extname(filePath);
2350
- switch(extname){
2351
- case '.js':
2352
- case '.mjs':
2353
- case '.ts':
2354
- case '.tsx':
2355
- return '.js';
2356
- case '.css':
2357
- case '.scss':
2358
- case '.sass':
2359
- case '.less':
2360
- return '.css';
2361
- case '.html':
2362
- return '.html';
2363
- default:
2364
- return '.js';
2365
- }
2385
+ return external_path_namespaceObject.extname(filePath);
2366
2386
  }
2367
- function getFilePath(outputname, extension, isAbsolute) {
2368
- return isAbsolute ? `/${outputname}${extension}` : `${outputname}${extension}`;
2387
+ function getFilePath(filePath, extension, isPublic) {
2388
+ if (isPublic) return `/${filePath}${extension}`;
2389
+ return `${filePath}${extension}`;
2369
2390
  }
2370
2391
  function isFromIncludeList(filePath, includeList) {
2371
2392
  return Object.values(includeList || {}).some((value)=>value === filePath);
@@ -2402,7 +2423,7 @@ class EmitHtmlFile {
2402
2423
  const rawHtml = external_fs_namespaceObject.readFileSync(resource, 'utf8');
2403
2424
  if (!shouldExclude(resource, this.excludeList)) {
2404
2425
  const rawSource = new core_namespaceObject.sources.RawSource(rawHtml);
2405
- const filepath = getFilePath(featureName, '.html');
2426
+ const filepath = getFilePath(featureName, '.html', false);
2406
2427
  compilation.emitAsset(filepath, rawSource);
2407
2428
  }
2408
2429
  }
@@ -2434,15 +2455,14 @@ class AddAssetsToCompilation {
2434
2455
  compiler.hooks.thisCompilation.tap('html:add-assets-to-compilation', (compilation)=>{
2435
2456
  compilation.hooks.processAssets.tap({
2436
2457
  name: 'html:add-assets-to-compilation',
2437
- stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
2458
+ stage: core_namespaceObject.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
2438
2459
  }, ()=>{
2439
2460
  if (compilation.errors.length > 0) return;
2440
- const htmlFields = Object.entries(this.includeList || {});
2441
- for (const field of htmlFields){
2442
- const [feature, resource] = field;
2443
- const featureWithHtml = feature + '.html';
2461
+ const allEntries = this.includeList || {};
2462
+ for (const field of Object.entries(allEntries)){
2463
+ const [, resource] = field;
2444
2464
  if (resource) {
2445
- const compilationAsset = compilation.getAsset(featureWithHtml);
2465
+ const compilationAsset = compilation.getAsset(external_path_namespaceObject.basename(resource));
2446
2466
  if (compilationAsset) {
2447
2467
  var _getAssetsFromHtml;
2448
2468
  const htmlSource = compilationAsset.source.source().toString();
@@ -2450,35 +2470,41 @@ class AddAssetsToCompilation {
2450
2470
  const fileAssets = [
2451
2471
  ...new Set(staticAssets)
2452
2472
  ];
2453
- for (const asset of fileAssets)if (!asset.startsWith('/')) {
2454
- if (!external_fs_namespaceObject.existsSync(asset)) {
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)) {
2455
2477
  const FilepathListEntry = isFromIncludeList(asset, this.includeList);
2456
2478
  if (!FilepathListEntry) {
2457
2479
  if (!external_path_namespaceObject.basename(asset).startsWith('#')) {
2458
2480
  const errorMessage = fileNotFound(resource, asset);
2459
- if (!asset.startsWith('/')) compilation.warnings.push(new (core_default()).WebpackError(errorMessage));
2481
+ compilation.warnings.push(new (core_default()).WebpackError(errorMessage));
2460
2482
  return;
2461
2483
  }
2462
2484
  }
2463
2485
  }
2464
- const source = external_fs_namespaceObject.readFileSync(asset);
2486
+ const source = external_fs_namespaceObject.readFileSync(assetPath);
2465
2487
  const rawSource = new core_namespaceObject.sources.RawSource(source);
2466
- const filepath = external_path_namespaceObject.join('assets', external_path_namespaceObject.basename(asset));
2467
- if (!compilation.getAsset(filepath)) if (asset.endsWith('.html')) {
2468
- const htmlAssets = getAssetsFromHtml(asset);
2469
- const assetsFromHtml = [
2470
- ...(null == htmlAssets ? void 0 : htmlAssets.js) || [],
2471
- ...(null == htmlAssets ? void 0 : htmlAssets.css) || [],
2472
- ...(null == htmlAssets ? void 0 : htmlAssets.static) || []
2473
- ];
2474
- compilation.emitAsset(filepath, rawSource);
2475
- assetsFromHtml.forEach((assetFromHtml)=>{
2476
- const source = external_fs_namespaceObject.readFileSync(assetFromHtml);
2477
- const rawSource = new core_namespaceObject.sources.RawSource(source);
2478
- const filepath = external_path_namespaceObject.join('assets', external_path_namespaceObject.basename(assetFromHtml));
2479
- if (!compilation.getAsset(filepath)) compilation.emitAsset(filepath, rawSource);
2480
- });
2481
- } else compilation.emitAsset(filepath, rawSource);
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
+ }
2482
2508
  }
2483
2509
  }
2484
2510
  }
@@ -2489,8 +2515,10 @@ class AddAssetsToCompilation {
2489
2515
  constructor(options){
2490
2516
  add_assets_to_compilation_define_property(this, "manifestPath", void 0);
2491
2517
  add_assets_to_compilation_define_property(this, "includeList", void 0);
2518
+ add_assets_to_compilation_define_property(this, "excludeList", void 0);
2492
2519
  this.manifestPath = options.manifestPath;
2493
2520
  this.includeList = options.includeList;
2521
+ this.excludeList = options.excludeList;
2494
2522
  }
2495
2523
  }
2496
2524
  function add_scripts_and_styles_to_compilation_define_property(obj, key, value) {
@@ -2545,7 +2573,7 @@ function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
2545
2573
  const htmlFile = external_fs_namespaceObject.readFileSync(htmlEntry, {
2546
2574
  encoding: 'utf8'
2547
2575
  });
2548
- const htmlDocument = external_parse5_utils_default().parse(htmlFile);
2576
+ const htmlDocument = external_parse5_utilities_namespaceObject.parse(htmlFile);
2549
2577
  let hasCssEntry = !!compilation.getAsset(feature + '.css');
2550
2578
  let hasJsEntry = false;
2551
2579
  for (let node of htmlDocument.childNodes)if ('html' === node.nodeName) {
@@ -2557,30 +2585,32 @@ function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
2557
2585
  const isExcludedPath = shouldExclude(external_path_namespaceObject.resolve(htmlDir, filePath), excludeList);
2558
2586
  const excludedFilePath = external_path_namespaceObject.join('/', external_path_namespaceObject.normalize(filePath));
2559
2587
  const isFilepathListEntry = isFromFilepathList(absolutePath, includeList);
2588
+ let thisChildNode = childNode;
2560
2589
  switch(assetType){
2561
2590
  case "script":
2562
- if (isExcludedPath) node = external_parse5_utils_default().setAttribute(childNode, 'src', excludedFilePath);
2591
+ if (isExcludedPath) thisChildNode = external_parse5_utilities_namespaceObject.setAttribute(thisChildNode, 'src', excludedFilePath);
2563
2592
  else {
2564
- node = external_parse5_utils_default().remove(childNode);
2593
+ thisChildNode = external_parse5_utilities_namespaceObject.remove(thisChildNode);
2565
2594
  hasJsEntry = true;
2566
2595
  }
2567
2596
  break;
2568
2597
  case 'css':
2569
- if (isExcludedPath) node = external_parse5_utils_default().setAttribute(childNode, 'href', excludedFilePath);
2598
+ if (isExcludedPath) thisChildNode = external_parse5_utilities_namespaceObject.setAttribute(thisChildNode, 'href', excludedFilePath);
2570
2599
  else {
2571
- node = external_parse5_utils_default().remove(childNode);
2600
+ thisChildNode = external_parse5_utilities_namespaceObject.remove(thisChildNode);
2572
2601
  hasCssEntry = true;
2573
2602
  }
2574
2603
  break;
2575
2604
  case 'staticHref':
2576
2605
  case 'staticSrc':
2577
- if (isExcludedPath) node = external_parse5_utils_default().setAttribute(childNode, 'staticSrc' === assetType ? 'src' : 'href', excludedFilePath);
2606
+ if (isExcludedPath) thisChildNode = external_parse5_utilities_namespaceObject.setAttribute(thisChildNode, 'staticSrc' === assetType ? 'src' : 'href', excludedFilePath);
2578
2607
  else if (isFilepathListEntry) {
2579
2608
  const filepath = getHtmlPageDeclaredAssetPath(includeList, absolutePath, extname);
2580
- node = external_parse5_utils_default().setAttribute(childNode, 'staticSrc' === assetType ? 'src' : 'href', filepath);
2581
- } 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 {
2582
2612
  const filepath = external_path_namespaceObject.join('assets', external_path_namespaceObject.basename(absolutePath, extname));
2583
- if (external_fs_namespaceObject.existsSync(absolutePath)) node = external_parse5_utils_default().setAttribute(childNode, 'staticSrc' === assetType ? 'src' : 'href', getFilePath(filepath, '', true));
2613
+ if (external_fs_namespaceObject.existsSync(absolutePath)) thisChildNode = external_parse5_utilities_namespaceObject.setAttribute(thisChildNode, 'staticSrc' === assetType ? 'src' : 'href', getFilePath(filepath, '', true));
2584
2614
  }
2585
2615
  break;
2586
2616
  default:
@@ -2589,7 +2619,7 @@ function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
2589
2619
  });
2590
2620
  if ('head' === htmlChildNode.nodeName) {
2591
2621
  if (hasCssEntry) {
2592
- const linkTag = external_parse5_utils_default().createNode('link');
2622
+ const linkTag = external_parse5_utilities_namespaceObject.createNode('link');
2593
2623
  linkTag.attrs = [
2594
2624
  {
2595
2625
  name: 'rel',
@@ -2600,24 +2630,25 @@ function patchHtml(compilation, feature, htmlEntry, includeList, excludeList) {
2600
2630
  value: getFilePath(feature, '.css', true)
2601
2631
  }
2602
2632
  ];
2603
- external_parse5_utils_default().append(htmlChildNode, linkTag);
2633
+ external_parse5_utilities_namespaceObject.append(htmlChildNode, linkTag);
2604
2634
  }
2605
2635
  }
2606
2636
  if ('body' === htmlChildNode.nodeName) {
2607
2637
  if (hasJsEntry || 'production' !== compilation.options.mode) {
2608
- const scriptTag = external_parse5_utils_default().createNode("script");
2638
+ const scriptTag = external_parse5_utilities_namespaceObject.createNode("script");
2609
2639
  scriptTag.attrs = [
2610
2640
  {
2611
2641
  name: 'src',
2612
2642
  value: getFilePath(feature, '.js', true)
2613
2643
  }
2614
2644
  ];
2615
- external_parse5_utils_default().append(htmlChildNode, scriptTag);
2645
+ external_parse5_utilities_namespaceObject.append(htmlChildNode, scriptTag);
2616
2646
  }
2617
2647
  }
2618
2648
  }
2619
- return external_parse5_utils_default().serialize(htmlDocument);
2649
+ return external_parse5_utilities_namespaceObject.stringify(htmlDocument);
2620
2650
  }
2651
+ return '';
2621
2652
  }
2622
2653
  function update_html_file_define_property(obj, key, value) {
2623
2654
  if (key in obj) Object.defineProperty(obj, key, {
@@ -2644,8 +2675,8 @@ class UpdateHtmlFile {
2644
2675
  const updatedHtml = patchHtml(compilation, feature, resource, htmlEntries, this.excludeList || {});
2645
2676
  if (!shouldExclude(resource, this.excludeList)) {
2646
2677
  if (updatedHtml) {
2647
- const rawSource = new core_namespaceObject.sources.RawSource(updatedHtml);
2648
- const filepath = getFilePath(feature, '.html');
2678
+ const rawSource = new core_namespaceObject.sources.RawSource(updatedHtml.toString());
2679
+ const filepath = getFilePath(feature, '.html', false);
2649
2680
  compilation.updateAsset(filepath, rawSource);
2650
2681
  }
2651
2682
  }
@@ -3977,13 +4008,24 @@ function SetupFirefoxReloadClient(compiler, browser, manifestPath) {
3977
4008
  const external_content_security_policy_parser_namespaceObject = require("content-security-policy-parser");
3978
4009
  var external_content_security_policy_parser_default = /*#__PURE__*/ __webpack_require__.n(external_content_security_policy_parser_namespaceObject);
3979
4010
  function buildCSP(cspObject) {
3980
- let policy = '';
3981
- for(const directive in cspObject)policy += `${directive} ${cspObject[directive].join(' ')}; `;
3982
- return policy.trim();
4011
+ const directives = Object.entries(cspObject).map(([directive, values])=>`${directive} ${values.join(' ')}`);
4012
+ return directives.join('; ') + '; ';
3983
4013
  }
3984
4014
  function patchV2CSP(manifest) {
3985
4015
  let policy = manifest.content_security_policy;
3986
- if (!policy) return "script-src 'self' 'unsafe-eval' blob: filesystem:; object-src 'self' blob: filesystem:; ";
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
+ });
3987
4029
  const csp = external_content_security_policy_parser_default()(policy);
3988
4030
  if (csp.get("script-src")) {
3989
4031
  const scriptSrc = csp.get("script-src") || [];
@@ -3997,7 +4039,12 @@ function patchV2CSP(manifest) {
3997
4039
  'blob:',
3998
4040
  'filesystem:'
3999
4041
  ]);
4000
- if (!csp.get('object-src')) csp.set('object-src', [
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', [
4001
4048
  "'self'",
4002
4049
  'blob:',
4003
4050
  'filesystem:'
@@ -4008,7 +4055,14 @@ function patchV2CSP(manifest) {
4008
4055
  function patchV3CSP(manifest) {
4009
4056
  const policy = manifest.content_security_policy;
4010
4057
  if (!policy) return {
4011
- extension_pages: "script-src 'self'; object-src 'self';"
4058
+ extension_pages: buildCSP({
4059
+ "script-src": [
4060
+ "'self'"
4061
+ ],
4062
+ 'object-src': [
4063
+ "'self'"
4064
+ ]
4065
+ })
4012
4066
  };
4013
4067
  const csp = external_content_security_policy_parser_default()(policy.extension_pages || '');
4014
4068
  const defaultDirectives = {
@@ -4687,7 +4741,8 @@ const DEFAULT_BROWSER_FLAGS = [
4687
4741
  '--disable-features=OptimizationHints',
4688
4742
  '--disable-features=DialMediaRouteProvider',
4689
4743
  '--no-pings',
4690
- '--enable-features=SidePanelUpdates'
4744
+ '--enable-features=SidePanelUpdates',
4745
+ '--disable-features=DisableLoadExtensionCommandLineSwitch'
4691
4746
  ];
4692
4747
  function browser_config_browserConfig(configOptions) {
4693
4748
  const extensionsToLoad = Array.isArray(configOptions.extension) ? configOptions.extension : [
@@ -4857,8 +4912,7 @@ function commands_lib_messages_getLoggingPrefix(type) {
4857
4912
  function messages_manifestNotFoundError(manifestPath) {
4858
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)}`;
4859
4914
  }
4860
- function runningInProduction(projectDir) {
4861
- const outputPath = external_path_namespaceObject.join(projectDir, 'dist');
4915
+ function runningInProduction(outputPath) {
4862
4916
  const manifestPath = external_path_namespaceObject.join(outputPath, 'manifest.json');
4863
4917
  const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf-8'));
4864
4918
  const { name, version, hostPermissions, permissions } = manifest;
@@ -4995,6 +5049,9 @@ function installingDependenciesFailed(gitCommand, gitArgs, code) {
4995
5049
  function cantInstallDependencies(error) {
4996
5050
  return `${commands_lib_messages_getLoggingPrefix('error')} Can't install project dependencies. ${external_chalk_default().red(error.message || error.toString())}`;
4997
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
+ }
4998
5055
  async function loadConfigFile(configPath) {
4999
5056
  const absolutePath = external_path_namespaceObject.resolve(configPath);
5000
5057
  try {
@@ -5998,6 +6055,24 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
5998
6055
  }
5999
6056
  }
6000
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
+ }
6001
6076
  function closeAll(devServer) {
6002
6077
  devServer.stop().then(()=>{
6003
6078
  process.exit();
@@ -6014,13 +6089,21 @@ async function dev_server_devServer(projectPath, devOptions) {
6014
6089
  ...browserConfig,
6015
6090
  mode: 'development',
6016
6091
  output: {
6017
- clean: true
6092
+ clean: false
6018
6093
  }
6019
6094
  });
6020
6095
  const customWebpackConfig = await loadCustomWebpackConfig(projectPath);
6021
6096
  const finalConfig = customWebpackConfig(baseConfig);
6022
6097
  const compilerConfig = (0, external_webpack_merge_namespaceObject.merge)(finalConfig);
6023
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
+ }
6024
6107
  const serverConfig = {
6025
6108
  host: '127.0.0.1',
6026
6109
  allowedHosts: 'all',
@@ -6050,12 +6133,30 @@ async function dev_server_devServer(projectPath, devOptions) {
6050
6133
  headers: {
6051
6134
  'Access-Control-Allow-Origin': '*'
6052
6135
  },
6053
- port: devOptions.port || 'auto',
6054
- hot: true
6136
+ port,
6137
+ hot: true,
6138
+ webSocketServer: {
6139
+ type: 'ws',
6140
+ options: {
6141
+ port: 'number' == typeof port ? port : void 0
6142
+ }
6143
+ }
6055
6144
  };
6056
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
+ }
6057
6152
  devServer.startCallback((error)=>{
6058
- if (null != error) console.log(`Error in the Extension.js runner: ${error.stack || ''}`);
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
+ }
6059
6160
  });
6060
6161
  process.on('ERROR', ()=>{
6061
6162
  closeAll(devServer);
@@ -6159,7 +6260,7 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions) {
6159
6260
  colors: true
6160
6261
  }));
6161
6262
  process.exit(1);
6162
- } else console.log(runningInProduction(projectPath));
6263
+ } else console.log(runningInProduction(external_path_namespaceObject.join(projectPath, 'dist', browser)));
6163
6264
  });
6164
6265
  } catch (error) {
6165
6266
  if ('development' === process.env.EXTENSION_ENV) console.error(error);
@@ -52,3 +52,4 @@ export declare function certRequired(): string;
52
52
  export declare function defaultPortInUse(port: number): string;
53
53
  export declare function noExtensionIdError(): string;
54
54
  export declare function deprecatedShadowRoot(): string;
55
+ export declare function isUsingCustomLoader(file: string): string;
@@ -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: any;
4
+ childNode: ReturnType<typeof parse5utilities.createNode>;
4
5
  assetType: 'script' | 'css' | 'staticSrc' | 'staticHref';
5
6
  }
6
- export declare function parseHtml(node: any, onResourceFound: (options: OnResourceFoundOptions) => void): void;
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): any;
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 | undefined;
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): ".html" | ".js" | ".css";
10
- export declare function getFilePath(outputname: string, extension: string, isAbsolute?: boolean): string;
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
  }
@@ -0,0 +1 @@
1
+ export declare function loadLoaderOptions(projectPath: string, framework: 'vue' | 'svelte'): Promise<any>;
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "dist"
22
22
  ],
23
23
  "name": "extension-develop",
24
- "version": "2.0.0-rc.26",
24
+ "version": "2.0.0-rc.28",
25
25
  "description": "The develop step of Extension.js",
26
26
  "author": {
27
27
  "name": "Cezar Augusto",
@@ -49,13 +49,13 @@
49
49
  "firefox-location2": "1.0.0",
50
50
  "firefox-profile": "^4.7.0",
51
51
  "fx-runner": "^1.4.0",
52
- "go-git-it": "4.0.0-1",
52
+ "go-git-it": "4.0.0",
53
53
  "ignore": "^6.0.2",
54
54
  "loader-utils": "^3.3.1",
55
55
  "micromatch": "^4.0.8",
56
56
  "package-manager-detector": "^0.2.7",
57
57
  "parse5": "^7.2.1",
58
- "parse5-utils": "^2.0.0",
58
+ "parse5-utilities": "^1.0.0",
59
59
  "postcss": "^8.4.49",
60
60
  "preact": "^10.22.0",
61
61
  "progress": "^2.0.3",