@embeddable.com/sdk-core 3.12.0 → 3.12.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 +8 -5
- package/lib/index.esm.js +25 -16
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +25 -16
- package/lib/index.js.map +1 -1
- package/lib/src/build.d.ts +2 -0
- package/lib/src/build.test.d.ts +1 -0
- package/lib/src/buildTypes.d.ts +4 -0
- package/lib/src/buildTypes.test.d.ts +1 -0
- package/lib/src/cleanup.d.ts +16 -0
- package/lib/src/cleanup.test.d.ts +1 -0
- package/lib/src/createContext.d.ts +23 -0
- package/lib/src/credentials.d.ts +2 -0
- package/lib/src/defineConfig.d.ts +65 -0
- package/lib/src/dev.d.ts +2 -0
- package/lib/src/generate.d.ts +2 -0
- package/lib/src/globalCleanup.d.ts +2 -0
- package/lib/src/index.d.ts +5 -0
- package/lib/src/login.d.ts +4 -0
- package/lib/src/prepare.d.ts +3 -0
- package/lib/src/provideConfig.d.ts +2 -0
- package/lib/src/provideConfig.test.d.ts +1 -0
- package/lib/src/push.d.ts +26 -0
- package/lib/src/utils.d.ts +25 -0
- package/lib/src/utils.test.d.ts +1 -0
- package/lib/src/validate.d.ts +8 -0
- package/lib/src/validate.test.d.ts +1 -0
- package/lib/validate.d.ts +1 -1
- package/loader/custom-esm-loader.mjs +53 -10
- package/loader/entryPoint.js +37 -13
- package/loader/entryPoint.test.js +6 -5
- package/package.json +2 -2
- package/src/dev.ts +2 -1
- package/src/logger.ts +2 -6
- package/src/login.ts +14 -2
- package/src/push.ts +1 -0
- package/src/validate.ts +4 -10
package/bin/embeddable
CHANGED
|
@@ -14,17 +14,20 @@ if (!process.env.LOADER_APPLIED) {
|
|
|
14
14
|
VITE_CJS_IGNORE_WARNING: "true", // see https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
const isWindows = process.platform === "win32";
|
|
18
|
+
|
|
17
19
|
const dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
20
|
+
const normalizedDirname = isWindows
|
|
21
|
+
? dirname.slice(1) // Remove leading slash on Windows
|
|
22
|
+
: dirname;
|
|
18
23
|
|
|
19
|
-
const entryPointPath = path.join(
|
|
24
|
+
const entryPointPath = path.join(normalizedDirname, "../loader/entryPoint.js");
|
|
20
25
|
const customLoaderPath = path.join(
|
|
21
|
-
|
|
26
|
+
normalizedDirname,
|
|
22
27
|
"../loader/custom-esm-loader.mjs",
|
|
23
28
|
);
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const entryPointPathOrUrl = isWindows
|
|
30
|
+
const entryPointPathOrUrl = isWindows
|
|
28
31
|
? pathToFileURL(entryPointPath).href
|
|
29
32
|
: entryPointPath;
|
|
30
33
|
|
package/lib/index.esm.js
CHANGED
|
@@ -4982,7 +4982,7 @@ var z = /*#__PURE__*/Object.freeze({
|
|
|
4982
4982
|
const CUBE_YAML_FILE_REGEX = /^(.*)\.cube\.ya?ml$/;
|
|
4983
4983
|
const SECURITY_CONTEXT_FILE_REGEX = /^(.*)\.sc\.ya?ml$/;
|
|
4984
4984
|
const CLIENT_CONTEXT_FILE_REGEX = /^(.*)\.cc\.ya?ml$/;
|
|
4985
|
-
var validate = async (ctx
|
|
4985
|
+
var validate = async (ctx) => {
|
|
4986
4986
|
checkNodeVersion();
|
|
4987
4987
|
const ora = (await import('ora')).default;
|
|
4988
4988
|
const spinnerValidate = ora("Data model validation...").start();
|
|
@@ -4993,9 +4993,7 @@ var validate = async (ctx, exitIfInvalid = true) => {
|
|
|
4993
4993
|
if (dataModelErrors.length) {
|
|
4994
4994
|
spinnerValidate.fail("One or more cube.yaml files are invalid:");
|
|
4995
4995
|
dataModelErrors.forEach((errorMessage) => spinnerValidate.info(errorMessage));
|
|
4996
|
-
|
|
4997
|
-
process.exit(1);
|
|
4998
|
-
}
|
|
4996
|
+
process.exit(1);
|
|
4999
4997
|
}
|
|
5000
4998
|
spinnerValidate.succeed("Data model validation completed");
|
|
5001
4999
|
const securityContextErrors = await securityContextValidation(securityContextFilesList);
|
|
@@ -5003,16 +5001,12 @@ var validate = async (ctx, exitIfInvalid = true) => {
|
|
|
5003
5001
|
if (securityContextErrors.length) {
|
|
5004
5002
|
spinnerValidate.fail("One or more security context files are invalid:");
|
|
5005
5003
|
securityContextErrors.forEach((errorMessage) => spinnerValidate.info(errorMessage));
|
|
5006
|
-
|
|
5007
|
-
process.exit(1);
|
|
5008
|
-
}
|
|
5004
|
+
process.exit(1);
|
|
5009
5005
|
}
|
|
5010
5006
|
if (clientContextErrors.length) {
|
|
5011
5007
|
spinnerValidate.fail("One or more client context files are invalid:");
|
|
5012
5008
|
clientContextErrors.forEach((errorMessage) => spinnerValidate.info(errorMessage));
|
|
5013
|
-
|
|
5014
|
-
process.exit(1);
|
|
5015
|
-
}
|
|
5009
|
+
process.exit(1);
|
|
5016
5010
|
}
|
|
5017
5011
|
return (dataModelErrors.length === 0 &&
|
|
5018
5012
|
securityContextErrors.length === 0 &&
|
|
@@ -21325,7 +21319,7 @@ async function rotateLogIfNeeded() {
|
|
|
21325
21319
|
function setupGlobalErrorHandlers(command) {
|
|
21326
21320
|
process.on("uncaughtException", async (error) => {
|
|
21327
21321
|
await logError({ command, breadcrumbs: ["uncaughtException"], error });
|
|
21328
|
-
console.error(
|
|
21322
|
+
console.error(error);
|
|
21329
21323
|
process.exit(1);
|
|
21330
21324
|
});
|
|
21331
21325
|
process.on("unhandledRejection", async (reason) => {
|
|
@@ -21334,7 +21328,7 @@ function setupGlobalErrorHandlers(command) {
|
|
|
21334
21328
|
breadcrumbs: ["unhandledRejection"],
|
|
21335
21329
|
error: reason,
|
|
21336
21330
|
});
|
|
21337
|
-
console.error(
|
|
21331
|
+
console.error(reason);
|
|
21338
21332
|
process.exit(1);
|
|
21339
21333
|
});
|
|
21340
21334
|
}
|
|
@@ -21404,11 +21398,19 @@ var login = async () => {
|
|
|
21404
21398
|
client_id: config.authClientId,
|
|
21405
21399
|
};
|
|
21406
21400
|
await open(deviceCodeResponse.data["verification_uri_complete"]);
|
|
21401
|
+
let isTerminated = false;
|
|
21402
|
+
const signalHandler = () => {
|
|
21403
|
+
isTerminated = true;
|
|
21404
|
+
authenticationSpinner.fail("Authentication process interrupted");
|
|
21405
|
+
process.exit(0);
|
|
21406
|
+
};
|
|
21407
|
+
process.on("SIGTERM", signalHandler);
|
|
21408
|
+
process.on("SIGINT", signalHandler);
|
|
21407
21409
|
/**
|
|
21408
21410
|
* This is a recommended way to poll, since it take some time for a user to enter a `user_code` in a browser.
|
|
21409
21411
|
* deviceCodeResponse.data['interval'] is a recommended/calculated polling interval specified in seconds.
|
|
21410
21412
|
*/
|
|
21411
|
-
while (
|
|
21413
|
+
while (!isTerminated) {
|
|
21412
21414
|
try {
|
|
21413
21415
|
const tokenResponse = await axios.post(`https://${config.authDomain}/oauth/token`, tokenPayload);
|
|
21414
21416
|
await fs.writeFile(CREDENTIALS_FILE, JSON.stringify(tokenResponse.data));
|
|
@@ -21423,6 +21425,9 @@ var login = async () => {
|
|
|
21423
21425
|
await sleep(deviceCodeResponse.data["interval"] * 1000);
|
|
21424
21426
|
}
|
|
21425
21427
|
}
|
|
21428
|
+
// Clean up signal handlers
|
|
21429
|
+
process.off("SIGTERM", signalHandler);
|
|
21430
|
+
process.off("SIGINT", signalHandler);
|
|
21426
21431
|
}
|
|
21427
21432
|
catch (error) {
|
|
21428
21433
|
authenticationSpinner.fail("Authentication failed. Please try again.");
|
|
@@ -21556,6 +21561,7 @@ var push = async () => {
|
|
|
21556
21561
|
spinnerPushing === null || spinnerPushing === void 0 ? void 0 : spinnerPushing.fail("Publishing failed");
|
|
21557
21562
|
await logError({ command: "push", breadcrumbs, error });
|
|
21558
21563
|
await reportErrorToRollbar(error);
|
|
21564
|
+
console.log(error);
|
|
21559
21565
|
process.exit(1);
|
|
21560
21566
|
}
|
|
21561
21567
|
};
|
|
@@ -21797,6 +21803,7 @@ var dev = async () => {
|
|
|
21797
21803
|
}
|
|
21798
21804
|
catch (error) {
|
|
21799
21805
|
await logError({ command: "dev", breadcrumbs, error });
|
|
21806
|
+
console.log(error);
|
|
21800
21807
|
process.exit(1);
|
|
21801
21808
|
}
|
|
21802
21809
|
};
|
|
@@ -21870,7 +21877,7 @@ const globalCssWatcher = (ctx) => {
|
|
|
21870
21877
|
};
|
|
21871
21878
|
const sendDataModelsAndContextsChanges = async (ctx) => {
|
|
21872
21879
|
sendMessage("dataModelsAndOrSecurityContextUpdateStart");
|
|
21873
|
-
const isValid = await validate(ctx
|
|
21880
|
+
const isValid = await validate(ctx);
|
|
21874
21881
|
if (isValid) {
|
|
21875
21882
|
const token = await getToken();
|
|
21876
21883
|
const sending = ora("Synchronising data models and/or security contexts...").start();
|
|
@@ -21909,6 +21916,8 @@ const onClose = async (server, sys, watchers, config) => {
|
|
|
21909
21916
|
process.exit(0);
|
|
21910
21917
|
};
|
|
21911
21918
|
const getPreviewWorkspace = async (startedOra, ctx) => {
|
|
21919
|
+
// login and retry
|
|
21920
|
+
await login();
|
|
21912
21921
|
const token = await getToken();
|
|
21913
21922
|
const params = minimist(process.argv.slice(2));
|
|
21914
21923
|
let primaryWorkspace = params.w || params.workspace;
|
|
@@ -21999,7 +22008,7 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
|
|
|
21999
22008
|
};
|
|
22000
22009
|
|
|
22001
22010
|
var name = "@embeddable.com/sdk-core";
|
|
22002
|
-
var version = "3.12.0";
|
|
22011
|
+
var version = "3.12.0-next.2";
|
|
22003
22012
|
var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
|
|
22004
22013
|
var keywords = [
|
|
22005
22014
|
"embeddable",
|
|
@@ -22037,7 +22046,7 @@ var engines = {
|
|
|
22037
22046
|
};
|
|
22038
22047
|
var license = "MIT";
|
|
22039
22048
|
var dependencies = {
|
|
22040
|
-
"@embeddable.com/sdk-utils": "0.6.0",
|
|
22049
|
+
"@embeddable.com/sdk-utils": "0.6.0-next.0",
|
|
22041
22050
|
"@inquirer/prompts": "^7.1.0",
|
|
22042
22051
|
"@stencil/core": "^4.22.3",
|
|
22043
22052
|
"@swc-node/register": "^1.10.9",
|