@embeddable.com/sdk-core 2.5.4 → 2.6.0-next.0
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/bin/embeddable +34 -9
- package/lib/entryPoint.d.ts +1 -0
- package/lib/index.esm.js +9 -0
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -1
- package/package.json +2 -1
package/bin/embeddable
CHANGED
|
@@ -1,16 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
"use strict";
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const { spawn } = require("child_process");
|
|
5
|
+
const path = require("path");
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
// Check if the loader is already applied to avoid infinite spawning
|
|
8
|
+
if (!process.env.LOADER_APPLIED) {
|
|
9
|
+
const env = { ...process.env, LOADER_APPLIED: "1" };
|
|
10
|
+
const entryPointPath = path.join(__dirname, "../src/entryPoint.ts");
|
|
11
|
+
const customLoaderPath = path.join(
|
|
12
|
+
__dirname,
|
|
13
|
+
"../loader/custom-esm-loader.mjs",
|
|
14
|
+
);
|
|
8
15
|
|
|
9
|
-
|
|
16
|
+
const child = spawn(
|
|
17
|
+
process.execPath,
|
|
18
|
+
[
|
|
19
|
+
"--loader",
|
|
20
|
+
customLoaderPath,
|
|
21
|
+
"--no-warnings=ExperimentalWarning",
|
|
22
|
+
"--enable-source-maps",
|
|
23
|
+
entryPointPath,
|
|
24
|
+
...process.argv.slice(2),
|
|
25
|
+
],
|
|
26
|
+
{ stdio: ["inherit", "pipe", "inherit"], env },
|
|
27
|
+
);
|
|
10
28
|
|
|
11
|
-
|
|
29
|
+
child.stdout.on("data", (data) => {
|
|
30
|
+
const message = data.toString();
|
|
31
|
+
if (!message.includes("importAssertions: ")) {
|
|
32
|
+
process.stdout.write(data);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
12
35
|
|
|
13
|
-
|
|
36
|
+
child.on("exit", process.exit);
|
|
37
|
+
} else {
|
|
38
|
+
console.log(
|
|
39
|
+
"Loader already applied, this log should not appear in normal execution.",
|
|
40
|
+
);
|
|
14
41
|
}
|
|
15
|
-
|
|
16
|
-
main()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.esm.js
CHANGED
|
@@ -20215,6 +20215,7 @@ const buildWebComponent = async (config) => {
|
|
|
20215
20215
|
};
|
|
20216
20216
|
var dev = async () => {
|
|
20217
20217
|
var _a;
|
|
20218
|
+
checkNodeVersion();
|
|
20218
20219
|
const http = require("http");
|
|
20219
20220
|
ora = (await oraP).default;
|
|
20220
20221
|
process.on("warning", (e) => console.warn(e.stack));
|
|
@@ -20243,6 +20244,14 @@ var dev = async () => {
|
|
|
20243
20244
|
workspacePreparation.succeed("Workspace is ready");
|
|
20244
20245
|
const server = http.createServer((request, res) => {
|
|
20245
20246
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
20247
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
20248
|
+
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
|
20249
|
+
if (request.method === "OPTIONS") {
|
|
20250
|
+
// Respond to OPTIONS requests with just the CORS headers and a 200 status code
|
|
20251
|
+
res.writeHead(200);
|
|
20252
|
+
res.end();
|
|
20253
|
+
return;
|
|
20254
|
+
}
|
|
20246
20255
|
const done = finalhandler(request, res);
|
|
20247
20256
|
serve(request, res, done);
|
|
20248
20257
|
});
|