@embeddable.com/sdk-core 3.12.0 → 3.12.2
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 +35 -21
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +36 -21
- 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 +7 -6
- package/src/dev.ts +10 -2
- 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
|
@@ -28,6 +28,7 @@ import * as http from 'node:http';
|
|
|
28
28
|
import { WebSocketServer } from 'ws';
|
|
29
29
|
import * as chokidar from 'chokidar';
|
|
30
30
|
import fg from 'fast-glob';
|
|
31
|
+
import * as dotenv from 'dotenv';
|
|
31
32
|
import { stat } from 'fs/promises';
|
|
32
33
|
|
|
33
34
|
var findFiles = async (initialSrcDir, regex) => {
|
|
@@ -4982,7 +4983,7 @@ var z = /*#__PURE__*/Object.freeze({
|
|
|
4982
4983
|
const CUBE_YAML_FILE_REGEX = /^(.*)\.cube\.ya?ml$/;
|
|
4983
4984
|
const SECURITY_CONTEXT_FILE_REGEX = /^(.*)\.sc\.ya?ml$/;
|
|
4984
4985
|
const CLIENT_CONTEXT_FILE_REGEX = /^(.*)\.cc\.ya?ml$/;
|
|
4985
|
-
var validate = async (ctx
|
|
4986
|
+
var validate = async (ctx) => {
|
|
4986
4987
|
checkNodeVersion();
|
|
4987
4988
|
const ora = (await import('ora')).default;
|
|
4988
4989
|
const spinnerValidate = ora("Data model validation...").start();
|
|
@@ -4993,9 +4994,7 @@ var validate = async (ctx, exitIfInvalid = true) => {
|
|
|
4993
4994
|
if (dataModelErrors.length) {
|
|
4994
4995
|
spinnerValidate.fail("One or more cube.yaml files are invalid:");
|
|
4995
4996
|
dataModelErrors.forEach((errorMessage) => spinnerValidate.info(errorMessage));
|
|
4996
|
-
|
|
4997
|
-
process.exit(1);
|
|
4998
|
-
}
|
|
4997
|
+
process.exit(1);
|
|
4999
4998
|
}
|
|
5000
4999
|
spinnerValidate.succeed("Data model validation completed");
|
|
5001
5000
|
const securityContextErrors = await securityContextValidation(securityContextFilesList);
|
|
@@ -5003,16 +5002,12 @@ var validate = async (ctx, exitIfInvalid = true) => {
|
|
|
5003
5002
|
if (securityContextErrors.length) {
|
|
5004
5003
|
spinnerValidate.fail("One or more security context files are invalid:");
|
|
5005
5004
|
securityContextErrors.forEach((errorMessage) => spinnerValidate.info(errorMessage));
|
|
5006
|
-
|
|
5007
|
-
process.exit(1);
|
|
5008
|
-
}
|
|
5005
|
+
process.exit(1);
|
|
5009
5006
|
}
|
|
5010
5007
|
if (clientContextErrors.length) {
|
|
5011
5008
|
spinnerValidate.fail("One or more client context files are invalid:");
|
|
5012
5009
|
clientContextErrors.forEach((errorMessage) => spinnerValidate.info(errorMessage));
|
|
5013
|
-
|
|
5014
|
-
process.exit(1);
|
|
5015
|
-
}
|
|
5010
|
+
process.exit(1);
|
|
5016
5011
|
}
|
|
5017
5012
|
return (dataModelErrors.length === 0 &&
|
|
5018
5013
|
securityContextErrors.length === 0 &&
|
|
@@ -21325,7 +21320,7 @@ async function rotateLogIfNeeded() {
|
|
|
21325
21320
|
function setupGlobalErrorHandlers(command) {
|
|
21326
21321
|
process.on("uncaughtException", async (error) => {
|
|
21327
21322
|
await logError({ command, breadcrumbs: ["uncaughtException"], error });
|
|
21328
|
-
console.error(
|
|
21323
|
+
console.error(error);
|
|
21329
21324
|
process.exit(1);
|
|
21330
21325
|
});
|
|
21331
21326
|
process.on("unhandledRejection", async (reason) => {
|
|
@@ -21334,7 +21329,7 @@ function setupGlobalErrorHandlers(command) {
|
|
|
21334
21329
|
breadcrumbs: ["unhandledRejection"],
|
|
21335
21330
|
error: reason,
|
|
21336
21331
|
});
|
|
21337
|
-
console.error(
|
|
21332
|
+
console.error(reason);
|
|
21338
21333
|
process.exit(1);
|
|
21339
21334
|
});
|
|
21340
21335
|
}
|
|
@@ -21404,11 +21399,19 @@ var login = async () => {
|
|
|
21404
21399
|
client_id: config.authClientId,
|
|
21405
21400
|
};
|
|
21406
21401
|
await open(deviceCodeResponse.data["verification_uri_complete"]);
|
|
21402
|
+
let isTerminated = false;
|
|
21403
|
+
const signalHandler = () => {
|
|
21404
|
+
isTerminated = true;
|
|
21405
|
+
authenticationSpinner.fail("Authentication process interrupted");
|
|
21406
|
+
process.exit(0);
|
|
21407
|
+
};
|
|
21408
|
+
process.on("SIGTERM", signalHandler);
|
|
21409
|
+
process.on("SIGINT", signalHandler);
|
|
21407
21410
|
/**
|
|
21408
21411
|
* This is a recommended way to poll, since it take some time for a user to enter a `user_code` in a browser.
|
|
21409
21412
|
* deviceCodeResponse.data['interval'] is a recommended/calculated polling interval specified in seconds.
|
|
21410
21413
|
*/
|
|
21411
|
-
while (
|
|
21414
|
+
while (!isTerminated) {
|
|
21412
21415
|
try {
|
|
21413
21416
|
const tokenResponse = await axios.post(`https://${config.authDomain}/oauth/token`, tokenPayload);
|
|
21414
21417
|
await fs.writeFile(CREDENTIALS_FILE, JSON.stringify(tokenResponse.data));
|
|
@@ -21423,6 +21426,9 @@ var login = async () => {
|
|
|
21423
21426
|
await sleep(deviceCodeResponse.data["interval"] * 1000);
|
|
21424
21427
|
}
|
|
21425
21428
|
}
|
|
21429
|
+
// Clean up signal handlers
|
|
21430
|
+
process.off("SIGTERM", signalHandler);
|
|
21431
|
+
process.off("SIGINT", signalHandler);
|
|
21426
21432
|
}
|
|
21427
21433
|
catch (error) {
|
|
21428
21434
|
authenticationSpinner.fail("Authentication failed. Please try again.");
|
|
@@ -21556,6 +21562,7 @@ var push = async () => {
|
|
|
21556
21562
|
spinnerPushing === null || spinnerPushing === void 0 ? void 0 : spinnerPushing.fail("Publishing failed");
|
|
21557
21563
|
await logError({ command: "push", breadcrumbs, error });
|
|
21558
21564
|
await reportErrorToRollbar(error);
|
|
21565
|
+
console.log(error);
|
|
21559
21566
|
process.exit(1);
|
|
21560
21567
|
}
|
|
21561
21568
|
};
|
|
@@ -21659,6 +21666,7 @@ async function uploadFile(formData, url, token) {
|
|
|
21659
21666
|
}
|
|
21660
21667
|
|
|
21661
21668
|
const minimist = require("minimist");
|
|
21669
|
+
dotenv.config();
|
|
21662
21670
|
const oraP = import('ora');
|
|
21663
21671
|
let wss;
|
|
21664
21672
|
let changedFiles = [];
|
|
@@ -21797,6 +21805,7 @@ var dev = async () => {
|
|
|
21797
21805
|
}
|
|
21798
21806
|
catch (error) {
|
|
21799
21807
|
await logError({ command: "dev", breadcrumbs, error });
|
|
21808
|
+
console.log(error);
|
|
21800
21809
|
process.exit(1);
|
|
21801
21810
|
}
|
|
21802
21811
|
};
|
|
@@ -21870,7 +21879,7 @@ const globalCssWatcher = (ctx) => {
|
|
|
21870
21879
|
};
|
|
21871
21880
|
const sendDataModelsAndContextsChanges = async (ctx) => {
|
|
21872
21881
|
sendMessage("dataModelsAndOrSecurityContextUpdateStart");
|
|
21873
|
-
const isValid = await validate(ctx
|
|
21882
|
+
const isValid = await validate(ctx);
|
|
21874
21883
|
if (isValid) {
|
|
21875
21884
|
const token = await getToken();
|
|
21876
21885
|
const sending = ora("Synchronising data models and/or security contexts...").start();
|
|
@@ -21919,8 +21928,12 @@ const getPreviewWorkspace = async (startedOra, ctx) => {
|
|
|
21919
21928
|
startedOra.start();
|
|
21920
21929
|
}
|
|
21921
21930
|
try {
|
|
21931
|
+
const instanceUrl = process.env.CUBE_CLOUD_ENDPOINT;
|
|
21922
21932
|
const response = await axios.get(`${ctx.pushBaseUrl}/workspace/dev-workspace`, {
|
|
21923
|
-
params: {
|
|
21933
|
+
params: {
|
|
21934
|
+
primaryWorkspace,
|
|
21935
|
+
instanceUrl,
|
|
21936
|
+
},
|
|
21924
21937
|
headers: {
|
|
21925
21938
|
Authorization: `Bearer ${token}`,
|
|
21926
21939
|
},
|
|
@@ -21999,7 +22012,7 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
|
|
|
21999
22012
|
};
|
|
22000
22013
|
|
|
22001
22014
|
var name = "@embeddable.com/sdk-core";
|
|
22002
|
-
var version = "3.12.
|
|
22015
|
+
var version = "3.12.2";
|
|
22003
22016
|
var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
|
|
22004
22017
|
var keywords = [
|
|
22005
22018
|
"embeddable",
|
|
@@ -22037,13 +22050,14 @@ var engines = {
|
|
|
22037
22050
|
};
|
|
22038
22051
|
var license = "MIT";
|
|
22039
22052
|
var dependencies = {
|
|
22040
|
-
"@embeddable.com/sdk-utils": "0.6.
|
|
22041
|
-
"@inquirer/prompts": "^7.1
|
|
22042
|
-
"@stencil/core": "^4.
|
|
22053
|
+
"@embeddable.com/sdk-utils": "0.6.1",
|
|
22054
|
+
"@inquirer/prompts": "^7.2.1",
|
|
22055
|
+
"@stencil/core": "^4.23.0",
|
|
22043
22056
|
"@swc-node/register": "^1.10.9",
|
|
22044
22057
|
archiver: "^5.3.2",
|
|
22045
|
-
axios: "^1.7.
|
|
22046
|
-
chokidar: "^4.0.
|
|
22058
|
+
axios: "^1.7.9",
|
|
22059
|
+
chokidar: "^4.0.3",
|
|
22060
|
+
dotenv: "^16.4.7",
|
|
22047
22061
|
"fast-glob": "^3.3.2",
|
|
22048
22062
|
finalhandler: "^1.3.1",
|
|
22049
22063
|
"formdata-node": "^6.0.3",
|