@embeddable.com/sdk-core 3.2.0-next.1 → 3.2.0-next.10
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 +15 -3
- package/configs/tsconfig.json +4 -11
- package/lib/defineConfig.d.ts +6 -6
- package/lib/index.esm.js +20 -10
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +21 -11
- package/lib/index.js.map +1 -1
- package/loader/custom-esm-loader.mjs +34 -6
- package/package.json +1 -1
- package/src/defineConfig.ts +3 -3
- package/src/entryPoint.js +12 -0
- package/src/generate.ts +3 -0
- package/src/login.ts +1 -3
- package/src/provideConfig.ts +13 -4
- package/src/push.ts +6 -3
- package/lib/entryPoint.d.ts +0 -1
- package/src/entryPoint.ts +0 -16
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.
|
|
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
|
-
|
|
32
|
+
customLoaderPathOrUrl,
|
|
21
33
|
"--no-warnings=ExperimentalWarning",
|
|
22
34
|
"--enable-source-maps",
|
|
23
|
-
|
|
35
|
+
entryPointPathOrUrl,
|
|
24
36
|
...process.argv.slice(2),
|
|
25
37
|
],
|
|
26
38
|
{ stdio: ["inherit", "pipe", "inherit"], env },
|
package/configs/tsconfig.json
CHANGED
|
@@ -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
|
-
|
|
21
|
-
|
|
22
|
-
"exclude": [
|
|
23
|
-
"node_modules"
|
|
24
|
-
]
|
|
25
|
-
}
|
|
16
|
+
"include": ["component"],
|
|
17
|
+
"exclude": ["node_modules"]
|
|
18
|
+
}
|
package/lib/defineConfig.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export type EmbeddableConfig = {
|
|
2
2
|
plugins: (() => {
|
|
3
3
|
pluginName: string;
|
|
4
|
-
build: (config: EmbeddableConfig) => Promise<
|
|
5
|
-
cleanup: (config: EmbeddableConfig) => Promise<
|
|
6
|
-
validate: (config: EmbeddableConfig) => Promise<
|
|
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<
|
|
46
|
-
cleanup: (config: EmbeddableConfig) => Promise<
|
|
47
|
-
validate: (config: EmbeddableConfig) => Promise<
|
|
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
|
|
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 (
|
|
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
|
-
|
|
4630
|
-
|
|
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
|
|
4634
|
-
|
|
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) {
|
|
@@ -20080,6 +20087,8 @@ const inquirerSelect = import('@inquirer/select');
|
|
|
20080
20087
|
const YAML_OR_JS_FILES = /^(.*)\.(cube|sc)\.(ya?ml|js)$/;
|
|
20081
20088
|
let ora$1;
|
|
20082
20089
|
var push = async () => {
|
|
20090
|
+
var _a;
|
|
20091
|
+
let spinnerPushing;
|
|
20083
20092
|
try {
|
|
20084
20093
|
checkNodeVersion();
|
|
20085
20094
|
ora$1 = (await oraP$1).default;
|
|
@@ -20090,14 +20099,15 @@ var push = async () => {
|
|
|
20090
20099
|
const filesList = await findFiles(config.client.srcDir, YAML_OR_JS_FILES);
|
|
20091
20100
|
await archive(config, filesList);
|
|
20092
20101
|
spinnerArchive.succeed("Bundling completed");
|
|
20093
|
-
|
|
20102
|
+
spinnerPushing = ora$1(`Publishing to ${workspaceName} using ${config.pushBaseUrl}...`).start();
|
|
20094
20103
|
await sendBuild(config, { workspaceId, token });
|
|
20095
20104
|
spinnerPushing.succeed(`Published to ${workspaceName} using ${config.pushBaseUrl}`);
|
|
20096
20105
|
}
|
|
20097
20106
|
catch (error) {
|
|
20098
|
-
|
|
20107
|
+
spinnerPushing === null || spinnerPushing === void 0 ? void 0 : spinnerPushing.fail("Publishing failed");
|
|
20108
|
+
console.error(((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || (error === null || error === void 0 ? void 0 : error.message) || error);
|
|
20099
20109
|
await reportErrorToRollbar(error);
|
|
20100
|
-
|
|
20110
|
+
process.exit(1);
|
|
20101
20111
|
}
|
|
20102
20112
|
};
|
|
20103
20113
|
async function selectWorkspace(ctx, token) {
|
|
@@ -20146,7 +20156,7 @@ async function verify(ctx) {
|
|
|
20146
20156
|
return token;
|
|
20147
20157
|
}
|
|
20148
20158
|
async function archive(ctx, yamlFiles, includeBuild = true) {
|
|
20149
|
-
const output =
|
|
20159
|
+
const output = fs$2.createWriteStream(ctx.client.archiveFile);
|
|
20150
20160
|
const _archiver = archiver.create("zip", {
|
|
20151
20161
|
zlib: { level: 9 },
|
|
20152
20162
|
});
|