@embeddable.com/sdk-core 4.0.2-next.0 → 4.0.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/lib/defineConfig.d.ts +2 -0
- package/lib/index.esm.js +16 -14
- package/lib/index.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/defineConfig.test.ts +1 -0
- package/src/defineConfig.ts +12 -1
- package/src/dev.ts +5 -4
- package/src/generate.test.ts +6 -5
- package/src/generate.ts +10 -12
- package/src/prepare.ts +4 -2
package/lib/defineConfig.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export type ResolvedEmbeddableConfig = {
|
|
|
51
51
|
buildDir: string;
|
|
52
52
|
tmpDir: string;
|
|
53
53
|
customCanvasCss: string;
|
|
54
|
+
webComponentRoot: string;
|
|
54
55
|
componentDir: string;
|
|
55
56
|
stencilBuild: string;
|
|
56
57
|
archiveFile: string;
|
|
@@ -221,6 +222,7 @@ declare const _default: (config: EmbeddableConfig) => {
|
|
|
221
222
|
buildDir: string;
|
|
222
223
|
tmpDir: string;
|
|
223
224
|
customCanvasCss: string;
|
|
225
|
+
webComponentRoot: string;
|
|
224
226
|
componentDir: string;
|
|
225
227
|
stencilBuild: string;
|
|
226
228
|
archiveFile: string;
|
package/lib/index.esm.js
CHANGED
|
@@ -650,10 +650,12 @@ async function removeIfExists(ctx) {
|
|
|
650
650
|
await Promise.all(promises);
|
|
651
651
|
}
|
|
652
652
|
async function copyStencilConfigsToClient(ctx) {
|
|
653
|
-
await fs.cp(ctx.core.configsDir, ctx.client.
|
|
653
|
+
await fs.cp(ctx.core.configsDir, ctx.client.webComponentRoot, {
|
|
654
|
+
recursive: true,
|
|
655
|
+
});
|
|
654
656
|
}
|
|
655
657
|
async function createComponentDir(dir) {
|
|
656
|
-
await fs.mkdir(dir);
|
|
658
|
+
await fs.mkdir(dir, { recursive: true });
|
|
657
659
|
}
|
|
658
660
|
|
|
659
661
|
const STYLE_IMPORTS_TOKEN = "{{STYLES_IMPORT}}";
|
|
@@ -671,7 +673,7 @@ async function injectCSS(ctx, pluginName) {
|
|
|
671
673
|
const allFiles = await fs.readdir(CUSTOMER_BUILD);
|
|
672
674
|
const imports = allFiles
|
|
673
675
|
.filter((fileName) => fileName.endsWith(".css"))
|
|
674
|
-
.map((fileName) => `@import '
|
|
676
|
+
.map((fileName) => `@import '../../${ctx[pluginName].outputOptions.buildName}/${fileName}';`);
|
|
675
677
|
const componentLibraries = ctx.client.componentLibraries;
|
|
676
678
|
for (const componentLibrary of componentLibraries) {
|
|
677
679
|
const { libraryName } = getComponentLibraryConfig(componentLibrary);
|
|
@@ -686,7 +688,7 @@ async function injectCSS(ctx, pluginName) {
|
|
|
686
688
|
}
|
|
687
689
|
async function injectBundleRender(ctx, pluginName) {
|
|
688
690
|
var _a;
|
|
689
|
-
const importStr = `import render from '
|
|
691
|
+
const importStr = `import render from '../../${ctx[pluginName].outputOptions.buildName}/${ctx[pluginName].outputOptions.fileName}';`;
|
|
690
692
|
let content = await fs.readFile(path$1.resolve(ctx.core.templatesDir, "component.tsx.template"), "utf8");
|
|
691
693
|
if (!!((_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch)) {
|
|
692
694
|
content = content.replace(COMPONENT_TAG_TOKEN, "embeddable-component");
|
|
@@ -724,22 +726,20 @@ async function runStencil(ctx) {
|
|
|
724
726
|
config: {
|
|
725
727
|
devMode,
|
|
726
728
|
maxConcurrentWorkers: isWindows ? 0 : 8, // workers break on windows
|
|
727
|
-
rootDir: ctx.client.
|
|
728
|
-
configPath: path$1.resolve(ctx.client.
|
|
729
|
-
tsconfig: path$1.resolve(ctx.client.
|
|
729
|
+
rootDir: ctx.client.webComponentRoot,
|
|
730
|
+
configPath: path$1.resolve(ctx.client.webComponentRoot, "stencil.config.ts"),
|
|
731
|
+
tsconfig: path$1.resolve(ctx.client.webComponentRoot, "tsconfig.json"),
|
|
730
732
|
namespace: "embeddable-wrapper",
|
|
731
|
-
srcDir:
|
|
733
|
+
srcDir: ctx.client.componentDir,
|
|
732
734
|
sourceMap: true, // always generate source maps in both dev and prod
|
|
733
735
|
minifyJs: !devMode,
|
|
734
736
|
minifyCss: !devMode,
|
|
735
737
|
outputTargets: [
|
|
736
738
|
{
|
|
737
739
|
type: "dist",
|
|
740
|
+
buildDir: path$1.resolve(ctx.client.buildDir, "dist"),
|
|
738
741
|
},
|
|
739
742
|
],
|
|
740
|
-
watchDirs: [
|
|
741
|
-
path$1.resolve(ctx.client.buildDir, ctx["sdk-react"].outputOptions.buildName),
|
|
742
|
-
],
|
|
743
743
|
},
|
|
744
744
|
});
|
|
745
745
|
const compiler = await createCompiler(validated.config);
|
|
@@ -22156,7 +22156,8 @@ var dev = async () => {
|
|
|
22156
22156
|
client: {
|
|
22157
22157
|
...defaultConfig.client,
|
|
22158
22158
|
buildDir,
|
|
22159
|
-
|
|
22159
|
+
webComponentRoot: path.resolve(buildDir, "web-component"),
|
|
22160
|
+
componentDir: path.resolve(buildDir, "web-component", "component"),
|
|
22160
22161
|
stencilBuild: path.resolve(buildDir, "dist", "embeddable-wrapper"),
|
|
22161
22162
|
tmpDir: path.resolve(defaultConfig.client.rootDir, ".embeddable-dev-tmp"),
|
|
22162
22163
|
},
|
|
@@ -22397,7 +22398,7 @@ const sendBuildChanges = async (ctx) => {
|
|
|
22397
22398
|
await sendBuild(ctx, { workspaceId: previewWorkspace, token });
|
|
22398
22399
|
}
|
|
22399
22400
|
catch (e) {
|
|
22400
|
-
sending.fail(`Data models and/or security context synchronization failed with error: ${(_d = (_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.errorMessage) !== null && _c !== void 0 ? _c : e.message) !== null && _d !== void 0 ? _d :
|
|
22401
|
+
sending.fail(`Data models and/or security context synchronization failed with error: ${(_d = (_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.errorMessage) !== null && _c !== void 0 ? _c : e.message) !== null && _d !== void 0 ? _d : "Unknown error"}`);
|
|
22401
22402
|
return sendMessage("dataModelsAndOrSecurityContextUpdateError");
|
|
22402
22403
|
}
|
|
22403
22404
|
sending.succeed(`Data models and/or security context synchronized`);
|
|
@@ -22569,7 +22570,8 @@ var defineConfig = (config) => {
|
|
|
22569
22570
|
buildDir: path$1.resolve(clientRoot, ".embeddable-build"),
|
|
22570
22571
|
tmpDir: path$1.resolve(clientRoot, ".embeddable-tmp"),
|
|
22571
22572
|
customCanvasCss: path$1.resolve(clientRoot, customCanvasCss),
|
|
22572
|
-
|
|
22573
|
+
webComponentRoot: path$1.resolve(clientRoot, ".embeddable-build", "web-component"),
|
|
22574
|
+
componentDir: path$1.resolve(clientRoot, ".embeddable-build", "web-component", "component"),
|
|
22573
22575
|
stencilBuild: path$1.resolve(clientRoot, ".embeddable-build", "dist", "embeddable-wrapper"),
|
|
22574
22576
|
archiveFile: path$1.resolve(clientRoot, "embeddable-build.zip"),
|
|
22575
22577
|
errorFallbackComponent: errorFallbackComponent
|