lucid-package 0.0.120 → 0.0.122
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/package.json +1 -1
- package/src/editorextension.js +11 -8
- package/src/package.d.ts +1 -1
package/package.json
CHANGED
package/src/editorextension.js
CHANGED
|
@@ -115,10 +115,11 @@ exports.watchEditorExtension = watchEditorExtension;
|
|
|
115
115
|
* @param watchIgnoreNodeModules If true, while serving, will not autoreload on changes to node_modules files
|
|
116
116
|
*/
|
|
117
117
|
async function debugEditorExtension(extensionNames, isInternal, quiet = false, pickAnyPort = false, watchIgnoreNodeModules = false) {
|
|
118
|
-
const port = 9900;
|
|
119
118
|
const watchers = await Promise.all(extensionNames.map(async (name) => watchEditorExtension(name, isInternal, quiet, watchIgnoreNodeModules)));
|
|
120
119
|
const app = express();
|
|
121
|
-
|
|
120
|
+
const initialPortToTry = 9900;
|
|
121
|
+
// The actual port number (that the server serves from)can change, depending on anyport behavior.
|
|
122
|
+
listen(app, initialPortToTry, pickAnyPort);
|
|
122
123
|
const errorLog = new Map();
|
|
123
124
|
recordErrors(watchers, errorLog);
|
|
124
125
|
app.use(cors_1.corsAllowLucid);
|
|
@@ -144,10 +145,12 @@ async function debugEditorExtension(extensionNames, isInternal, quiet = false, p
|
|
|
144
145
|
});
|
|
145
146
|
app.get(['/editorextension', '/editorextension/:name'], async (req, res) => {
|
|
146
147
|
const name = req.params['name'] ?? extensionNames[0];
|
|
148
|
+
const port = req.socket.localPort;
|
|
147
149
|
const rawExtension = await getRawEditorExtension(name, port);
|
|
148
150
|
res.send(rawExtension);
|
|
149
151
|
});
|
|
150
152
|
app.get('/editorextensions', async (req, res) => {
|
|
153
|
+
const port = req.socket.localPort;
|
|
151
154
|
res.send(await Promise.all(extensionNames.map((name) => getRawEditorExtension(name, port))));
|
|
152
155
|
});
|
|
153
156
|
app.get('/settings', async (req, res) => {
|
|
@@ -228,18 +231,18 @@ async function debugEditorExtension(extensionNames, isInternal, quiet = false, p
|
|
|
228
231
|
app.use('/resources', express.static('public'));
|
|
229
232
|
}
|
|
230
233
|
exports.debugEditorExtension = debugEditorExtension;
|
|
231
|
-
function listen(app,
|
|
234
|
+
function listen(app, portToTry, pickAnyPort) {
|
|
232
235
|
const server = app
|
|
233
|
-
.listen(
|
|
234
|
-
console.log((0, theme_1.success)('Listening at http://localhost:' +
|
|
236
|
+
.listen(portToTry, 'localhost', () => {
|
|
237
|
+
console.log((0, theme_1.success)('Listening at http://localhost:' + portToTry + '/extension.js'));
|
|
235
238
|
(0, shapelibrary_1.debugShapeLibraries)(undefined, pickAnyPort);
|
|
236
239
|
setupWebSockets(server);
|
|
237
240
|
})
|
|
238
241
|
.on('error', (err) => {
|
|
239
242
|
if (err.code === 'EADDRINUSE') {
|
|
240
|
-
if (pickAnyPort &&
|
|
241
|
-
|
|
242
|
-
listen(app,
|
|
243
|
+
if (pickAnyPort && portToTry < 15000) {
|
|
244
|
+
portToTry++;
|
|
245
|
+
listen(app, portToTry, pickAnyPort);
|
|
243
246
|
}
|
|
244
247
|
else {
|
|
245
248
|
console.error('Failed to listen for extension');
|
package/src/package.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PackageManifest } from './packagemanifest';
|
|
2
2
|
export declare function createEmptyPackage(root: string): Promise<void>;
|
|
3
3
|
export declare function currentlyInPackage(): boolean;
|
|
4
|
-
export declare function readJson(path: string): Promise<
|
|
4
|
+
export declare function readJson(path: string): Promise<any>;
|
|
5
5
|
export declare function modifyManifest(callback: (manifest: PackageManifest) => void | Promise<void>, manifestOverrideEnv?: string): Promise<void>;
|
|
6
6
|
export declare function updateAllExtensionSDK(): Promise<void>;
|
|
7
7
|
/**
|