@embeddable.com/sdk-core 2.5.5 → 2.6.0-next.1

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 CHANGED
@@ -1,16 +1,43 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';
2
+ "use strict";
3
3
 
4
- const COMMANDS_MAP = require("../lib");
4
+ const { spawn } = require("child_process");
5
+ const path = require("path");
5
6
 
6
- async function main () {
7
- const command = process.argv[2];
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
+ // Dynamically construct the path to custom-esm-loader.mjs
12
+ const sdkCorePackagePath = require.resolve("@embeddable/sdk-core");
13
+ const customLoaderPath = path.join(
14
+ sdkCorePackagePath,
15
+ "../loader/custom-esm-loader.mjs",
16
+ );
8
17
 
9
- const runScript = COMMANDS_MAP[command];
18
+ const child = spawn(
19
+ process.execPath,
20
+ [
21
+ "--loader",
22
+ customLoaderPath,
23
+ "--no-warnings=ExperimentalWarning",
24
+ "--enable-source-maps",
25
+ entryPointPath,
26
+ ...process.argv.slice(2),
27
+ ],
28
+ { stdio: ["inherit", "pipe", "inherit"], env },
29
+ );
10
30
 
11
- if (!runScript) process.exit(1); // TODO: proper handling.
31
+ child.stdout.on("data", (data) => {
32
+ const message = data.toString();
33
+ if (!message.includes("importAssertions: ")) {
34
+ process.stdout.write(data);
35
+ }
36
+ });
12
37
 
13
- await runScript();
38
+ child.on("exit", process.exit);
39
+ } else {
40
+ console.log(
41
+ "Loader already applied, this log should not appear in normal execution.",
42
+ );
14
43
  }
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));