extension-develop 3.16.1 → 3.17.0-canary.312.672c4f2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/0~dev-server.mjs +21 -57
- package/dist/0~rspack-config.mjs +399 -909
- package/dist/0~zip.mjs +39 -10
- package/dist/946.mjs +117 -27
- package/dist/962.mjs +65 -18
- package/dist/extension-js-devtools/chrome/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/chrome/pages/centralized-logger.js +1 -1
- package/dist/extension-js-devtools/chrome/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/chrome/scripts/logger-client.js +1 -1
- package/dist/extension-js-devtools/chromium/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/chromium/pages/centralized-logger.js +1 -1
- package/dist/extension-js-devtools/chromium/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/chromium/scripts/logger-client.js +1 -1
- package/dist/extension-js-devtools/edge/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/edge/pages/centralized-logger.js +1 -1
- package/dist/extension-js-devtools/edge/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/edge/scripts/logger-client.js +1 -1
- package/dist/extension-js-devtools/firefox/content_scripts/content-0.js +2 -2
- package/dist/extension-js-devtools/firefox/pages/centralized-logger.js +1 -1
- package/dist/extension-js-devtools/firefox/pages/welcome.js +2 -2
- package/dist/extension-js-devtools/firefox/scripts/logger-client.js +1 -1
- package/dist/feature-scripts-content-script-wrapper.js +19 -2
- package/dist/feature-scripts-content-script-wrapper.mjs +19 -2
- package/package.json +6 -4
- package/runtime/process-shim.cjs +49 -0
package/dist/0~dev-server.mjs
CHANGED
|
@@ -47,65 +47,29 @@ function resolveInstanceIdOverride() {
|
|
|
47
47
|
class PortManager {
|
|
48
48
|
basePort;
|
|
49
49
|
currentInstance = null;
|
|
50
|
-
constructor(
|
|
50
|
+
constructor(basePort = 8080){
|
|
51
51
|
this.basePort = basePort;
|
|
52
52
|
}
|
|
53
|
-
async allocatePorts(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
port,
|
|
67
|
-
webSocketPort,
|
|
68
|
-
instanceId
|
|
69
|
-
};
|
|
70
|
-
} catch (error) {
|
|
71
|
-
throw error;
|
|
72
|
-
}
|
|
53
|
+
async allocatePorts(requestedPort) {
|
|
54
|
+
const isValidRequested = 'number' == typeof requestedPort && requestedPort >= 0 && requestedPort < 65536;
|
|
55
|
+
const base = isValidRequested ? requestedPort : this.basePort;
|
|
56
|
+
const port = await findAvailablePortNear(base);
|
|
57
|
+
const instanceId = resolveInstanceIdOverride() || __rspack_external_crypto.randomBytes(8).toString('hex');
|
|
58
|
+
this.currentInstance = {
|
|
59
|
+
instanceId,
|
|
60
|
+
port
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
port,
|
|
64
|
+
instanceId
|
|
65
|
+
};
|
|
73
66
|
}
|
|
74
67
|
getCurrentInstance() {
|
|
75
68
|
return this.currentInstance;
|
|
76
69
|
}
|
|
77
|
-
async updateExtensionId(extensionId) {
|
|
78
|
-
if (this.currentInstance) this.currentInstance.extensionId = extensionId;
|
|
79
|
-
}
|
|
80
70
|
async terminateCurrentInstance() {
|
|
81
71
|
this.currentInstance = null;
|
|
82
72
|
}
|
|
83
|
-
getPortInfo(allocation) {
|
|
84
|
-
return `Port: ${allocation.port}, WebSocket: ${allocation.webSocketPort}, Instance: ${allocation.instanceId.slice(0, 8)}`;
|
|
85
|
-
}
|
|
86
|
-
async isPortInUse(port) {
|
|
87
|
-
return new Promise((resolve)=>{
|
|
88
|
-
const server = __rspack_external_net.createServer();
|
|
89
|
-
server.once('error', ()=>resolve(true));
|
|
90
|
-
server.once('listening', ()=>{
|
|
91
|
-
server.close(()=>resolve(false));
|
|
92
|
-
});
|
|
93
|
-
server.listen(port, '127.0.0.1');
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
async getRunningInstances() {
|
|
97
|
-
return this.currentInstance ? [
|
|
98
|
-
this.currentInstance
|
|
99
|
-
] : [];
|
|
100
|
-
}
|
|
101
|
-
async getStats() {
|
|
102
|
-
return {
|
|
103
|
-
total: this.currentInstance ? 1 : 0,
|
|
104
|
-
running: this.currentInstance ? 1 : 0,
|
|
105
|
-
terminated: 0,
|
|
106
|
-
error: 0
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
73
|
}
|
|
110
74
|
function hasDependency(projectPath, dependency) {
|
|
111
75
|
const findNearestPackageJsonDirectory = (startPath)=>{
|
|
@@ -207,9 +171,8 @@ function setupCleanupHandlers(devServer, portManager) {
|
|
|
207
171
|
console.error('[Extension.js Runner] Uncaught exception.', error);
|
|
208
172
|
await cleanup();
|
|
209
173
|
});
|
|
210
|
-
process.on('unhandledRejection',
|
|
174
|
+
process.on('unhandledRejection', (reason, promise)=>{
|
|
211
175
|
console.error('[Extension.js Runner] Unhandled rejection.', promise, reason);
|
|
212
|
-
await cleanup();
|
|
213
176
|
});
|
|
214
177
|
const cancelAutoExit = setupAutoExit(process.env.EXTENSION_AUTO_EXIT_MS, process.env.EXTENSION_FORCE_KILL_MS, cleanup);
|
|
215
178
|
const cancelAndCleanup = async ()=>{
|
|
@@ -218,7 +181,6 @@ function setupCleanupHandlers(devServer, portManager) {
|
|
|
218
181
|
} catch {}
|
|
219
182
|
await cleanup();
|
|
220
183
|
};
|
|
221
|
-
process.on('ERROR', cancelAndCleanup);
|
|
222
184
|
process.on('SIGINT', cancelAndCleanup);
|
|
223
185
|
process.on('SIGTERM', cancelAndCleanup);
|
|
224
186
|
process.on('SIGHUP', cancelAndCleanup);
|
|
@@ -367,9 +329,9 @@ async function dev_server_devServer(projectStructure, devOptions) {
|
|
|
367
329
|
const packageJsonDir = __rspack_external_path.dirname(packageJsonPath);
|
|
368
330
|
const commandConfig = await loadCommandConfig(packageJsonDir, 'dev');
|
|
369
331
|
const browserConfig = await loadBrowserConfig(packageJsonDir, devOptions.browser);
|
|
370
|
-
const portManager = new PortManager(
|
|
332
|
+
const portManager = new PortManager(8080);
|
|
371
333
|
const desiredPort = 'string' == typeof devOptions.port ? parseInt(devOptions.port, 10) : devOptions.port;
|
|
372
|
-
const portAllocation = await portManager.allocatePorts(
|
|
334
|
+
const portAllocation = await portManager.allocatePorts(desiredPort);
|
|
373
335
|
const currentInstance = portManager.getCurrentInstance();
|
|
374
336
|
if (!currentInstance) throw new Error('Failed to create instance');
|
|
375
337
|
const port = portAllocation.port;
|
|
@@ -456,8 +418,10 @@ async function dev_server_devServer(projectStructure, devOptions) {
|
|
|
456
418
|
__rspack_external_path.join(packageJsonDir, 'dist', '**/*')
|
|
457
419
|
],
|
|
458
420
|
ignoreInitial: true,
|
|
459
|
-
|
|
460
|
-
|
|
421
|
+
...'true' === process.env.EXTENSION_WATCH_POLL ? {
|
|
422
|
+
usePolling: true,
|
|
423
|
+
interval: parseInt(String(process.env.EXTENSION_WATCH_POLL_INTERVAL || '1000'), 10)
|
|
424
|
+
} : {}
|
|
461
425
|
}
|
|
462
426
|
},
|
|
463
427
|
client: false,
|