extension-develop 3.9.0-next.1 → 3.9.0-next.3

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  exports.ids = [
3
- "928"
3
+ "324"
4
4
  ];
5
5
  exports.modules = {
6
6
  "./webpack/dev-server/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
@@ -11,107 +11,7 @@ exports.modules = {
11
11
  var core_ = __webpack_require__("@rspack/core");
12
12
  var dev_server_ = __webpack_require__("@rspack/dev-server");
13
13
  var external_webpack_merge_ = __webpack_require__("webpack-merge");
14
- var external_fs_ = __webpack_require__("fs");
15
- var external_pintor_ = __webpack_require__("pintor");
16
- var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
17
- function getLoggingPrefix(type) {
18
- const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
19
- if (isAuthor) {
20
- const base = 'error' === type ? 'ERROR Author says' : '►►► Author says';
21
- return external_pintor_default().brightMagenta(base);
22
- }
23
- if ('error' === type) return external_pintor_default().red('ERROR');
24
- if ('warn' === type) return external_pintor_default().brightYellow('►►►');
25
- if ('info' === type) return external_pintor_default().gray('►►►');
26
- return external_pintor_default().green('►►►');
27
- }
28
- function messages_ready(mode, browser) {
29
- const extensionOutput = 'firefox' === browser || 'gecko-based' === browser || 'edge' === browser ? 'Add-on' : 'Extension';
30
- const b = String(browser || '');
31
- const cap = b.charAt(0).toUpperCase() + b.slice(1);
32
- const pretty = external_pintor_default().green('ready for ' + mode);
33
- return `${getLoggingPrefix('info')} ${cap} ${extensionOutput} ${pretty}.`;
34
- }
35
- function readJsonRecord(filePath) {
36
- try {
37
- return JSON.parse(external_fs_.readFileSync(filePath, 'utf8'));
38
- } catch {
39
- return null;
40
- }
41
- }
42
- function capitalizeToken(value) {
43
- return value.split('-').filter(Boolean).map((token)=>token.charAt(0).toUpperCase() + token.slice(1)).join('-');
44
- }
45
- function getExtensionVersion() {
46
- return process.env.EXTENSION_DEVELOP_VERSION || process.env.EXTENSION_CLI_VERSION || (()=>{
47
- try {
48
- return __webpack_require__("./package.json").rE;
49
- } catch {
50
- return 'unknown';
51
- }
52
- })();
53
- }
54
- function browserRunnerDisabled(args) {
55
- const manifest = readJsonRecord(args.manifestPath);
56
- const ready = readJsonRecord(args.readyPath);
57
- const browserLabel = capitalizeToken(String(args.browser || 'unknown'));
58
- const runId = String(ready?.runId || '').trim();
59
- const pid = Number.isInteger(ready?.pid) ? String(ready?.pid) : '';
60
- const runLabel = runId ? `${external_pintor_default().gray(runId)}${pid ? ` · ${external_pintor_default().gray(`PID ${pid}`)}` : ''}` : pid ? external_pintor_default().gray(`PID ${pid}`) : external_pintor_default().gray('n/a');
61
- const extensionName = String(manifest?.name || 'Extension');
62
- const extensionVersion = String(manifest?.version || '').trim();
63
- const extensionLabel = extensionVersion ? `${extensionName} ${extensionVersion}` : extensionName;
64
- const extensionJsVersion = getExtensionVersion();
65
- return [
66
- ` 🧩 ${external_pintor_default().brightBlue('Extension.js')} ${external_pintor_default().gray(extensionJsVersion)}`,
67
- ` Browser ${external_pintor_default().gray(`${browserLabel} (build-only mode)`)}`,
68
- ` Extension ${external_pintor_default().gray(extensionLabel)}`,
69
- ` Run ID ${runLabel}`
70
- ].join('\n');
71
- }
72
- function portInUse(requestedPort, newPort) {
73
- return `Port: Requested port ${external_pintor_default().brightBlue(requestedPort.toString())} is in use; using ${external_pintor_default().brightBlue(newPort.toString())} instead.`;
74
- }
75
- function extensionJsRunnerError(error) {
76
- return `Extension.js Runner Error:\n${external_pintor_default().red(String(error))}`;
77
- }
78
- function autoExitModeEnabled(ms) {
79
- return `Auto-exit enabled. Will exit after ${external_pintor_default().brightBlue(ms.toString())} ms if idle.`;
80
- }
81
- function autoExitTriggered(ms) {
82
- return `Auto-exit triggered after ${external_pintor_default().brightBlue(ms.toString())} ms. Cleaning up...`;
83
- }
84
- function autoExitForceKill(ms) {
85
- return `Force-killing process after ${external_pintor_default().brightBlue(ms.toString())} ms to ensure exit.`;
86
- }
87
- function devServerStartTimeout(ms) {
88
- return [
89
- `Dev server startup is taking longer than expected (${external_pintor_default().brightBlue(ms.toString())} ms).`,
90
- "The bundler may have encountered an error before emitting the first build.",
91
- `If nothing else prints, try setting ${external_pintor_default().brightBlue('EXTENSION_VERBOSE=1')} for more logs.`
92
- ].join('\n');
93
- }
94
- function bundlerFatalError(error) {
95
- const text = error instanceof Error ? error.stack || error.message : String(error);
96
- return `Build failed to start:\n${external_pintor_default().red(text)}`;
97
- }
98
- function bundlerRecompiling() {
99
- return "Recompiling due to file changes…";
100
- }
101
- function noEntrypointsDetected(port) {
102
- return [
103
- "No entrypoints or assets were produced by the initial compilation.",
104
- `The dev server is running on 127.0.0.1:${external_pintor_default().brightBlue(port.toString())}, but nothing is being built.`,
105
- "Possible causes:",
106
- " • Empty or missing entry configuration.",
107
- " • Extension-related plugins are disabled (entries not derived from manifest).",
108
- " • All sources are ignored or excluded.",
109
- `Try enabling verbose logs with ${external_pintor_default().brightBlue('EXTENSION_VERBOSE=1')} or review your extension config.`
110
- ].join('\n');
111
- }
112
- function spacerLine() {
113
- return ' ';
114
- }
14
+ var messages = __webpack_require__("./webpack/dev-server/messages.ts");
115
15
  var external_crypto_ = __webpack_require__("crypto");
116
16
  var external_net_ = __webpack_require__("net");
117
17
  var shared_utils = __webpack_require__("./webpack/plugin-browsers/browsers-lib/shared-utils.ts");
@@ -188,6 +88,7 @@ exports.modules = {
188
88
  this.basePort = basePort;
189
89
  }
190
90
  }
91
+ var external_fs_ = __webpack_require__("fs");
191
92
  function hasDependency(projectPath, dependency) {
192
93
  const findNearestPackageJsonDirectory = (startPath)=>{
193
94
  let currentDirectory = startPath;
@@ -224,60 +125,7 @@ exports.modules = {
224
125
  var resolve_config = __webpack_require__("./webpack/feature-special-folders/folder-extensions/resolve-config.ts");
225
126
  var get_data = __webpack_require__("./webpack/feature-special-folders/get-data.ts");
226
127
  var sanitize = __webpack_require__("./webpack/webpack-lib/sanitize.ts");
227
- var branding = __webpack_require__("./webpack/webpack-lib/branding.ts");
228
- function setupCompilerHooks(compiler, port) {
229
- const verbose = '1' === String(process.env.EXTENSION_VERBOSE || '').trim();
230
- let reportedNoEntries = false;
231
- compiler.hooks.invalid.tap('extension.js:invalid', ()=>{
232
- if (verbose) console.log(bundlerRecompiling());
233
- });
234
- compiler.hooks.failed.tap('extension.js:failed', (error)=>{
235
- console.error(bundlerFatalError(error));
236
- });
237
- compiler.hooks.done.tap('extension.js:done', (stats)=>{
238
- try {
239
- if (stats?.hasErrors?.()) {
240
- const str = stats?.toString?.({
241
- colors: true,
242
- all: false,
243
- errors: true,
244
- warnings: true
245
- });
246
- if (str) console.error((0, branding.h)(str));
247
- } else if (stats?.hasWarnings?.()) {
248
- const str = stats?.toString?.({
249
- colors: true,
250
- all: false,
251
- errors: false,
252
- warnings: true
253
- });
254
- if (str) console.warn((0, branding.h)(str));
255
- }
256
- if (!reportedNoEntries) {
257
- const info = stats.toJson({
258
- all: false,
259
- assets: true,
260
- entrypoints: true
261
- });
262
- const hasAssets = Array.isArray(info?.assets) && info.assets.length > 0;
263
- const entrypoints = info?.entrypoints || {};
264
- const hasEntrypoints = entrypoints && Object.keys(entrypoints).length > 0;
265
- if (!hasAssets && !hasEntrypoints) {
266
- reportedNoEntries = true;
267
- console.warn(noEntrypointsDetected(port));
268
- }
269
- }
270
- } catch (error) {
271
- const str = stats?.toString({
272
- colors: true,
273
- all: false,
274
- errors: true,
275
- warnings: true
276
- });
277
- if (str) console.error((0, branding.h)(str));
278
- }
279
- });
280
- }
128
+ var compiler_hooks = __webpack_require__("./webpack/dev-server/compiler-hooks.ts");
281
129
  function parseMilliseconds(value) {
282
130
  if ('number' == typeof value) return Number.isFinite(value) && value > 0 ? value : null;
283
131
  if ('string' == typeof value) {
@@ -292,11 +140,11 @@ exports.modules = {
292
140
  const autoExitMs = parseMilliseconds(autoExitMsRaw);
293
141
  if (null === autoExitMs) return ()=>{};
294
142
  try {
295
- console.log(autoExitModeEnabled(autoExitMs));
143
+ console.log(messages.o6(autoExitMs));
296
144
  } catch {}
297
145
  autoExitTimer = setTimeout(async ()=>{
298
146
  try {
299
- console.log(autoExitTriggered(autoExitMs));
147
+ console.log(messages.tJ(autoExitMs));
300
148
  } catch {}
301
149
  await onCleanup();
302
150
  }, autoExitMs);
@@ -304,7 +152,7 @@ exports.modules = {
304
152
  const forceKillMs = null !== parsedForceKillMs && parsedForceKillMs > 0 ? parsedForceKillMs : autoExitMs + 4000;
305
153
  forceKillTimer = setTimeout(()=>{
306
154
  try {
307
- console.log(autoExitForceKill(forceKillMs));
155
+ console.log(messages.Df(forceKillMs));
308
156
  } catch {}
309
157
  process.exit(0);
310
158
  }, forceKillMs);
@@ -325,7 +173,7 @@ exports.modules = {
325
173
  await portManager.terminateCurrentInstance();
326
174
  setTimeout(()=>process.exit(), 500);
327
175
  }).catch(async (error)=>{
328
- console.log(extensionJsRunnerError(error));
176
+ console.log(messages.VL(error));
329
177
  await portManager.terminateCurrentInstance();
330
178
  setTimeout(()=>process.exit(1), 500);
331
179
  });
@@ -362,6 +210,9 @@ exports.modules = {
362
210
  }
363
211
  var plugin_playwright = __webpack_require__("./webpack/plugin-playwright/index.ts");
364
212
  var webpack_config = __webpack_require__("./webpack/webpack-config.ts");
213
+ function shouldWriteAssetToDisk(filePath) {
214
+ return !/(?:^|[/\\])manifest\.json$/i.test(filePath);
215
+ }
365
216
  async function dev_server_devServer(projectStructure, devOptions) {
366
217
  process.env.EXTENSION_BROWSER_LAUNCH_ENABLED = devOptions.noBrowser ? '0' : '1';
367
218
  const { manifestPath, packageJsonPath } = projectStructure;
@@ -429,8 +280,8 @@ exports.modules = {
429
280
  manifestPath,
430
281
  port
431
282
  });
432
- setupCompilerHooks(compiler, portAllocation.port);
433
- if (void 0 !== devOptions.port && devOptions.port !== port) console.log(portInUse(devOptions.port, port));
283
+ (0, compiler_hooks.N)(compiler);
284
+ if (void 0 !== devOptions.port && devOptions.port !== port) console.log(messages.aO(devOptions.port, port));
434
285
  const serverConfig = {
435
286
  host: devServerHost,
436
287
  allowedHosts: 'all',
@@ -440,7 +291,7 @@ exports.modules = {
440
291
  },
441
292
  compress: false,
442
293
  devMiddleware: {
443
- writeToDisk: true,
294
+ writeToDisk: shouldWriteAssetToDisk,
444
295
  stats: false
445
296
  },
446
297
  watchFiles: {
@@ -477,22 +328,24 @@ exports.modules = {
477
328
  let startTimeout;
478
329
  try {
479
330
  startTimeout = setTimeout(()=>{
480
- console.error(devServerStartTimeout(START_TIMEOUT_MS));
331
+ console.error(messages.UF(START_TIMEOUT_MS));
481
332
  }, START_TIMEOUT_MS);
482
333
  await devServer.start();
483
334
  if (startTimeout) clearTimeout(startTimeout);
484
- console.log(spacerLine());
485
- console.log(messages_ready('development', devOptions.browser));
486
- if (devOptions.noBrowser) console.log(browserRunnerDisabled({
487
- browser: String(devOptions.browser || 'chromium'),
488
- manifestPath,
489
- readyPath: metadata.readyPath
490
- }));
491
- console.log(spacerLine());
335
+ if (devOptions.noBrowser) {
336
+ console.log(messages.Gc('development', devOptions.browser));
337
+ console.log(messages.tl());
338
+ console.log(messages.bL({
339
+ browser: String(devOptions.browser || 'chromium'),
340
+ manifestPath,
341
+ readyPath: metadata.readyPath
342
+ }));
343
+ }
344
+ console.log(messages.tl());
492
345
  } catch (error) {
493
346
  if (startTimeout) clearTimeout(startTimeout);
494
347
  metadata.writeError('dev_server_start_failed', error instanceof Error ? error.message : String(error));
495
- console.log(extensionJsRunnerError(error));
348
+ console.log(messages.VL(error));
496
349
  process.exit(1);
497
350
  }
498
351
  setupCleanupHandlers(devServer, portManager);