@embeddable.com/sdk-core 3.9.0-next.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 -45
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +24 -42
- package/lib/index.js.map +1 -1
- package/lib/push.d.ts +1 -2
- package/loader/custom-esm-loader.mjs +0 -18
- 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/generate.test.ts +0 -1
- package/src/generate.ts +0 -1
- package/src/push.ts +6 -30
package/lib/defineConfig.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type EmbeddableConfig = {
|
|
|
16
16
|
previewBaseUrl?: string;
|
|
17
17
|
componentsSrc?: string;
|
|
18
18
|
modelsSrc?: string;
|
|
19
|
-
|
|
19
|
+
globalCss?: string;
|
|
20
20
|
viteConfig?: {
|
|
21
21
|
resolve?: {
|
|
22
22
|
alias?: Record<string, string>;
|
|
@@ -24,7 +24,7 @@ export type EmbeddableConfig = {
|
|
|
24
24
|
};
|
|
25
25
|
rollupOptions?: RollupOptions;
|
|
26
26
|
};
|
|
27
|
-
declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc, componentsSrc,
|
|
27
|
+
declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc, componentsSrc, globalCss, viteConfig, rollupOptions, }: EmbeddableConfig) => {
|
|
28
28
|
core: {
|
|
29
29
|
rootDir: string;
|
|
30
30
|
templatesDir: string;
|
|
@@ -36,7 +36,7 @@ declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authCl
|
|
|
36
36
|
modelsSrc: string | undefined;
|
|
37
37
|
buildDir: string;
|
|
38
38
|
tmpDir: string;
|
|
39
|
-
|
|
39
|
+
globalCss: string;
|
|
40
40
|
componentDir: string;
|
|
41
41
|
stencilBuild: string;
|
|
42
42
|
archiveFile: string;
|
package/lib/index.esm.js
CHANGED
|
@@ -17,7 +17,8 @@ import require$$1 from 'os';
|
|
|
17
17
|
import require$$3 from 'http';
|
|
18
18
|
import require$$4 from 'https';
|
|
19
19
|
import require$$0$1 from 'url';
|
|
20
|
-
import require$$2$1
|
|
20
|
+
import * as require$$2$1 from 'fs';
|
|
21
|
+
import require$$2__default, { createReadStream } from 'fs';
|
|
21
22
|
import * as path$1 from 'path';
|
|
22
23
|
import path__default$1, { basename } from 'path';
|
|
23
24
|
import axios from 'axios';
|
|
@@ -489,7 +490,6 @@ async function runStencil(ctx) {
|
|
|
489
490
|
sys,
|
|
490
491
|
config: {
|
|
491
492
|
devMode,
|
|
492
|
-
enableCache: true,
|
|
493
493
|
maxConcurrentWorkers: isWindows ? 0 : 8, // workers break on windows
|
|
494
494
|
rootDir: ctx.client.buildDir,
|
|
495
495
|
configPath: path.resolve(ctx.client.buildDir, "stencil.config.ts"),
|
|
@@ -17856,7 +17856,7 @@ function requireStackTrace () {
|
|
|
17856
17856
|
hasRequiredStackTrace = 1;
|
|
17857
17857
|
var SourceMapConsumer = requireSourceMap().SourceMapConsumer;
|
|
17858
17858
|
var path = path__default$1;
|
|
17859
|
-
var fs = require$$
|
|
17859
|
+
var fs = require$$2__default;
|
|
17860
17860
|
|
|
17861
17861
|
/**
|
|
17862
17862
|
* Uses Node source-map to map transpiled JS stack locations to original
|
|
@@ -18064,7 +18064,7 @@ function requireParser () {
|
|
|
18064
18064
|
|
|
18065
18065
|
var logger = requireLogger();
|
|
18066
18066
|
var async = require$$0;
|
|
18067
|
-
var fs = require$$
|
|
18067
|
+
var fs = require$$2__default;
|
|
18068
18068
|
var lru = requireLruCache();
|
|
18069
18069
|
var util = require$$4$1;
|
|
18070
18070
|
var stackTrace = requireStackTrace();
|
|
@@ -21355,9 +21355,6 @@ async function selectWorkspace(ora, ctx, token) {
|
|
|
21355
21355
|
const oraP$1 = import('ora');
|
|
21356
21356
|
// grab .cube.yml|js and .sc.yml|js files
|
|
21357
21357
|
const YAML_OR_JS_FILES = /^(.*)\.(cube|sc)\.(ya?ml|js)$/;
|
|
21358
|
-
// grab all files in self-serve-customization folder
|
|
21359
|
-
const SELF_SERVE_CUSTOM_FILES = /^(style\.css|.*\.svg)$/;
|
|
21360
|
-
const customSelfServeFolder = "self-serve-customization/";
|
|
21361
21358
|
let ora$1;
|
|
21362
21359
|
var push = async () => {
|
|
21363
21360
|
var _a, _b;
|
|
@@ -21439,24 +21436,20 @@ async function verify(ctx) {
|
|
|
21439
21436
|
async function buildArchive(config) {
|
|
21440
21437
|
const spinnerArchive = ora$1("Building...").start();
|
|
21441
21438
|
const filesList = await findFiles(config.client.modelsSrc || config.client.srcDir, YAML_OR_JS_FILES);
|
|
21442
|
-
|
|
21443
|
-
// check existance of self-serve-customization folder
|
|
21444
|
-
try {
|
|
21445
|
-
await fs.access(config.client.selfServeCustomizationDir);
|
|
21446
|
-
selfServeFiles = await findFiles(`${config.client.selfServeCustomizationDir}`, SELF_SERVE_CUSTOM_FILES);
|
|
21447
|
-
}
|
|
21448
|
-
catch (e) { }
|
|
21449
|
-
await archive(config, filesList, selfServeFiles);
|
|
21439
|
+
await archive(config, filesList);
|
|
21450
21440
|
return spinnerArchive.succeed("Bundling completed");
|
|
21451
21441
|
}
|
|
21452
|
-
async function archive(ctx, yamlFiles,
|
|
21442
|
+
async function archive(ctx, yamlFiles, isDev = false) {
|
|
21453
21443
|
const output = fs$1.createWriteStream(ctx.client.archiveFile);
|
|
21454
21444
|
const _archiver = archiver.create("zip", {
|
|
21455
21445
|
zlib: { level: 9 },
|
|
21456
21446
|
});
|
|
21457
21447
|
_archiver.pipe(output);
|
|
21458
|
-
if (
|
|
21448
|
+
if (!isDev) {
|
|
21459
21449
|
_archiver.directory(ctx.client.buildDir, false);
|
|
21450
|
+
_archiver.file(ctx.client.globalCss, {
|
|
21451
|
+
name: "global.css",
|
|
21452
|
+
});
|
|
21460
21453
|
}
|
|
21461
21454
|
for (const fileData of yamlFiles) {
|
|
21462
21455
|
const fileName = fileData[1].split("/").pop();
|
|
@@ -21464,14 +21457,6 @@ async function archive(ctx, yamlFiles, selfServeFiles = [], includeBuild = true)
|
|
|
21464
21457
|
name: fileName,
|
|
21465
21458
|
});
|
|
21466
21459
|
}
|
|
21467
|
-
if (selfServeFiles.length > 0) {
|
|
21468
|
-
for (const fileData of selfServeFiles) {
|
|
21469
|
-
const fileName = fileData[1].split("/").pop();
|
|
21470
|
-
_archiver.file(fileData[1], {
|
|
21471
|
-
name: `${customSelfServeFolder}${fileName}`,
|
|
21472
|
-
});
|
|
21473
|
-
}
|
|
21474
|
-
}
|
|
21475
21460
|
await _archiver.finalize();
|
|
21476
21461
|
return new Promise((resolve, _reject) => {
|
|
21477
21462
|
output.on("close", resolve);
|
|
@@ -21519,7 +21504,7 @@ let ora;
|
|
|
21519
21504
|
let previewWorkspace;
|
|
21520
21505
|
const SERVER_PORT = 8926;
|
|
21521
21506
|
const BUILD_DEV_DIR = ".embeddable-dev-build";
|
|
21522
|
-
const
|
|
21507
|
+
const GLOBAL_CSS = "/global.css";
|
|
21523
21508
|
const buildWebComponent = async (config) => {
|
|
21524
21509
|
await generate(config, "sdk-react");
|
|
21525
21510
|
};
|
|
@@ -21573,7 +21558,6 @@ var dev = async () => {
|
|
|
21573
21558
|
const finalhandler = require("finalhandler");
|
|
21574
21559
|
const serveStatic = require("serve-static");
|
|
21575
21560
|
const serve = serveStatic(config.client.buildDir);
|
|
21576
|
-
const serveSelfeServe = serveStatic(config.client.selfServeCustomizationDir);
|
|
21577
21561
|
const workspacePreparation = ora("Preparing workspace...").start();
|
|
21578
21562
|
try {
|
|
21579
21563
|
previewWorkspace = await getPreviewWorkspace(workspacePreparation, config);
|
|
@@ -21584,7 +21568,7 @@ var dev = async () => {
|
|
|
21584
21568
|
}
|
|
21585
21569
|
workspacePreparation.succeed("Workspace is ready");
|
|
21586
21570
|
const server = http.createServer((request, res) => {
|
|
21587
|
-
var _a
|
|
21571
|
+
var _a;
|
|
21588
21572
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
21589
21573
|
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
21590
21574
|
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
|
@@ -21595,11 +21579,12 @@ var dev = async () => {
|
|
|
21595
21579
|
return;
|
|
21596
21580
|
}
|
|
21597
21581
|
const done = finalhandler(request, res);
|
|
21598
|
-
|
|
21599
|
-
|
|
21600
|
-
|
|
21601
|
-
|
|
21602
|
-
|
|
21582
|
+
if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.endsWith(GLOBAL_CSS)) {
|
|
21583
|
+
res.writeHead(200, { "Content-Type": "text/css" });
|
|
21584
|
+
res.end(require$$2$1.readFileSync(config.client.globalCss));
|
|
21585
|
+
return;
|
|
21586
|
+
}
|
|
21587
|
+
serve(request, res, done);
|
|
21603
21588
|
});
|
|
21604
21589
|
wss = new WebSocketServer({ server });
|
|
21605
21590
|
server.listen(SERVER_PORT, async () => {
|
|
@@ -21629,9 +21614,9 @@ var dev = async () => {
|
|
|
21629
21614
|
watchers.push(watcher);
|
|
21630
21615
|
}
|
|
21631
21616
|
const dataModelAndSecurityContextWatch = dataModelAndSecurityContextWatcher(config);
|
|
21632
|
-
const
|
|
21617
|
+
const customGlobalCssWatch = globalCssWatcher(config);
|
|
21633
21618
|
watchers.push(dataModelAndSecurityContextWatch);
|
|
21634
|
-
watchers.push(
|
|
21619
|
+
watchers.push(customGlobalCssWatch);
|
|
21635
21620
|
});
|
|
21636
21621
|
};
|
|
21637
21622
|
const configureWatcher = async (watcher, ctx) => {
|
|
@@ -21687,13 +21672,10 @@ const dataModelAndSecurityContextWatcher = (ctx) => {
|
|
|
21687
21672
|
});
|
|
21688
21673
|
return fsWatcher;
|
|
21689
21674
|
};
|
|
21690
|
-
const
|
|
21691
|
-
const fsWatcher = chokidar.watch(
|
|
21692
|
-
path$1.resolve(ctx.client.selfServeCustomizationDir, "style.css"),
|
|
21693
|
-
path$1.resolve(ctx.client.selfServeCustomizationDir, "*.svg"),
|
|
21694
|
-
], chokidarWatchOptions);
|
|
21675
|
+
const globalCssWatcher = (ctx) => {
|
|
21676
|
+
const fsWatcher = chokidar.watch(ctx.client.globalCss, chokidarWatchOptions);
|
|
21695
21677
|
fsWatcher.on("all", async () => {
|
|
21696
|
-
sendMessage("
|
|
21678
|
+
sendMessage("globalCssUpdateSuccess");
|
|
21697
21679
|
});
|
|
21698
21680
|
return fsWatcher;
|
|
21699
21681
|
};
|
|
@@ -21709,7 +21691,7 @@ const sendDataModelsAndSecurityContextsChanges = async (ctx) => {
|
|
|
21709
21691
|
"embeddable-manifest",
|
|
21710
21692
|
path$1.resolve(ctx.client.buildDir, "embeddable-manifest.json"),
|
|
21711
21693
|
]);
|
|
21712
|
-
await archive(ctx, filesList,
|
|
21694
|
+
await archive(ctx, filesList, true);
|
|
21713
21695
|
await sendBuild(ctx, { workspaceId: previewWorkspace, token });
|
|
21714
21696
|
sending.succeed(`Data models and/or security context synchronized`);
|
|
21715
21697
|
sendMessage("dataModelsAndOrSecurityContextUpdateSuccess");
|
|
@@ -21766,7 +21748,7 @@ const getPreviewWorkspace = async (startedOra, ctx) => {
|
|
|
21766
21748
|
}
|
|
21767
21749
|
};
|
|
21768
21750
|
|
|
21769
|
-
var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc = "src", componentsSrc = "src",
|
|
21751
|
+
var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc = "src", componentsSrc = "src", globalCss = "src/global.css", viteConfig = {}, rollupOptions = {}, }) => {
|
|
21770
21752
|
const coreRoot = path.resolve(__dirname, "..");
|
|
21771
21753
|
const clientRoot = process.cwd();
|
|
21772
21754
|
if (!path.isAbsolute(componentsSrc)) {
|
|
@@ -21793,7 +21775,7 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
|
|
|
21793
21775
|
modelsSrc: modelsSrc ? path.resolve(clientRoot, modelsSrc) : undefined,
|
|
21794
21776
|
buildDir: path.resolve(clientRoot, ".embeddable-build"),
|
|
21795
21777
|
tmpDir: path.resolve(clientRoot, ".embeddable-tmp"),
|
|
21796
|
-
|
|
21778
|
+
globalCss: path.resolve(clientRoot, globalCss),
|
|
21797
21779
|
componentDir: path.resolve(clientRoot, ".embeddable-build", "component"),
|
|
21798
21780
|
stencilBuild: path.resolve(clientRoot, ".embeddable-build", "dist", "embeddable-wrapper"),
|
|
21799
21781
|
archiveFile: path.resolve(clientRoot, "embeddable-build.zip"),
|
|
@@ -21819,7 +21801,7 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
|
|
|
21819
21801
|
};
|
|
21820
21802
|
|
|
21821
21803
|
var name = "@embeddable.com/sdk-core";
|
|
21822
|
-
var version = "3.9.
|
|
21804
|
+
var version = "3.9.1";
|
|
21823
21805
|
var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
|
|
21824
21806
|
var keywords = [
|
|
21825
21807
|
"embeddable",
|