@embeddable.com/sdk-core 3.9.0 → 3.9.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/lib/defineConfig.d.ts +3 -3
- package/lib/index.esm.js +27 -44
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +24 -41
- package/lib/index.js.map +1 -1
- package/lib/push.d.ts +1 -2
- package/package.json +1 -1
- package/src/defineConfig.test.ts +1 -1
- package/src/defineConfig.ts +3 -6
- package/src/dev.test.ts +1 -1
- package/src/dev.ts +15 -25
- package/src/push.ts +6 -30
package/lib/index.js
CHANGED
|
@@ -51,6 +51,7 @@ var fs__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(fs$1);
|
|
|
51
51
|
var os__namespace = /*#__PURE__*/_interopNamespaceDefault(os);
|
|
52
52
|
var YAML__namespace = /*#__PURE__*/_interopNamespaceDefault(YAML);
|
|
53
53
|
var url__namespace = /*#__PURE__*/_interopNamespaceDefault(url);
|
|
54
|
+
var require$$2__namespace = /*#__PURE__*/_interopNamespaceDefault(require$$2$1);
|
|
54
55
|
var path__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(path$1);
|
|
55
56
|
var archiver__namespace = /*#__PURE__*/_interopNamespaceDefault(archiver);
|
|
56
57
|
var http__namespace = /*#__PURE__*/_interopNamespaceDefault(http);
|
|
@@ -21382,9 +21383,6 @@ async function selectWorkspace(ora, ctx, token) {
|
|
|
21382
21383
|
const oraP$1 = import('ora');
|
|
21383
21384
|
// grab .cube.yml|js and .sc.yml|js files
|
|
21384
21385
|
const YAML_OR_JS_FILES = /^(.*)\.(cube|sc)\.(ya?ml|js)$/;
|
|
21385
|
-
// grab all files in self-serve-customization folder
|
|
21386
|
-
const SELF_SERVE_CUSTOM_FILES = /^(style\.css|.*\.svg)$/;
|
|
21387
|
-
const customSelfServeFolder = "self-serve-customization/";
|
|
21388
21386
|
let ora$1;
|
|
21389
21387
|
var push = async () => {
|
|
21390
21388
|
var _a, _b;
|
|
@@ -21466,24 +21464,20 @@ async function verify(ctx) {
|
|
|
21466
21464
|
async function buildArchive(config) {
|
|
21467
21465
|
const spinnerArchive = ora$1("Building...").start();
|
|
21468
21466
|
const filesList = await findFiles(config.client.modelsSrc || config.client.srcDir, YAML_OR_JS_FILES);
|
|
21469
|
-
|
|
21470
|
-
// check existance of self-serve-customization folder
|
|
21471
|
-
try {
|
|
21472
|
-
await fs__namespace.access(config.client.selfServeCustomizationDir);
|
|
21473
|
-
selfServeFiles = await findFiles(`${config.client.selfServeCustomizationDir}`, SELF_SERVE_CUSTOM_FILES);
|
|
21474
|
-
}
|
|
21475
|
-
catch (e) { }
|
|
21476
|
-
await archive(config, filesList, selfServeFiles);
|
|
21467
|
+
await archive(config, filesList);
|
|
21477
21468
|
return spinnerArchive.succeed("Bundling completed");
|
|
21478
21469
|
}
|
|
21479
|
-
async function archive(ctx, yamlFiles,
|
|
21470
|
+
async function archive(ctx, yamlFiles, isDev = false) {
|
|
21480
21471
|
const output = fs__namespace$1.createWriteStream(ctx.client.archiveFile);
|
|
21481
21472
|
const _archiver = archiver__namespace.create("zip", {
|
|
21482
21473
|
zlib: { level: 9 },
|
|
21483
21474
|
});
|
|
21484
21475
|
_archiver.pipe(output);
|
|
21485
|
-
if (
|
|
21476
|
+
if (!isDev) {
|
|
21486
21477
|
_archiver.directory(ctx.client.buildDir, false);
|
|
21478
|
+
_archiver.file(ctx.client.globalCss, {
|
|
21479
|
+
name: "global.css",
|
|
21480
|
+
});
|
|
21487
21481
|
}
|
|
21488
21482
|
for (const fileData of yamlFiles) {
|
|
21489
21483
|
const fileName = fileData[1].split("/").pop();
|
|
@@ -21491,14 +21485,6 @@ async function archive(ctx, yamlFiles, selfServeFiles = [], includeBuild = true)
|
|
|
21491
21485
|
name: fileName,
|
|
21492
21486
|
});
|
|
21493
21487
|
}
|
|
21494
|
-
if (selfServeFiles.length > 0) {
|
|
21495
|
-
for (const fileData of selfServeFiles) {
|
|
21496
|
-
const fileName = fileData[1].split("/").pop();
|
|
21497
|
-
_archiver.file(fileData[1], {
|
|
21498
|
-
name: `${customSelfServeFolder}${fileName}`,
|
|
21499
|
-
});
|
|
21500
|
-
}
|
|
21501
|
-
}
|
|
21502
21488
|
await _archiver.finalize();
|
|
21503
21489
|
return new Promise((resolve, _reject) => {
|
|
21504
21490
|
output.on("close", resolve);
|
|
@@ -21546,7 +21532,7 @@ let ora;
|
|
|
21546
21532
|
let previewWorkspace;
|
|
21547
21533
|
const SERVER_PORT = 8926;
|
|
21548
21534
|
const BUILD_DEV_DIR = ".embeddable-dev-build";
|
|
21549
|
-
const
|
|
21535
|
+
const GLOBAL_CSS = "/global.css";
|
|
21550
21536
|
const buildWebComponent = async (config) => {
|
|
21551
21537
|
await generate(config, "sdk-react");
|
|
21552
21538
|
};
|
|
@@ -21600,7 +21586,6 @@ var dev = async () => {
|
|
|
21600
21586
|
const finalhandler = require("finalhandler");
|
|
21601
21587
|
const serveStatic = require("serve-static");
|
|
21602
21588
|
const serve = serveStatic(config.client.buildDir);
|
|
21603
|
-
const serveSelfeServe = serveStatic(config.client.selfServeCustomizationDir);
|
|
21604
21589
|
const workspacePreparation = ora("Preparing workspace...").start();
|
|
21605
21590
|
try {
|
|
21606
21591
|
previewWorkspace = await getPreviewWorkspace(workspacePreparation, config);
|
|
@@ -21611,7 +21596,7 @@ var dev = async () => {
|
|
|
21611
21596
|
}
|
|
21612
21597
|
workspacePreparation.succeed("Workspace is ready");
|
|
21613
21598
|
const server = http__namespace.createServer((request, res) => {
|
|
21614
|
-
var _a
|
|
21599
|
+
var _a;
|
|
21615
21600
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
21616
21601
|
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
21617
21602
|
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
|
@@ -21622,11 +21607,12 @@ var dev = async () => {
|
|
|
21622
21607
|
return;
|
|
21623
21608
|
}
|
|
21624
21609
|
const done = finalhandler(request, res);
|
|
21625
|
-
|
|
21626
|
-
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
|
|
21610
|
+
if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.endsWith(GLOBAL_CSS)) {
|
|
21611
|
+
res.writeHead(200, { "Content-Type": "text/css" });
|
|
21612
|
+
res.end(require$$2__namespace.readFileSync(config.client.globalCss));
|
|
21613
|
+
return;
|
|
21614
|
+
}
|
|
21615
|
+
serve(request, res, done);
|
|
21630
21616
|
});
|
|
21631
21617
|
wss = new ws.WebSocketServer({ server });
|
|
21632
21618
|
server.listen(SERVER_PORT, async () => {
|
|
@@ -21656,9 +21642,9 @@ var dev = async () => {
|
|
|
21656
21642
|
watchers.push(watcher);
|
|
21657
21643
|
}
|
|
21658
21644
|
const dataModelAndSecurityContextWatch = dataModelAndSecurityContextWatcher(config);
|
|
21659
|
-
const
|
|
21645
|
+
const customGlobalCssWatch = globalCssWatcher(config);
|
|
21660
21646
|
watchers.push(dataModelAndSecurityContextWatch);
|
|
21661
|
-
watchers.push(
|
|
21647
|
+
watchers.push(customGlobalCssWatch);
|
|
21662
21648
|
});
|
|
21663
21649
|
};
|
|
21664
21650
|
const configureWatcher = async (watcher, ctx) => {
|
|
@@ -21714,13 +21700,10 @@ const dataModelAndSecurityContextWatcher = (ctx) => {
|
|
|
21714
21700
|
});
|
|
21715
21701
|
return fsWatcher;
|
|
21716
21702
|
};
|
|
21717
|
-
const
|
|
21718
|
-
const fsWatcher = chokidar__namespace.watch(
|
|
21719
|
-
path__namespace$1.resolve(ctx.client.selfServeCustomizationDir, "style.css"),
|
|
21720
|
-
path__namespace$1.resolve(ctx.client.selfServeCustomizationDir, "*.svg"),
|
|
21721
|
-
], chokidarWatchOptions);
|
|
21703
|
+
const globalCssWatcher = (ctx) => {
|
|
21704
|
+
const fsWatcher = chokidar__namespace.watch(ctx.client.globalCss, chokidarWatchOptions);
|
|
21722
21705
|
fsWatcher.on("all", async () => {
|
|
21723
|
-
sendMessage("
|
|
21706
|
+
sendMessage("globalCssUpdateSuccess");
|
|
21724
21707
|
});
|
|
21725
21708
|
return fsWatcher;
|
|
21726
21709
|
};
|
|
@@ -21736,7 +21719,7 @@ const sendDataModelsAndSecurityContextsChanges = async (ctx) => {
|
|
|
21736
21719
|
"embeddable-manifest",
|
|
21737
21720
|
path__namespace$1.resolve(ctx.client.buildDir, "embeddable-manifest.json"),
|
|
21738
21721
|
]);
|
|
21739
|
-
await archive(ctx, filesList,
|
|
21722
|
+
await archive(ctx, filesList, true);
|
|
21740
21723
|
await sendBuild(ctx, { workspaceId: previewWorkspace, token });
|
|
21741
21724
|
sending.succeed(`Data models and/or security context synchronized`);
|
|
21742
21725
|
sendMessage("dataModelsAndOrSecurityContextUpdateSuccess");
|
|
@@ -21793,7 +21776,7 @@ const getPreviewWorkspace = async (startedOra, ctx) => {
|
|
|
21793
21776
|
}
|
|
21794
21777
|
};
|
|
21795
21778
|
|
|
21796
|
-
var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc = "src", componentsSrc = "src",
|
|
21779
|
+
var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc = "src", componentsSrc = "src", globalCss = "src/global.css", viteConfig = {}, rollupOptions = {}, }) => {
|
|
21797
21780
|
const coreRoot = path__namespace.resolve(__dirname, "..");
|
|
21798
21781
|
const clientRoot = process.cwd();
|
|
21799
21782
|
if (!path__namespace.isAbsolute(componentsSrc)) {
|
|
@@ -21820,7 +21803,7 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
|
|
|
21820
21803
|
modelsSrc: modelsSrc ? path__namespace.resolve(clientRoot, modelsSrc) : undefined,
|
|
21821
21804
|
buildDir: path__namespace.resolve(clientRoot, ".embeddable-build"),
|
|
21822
21805
|
tmpDir: path__namespace.resolve(clientRoot, ".embeddable-tmp"),
|
|
21823
|
-
|
|
21806
|
+
globalCss: path__namespace.resolve(clientRoot, globalCss),
|
|
21824
21807
|
componentDir: path__namespace.resolve(clientRoot, ".embeddable-build", "component"),
|
|
21825
21808
|
stencilBuild: path__namespace.resolve(clientRoot, ".embeddable-build", "dist", "embeddable-wrapper"),
|
|
21826
21809
|
archiveFile: path__namespace.resolve(clientRoot, "embeddable-build.zip"),
|
|
@@ -21846,7 +21829,7 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
|
|
|
21846
21829
|
};
|
|
21847
21830
|
|
|
21848
21831
|
var name = "@embeddable.com/sdk-core";
|
|
21849
|
-
var version = "3.9.
|
|
21832
|
+
var version = "3.9.1";
|
|
21850
21833
|
var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
|
|
21851
21834
|
var keywords = [
|
|
21852
21835
|
"embeddable",
|