@embeddable.com/sdk-core 2.5.3 → 2.5.5
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/lib/index.esm.js +20 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +20 -1
- package/lib/index.js.map +1 -1
- package/package.json +2 -1
package/lib/index.esm.js
CHANGED
|
@@ -20202,6 +20202,7 @@ async function getWorkspaces(ctx, token, workspaceSpinner) {
|
|
|
20202
20202
|
}
|
|
20203
20203
|
}
|
|
20204
20204
|
|
|
20205
|
+
const minimist = require("minimist");
|
|
20205
20206
|
const oraP = import('ora');
|
|
20206
20207
|
let wss;
|
|
20207
20208
|
let changedFiles = [];
|
|
@@ -20213,6 +20214,7 @@ const buildWebComponent = async (config) => {
|
|
|
20213
20214
|
await generate(config, "sdk-react");
|
|
20214
20215
|
};
|
|
20215
20216
|
var dev = async () => {
|
|
20217
|
+
var _a;
|
|
20216
20218
|
const http = require("http");
|
|
20217
20219
|
ora = (await oraP).default;
|
|
20218
20220
|
process.on("warning", (e) => console.warn(e.stack));
|
|
@@ -20231,10 +20233,24 @@ var dev = async () => {
|
|
|
20231
20233
|
const serveStatic = require("serve-static");
|
|
20232
20234
|
const serve = serveStatic(config.client.buildDir);
|
|
20233
20235
|
const workspacePreparation = ora("Preparing workspace...").start();
|
|
20234
|
-
|
|
20236
|
+
try {
|
|
20237
|
+
previewWorkspace = await getPreviewWorkspace(config);
|
|
20238
|
+
}
|
|
20239
|
+
catch (e) {
|
|
20240
|
+
workspacePreparation.fail((_a = e.response.data) === null || _a === void 0 ? void 0 : _a.errorMessage);
|
|
20241
|
+
process.exit(1);
|
|
20242
|
+
}
|
|
20235
20243
|
workspacePreparation.succeed("Workspace is ready");
|
|
20236
20244
|
const server = http.createServer((request, res) => {
|
|
20237
20245
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
20246
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
20247
|
+
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
|
20248
|
+
if (request.method === "OPTIONS") {
|
|
20249
|
+
// Respond to OPTIONS requests with just the CORS headers and a 200 status code
|
|
20250
|
+
res.writeHead(200);
|
|
20251
|
+
res.end();
|
|
20252
|
+
return;
|
|
20253
|
+
}
|
|
20238
20254
|
const done = finalhandler(request, res);
|
|
20239
20255
|
serve(request, res, done);
|
|
20240
20256
|
});
|
|
@@ -20346,8 +20362,11 @@ const onClose = async (server, sys, watchers, config) => {
|
|
|
20346
20362
|
};
|
|
20347
20363
|
const getPreviewWorkspace = async (ctx) => {
|
|
20348
20364
|
const token = await getToken();
|
|
20365
|
+
const params = minimist(process.argv.slice(2));
|
|
20366
|
+
const primaryWorkspace = params.w || params.workspace;
|
|
20349
20367
|
try {
|
|
20350
20368
|
const response = await axios.get(`${ctx.pushBaseUrl}/workspace/dev-workspace`, {
|
|
20369
|
+
params: { primaryWorkspace },
|
|
20351
20370
|
headers: {
|
|
20352
20371
|
Authorization: `Bearer ${token}`,
|
|
20353
20372
|
},
|