@embeddable.com/sdk-core 3.1.2 → 3.1.4

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,26 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
 
4
+ const { pathToFileURL } = require("url");
5
+
4
6
  const { spawn } = require("child_process");
5
7
  const path = require("path");
6
8
 
7
9
  // Check if the loader is already applied to avoid infinite spawning
8
10
  if (!process.env.LOADER_APPLIED) {
9
11
  const env = { ...process.env, LOADER_APPLIED: "1" };
10
- const entryPointPath = path.join(__dirname, "../src/entryPoint.ts");
12
+ const entryPointPath = path.join(__dirname, "../src/entryPoint.js");
11
13
  const customLoaderPath = path.join(
12
14
  __dirname,
13
15
  "../loader/custom-esm-loader.mjs",
14
16
  );
15
17
 
18
+ const isWindows = process.platform === "win32";
19
+
20
+ const entryPointPathOrUrl = isWindows
21
+ ? pathToFileURL(entryPointPath).href
22
+ : entryPointPath;
23
+
24
+ const customLoaderPathOrUrl = isWindows
25
+ ? pathToFileURL(customLoaderPath).href
26
+ : customLoaderPath;
27
+
16
28
  const child = spawn(
17
29
  process.execPath,
18
30
  [
19
31
  "--loader",
20
- customLoaderPath,
32
+ customLoaderPathOrUrl,
21
33
  "--no-warnings=ExperimentalWarning",
22
34
  "--enable-source-maps",
23
- entryPointPath,
35
+ entryPointPathOrUrl,
24
36
  ...process.argv.slice(2),
25
37
  ],
26
38
  { stdio: ["inherit", "pipe", "inherit"], env },
@@ -4,10 +4,7 @@
4
4
  "allowUnreachableCode": false,
5
5
  "declaration": false,
6
6
  "experimentalDecorators": true,
7
- "lib": [
8
- "dom",
9
- "es2017"
10
- ],
7
+ "lib": ["dom", "es2017"],
11
8
  "moduleResolution": "node",
12
9
  "module": "esnext",
13
10
  "target": "es2017",
@@ -16,10 +13,6 @@
16
13
  "jsx": "react",
17
14
  "jsxFactory": "h"
18
15
  },
19
- "include": [
20
- "component"
21
- ],
22
- "exclude": [
23
- "node_modules"
24
- ]
25
- }
16
+ "include": ["component"],
17
+ "exclude": ["node_modules"]
18
+ }
@@ -1,9 +1,9 @@
1
1
  export type EmbeddableConfig = {
2
2
  plugins: (() => {
3
3
  pluginName: string;
4
- build: (config: EmbeddableConfig) => Promise<void>;
5
- cleanup: (config: EmbeddableConfig) => Promise<void>;
6
- validate: (config: EmbeddableConfig) => Promise<void>;
4
+ build: (config: EmbeddableConfig) => Promise<unknown>;
5
+ cleanup: (config: EmbeddableConfig) => Promise<unknown>;
6
+ validate: (config: EmbeddableConfig) => Promise<unknown>;
7
7
  })[];
8
8
  pushBaseUrl?: string;
9
9
  audienceUrl?: string;
@@ -42,9 +42,9 @@ declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authCl
42
42
  rollbarAccessToken: string;
43
43
  plugins: (() => {
44
44
  pluginName: string;
45
- build: (config: EmbeddableConfig) => Promise<void>;
46
- cleanup: (config: EmbeddableConfig) => Promise<void>;
47
- validate: (config: EmbeddableConfig) => Promise<void>;
45
+ build: (config: EmbeddableConfig) => Promise<unknown>;
46
+ cleanup: (config: EmbeddableConfig) => Promise<unknown>;
47
+ validate: (config: EmbeddableConfig) => Promise<unknown>;
48
48
  })[];
49
49
  };
50
50
  export default _default;
package/lib/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import * as path$1 from 'node:path';
4
4
  import { join } from 'node:path';
5
5
  import * as vite from 'vite';
6
6
  import 'node:child_process';
7
- import * as fsSync from 'node:fs';
7
+ import * as fs$2 from 'node:fs';
8
8
  import { createNodeLogger, createNodeSys } from '@stencil/core/sys/node';
9
9
  import { loadConfig, createCompiler } from '@stencil/core/compiler';
10
10
  import * as YAML from 'yaml';
@@ -382,7 +382,7 @@ var prepare = async (ctx) => {
382
382
  await createComponentDir(ctx.client.componentDir);
383
383
  };
384
384
  async function removeIfExists(ctx) {
385
- if (fsSync.existsSync(ctx.client.buildDir))
385
+ if (fs$2.existsSync(ctx.client.buildDir))
386
386
  await fs$1.rm(ctx.client.buildDir, { recursive: true });
387
387
  }
388
388
  async function copyStencilConfigsToClient(ctx) {
@@ -421,12 +421,14 @@ async function runStencil(ctx) {
421
421
  const logger = ((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.logger) || createNodeLogger({ process });
422
422
  const sys = ((_b = ctx.dev) === null || _b === void 0 ? void 0 : _b.sys) || createNodeSys({ process });
423
423
  const devMode = !!ctx.dev;
424
+ const isWindows = process.platform === "win32";
424
425
  const validated = await loadConfig({
425
426
  initTsConfig: true,
426
427
  logger,
427
428
  sys,
428
429
  config: {
429
430
  devMode,
431
+ maxConcurrentWorkers: isWindows ? 0 : 8, // workers break on windows
430
432
  rootDir: ctx.client.buildDir,
431
433
  configPath: path$1.resolve(ctx.client.buildDir, "stencil.config.ts"),
432
434
  tsconfig: path$1.resolve(ctx.client.buildDir, "tsconfig.json"),
@@ -4626,12 +4628,17 @@ const securityContextSchema = z.array(z.object({
4626
4628
 
4627
4629
  var provideConfig = async () => {
4628
4630
  const configFilePath = `${process.cwd()}/embeddable.config.js`;
4629
- if (!fsSync.existsSync(configFilePath)) {
4630
- console.log("Please create a proper `embeddable.config.js` file first.");
4631
+ const tsConfigFilePath = `${process.cwd()}/embeddable.config.ts`;
4632
+ if (!fs$2.existsSync(configFilePath) && !fs$2.existsSync(tsConfigFilePath)) {
4633
+ console.log("Please create a proper `embeddable.config.js` or `embeddable.config.ts` file in the root of your project.");
4631
4634
  process.exit(1);
4632
4635
  }
4633
- const configFileUrl = url$2.pathToFileURL(configFilePath).href;
4634
- return (await import(configFileUrl)).default;
4636
+ const isWindows = process.platform === "win32";
4637
+ const configPath = fs$2.existsSync(tsConfigFilePath)
4638
+ ? tsConfigFilePath
4639
+ : configFilePath;
4640
+ const pathOrUrl = isWindows ? url$2.pathToFileURL(configPath).href : configPath;
4641
+ return (await import(pathOrUrl)).default;
4635
4642
  };
4636
4643
 
4637
4644
  function getDefaultExportFromCjs (x) {
@@ -20149,7 +20156,7 @@ async function verify(ctx) {
20149
20156
  return token;
20150
20157
  }
20151
20158
  async function archive(ctx, yamlFiles, includeBuild = true) {
20152
- const output = fsSync.createWriteStream(ctx.client.archiveFile);
20159
+ const output = fs$2.createWriteStream(ctx.client.archiveFile);
20153
20160
  const _archiver = archiver.create("zip", {
20154
20161
  zlib: { level: 9 },
20155
20162
  });