@embeddable.com/sdk-core 3.1.6 → 3.1.8
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 +5 -2
- package/lib/index.esm.js +21 -6
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +20 -6
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/defineConfig.ts +25 -1
- package/src/push.ts +5 -2
- package/src/validate.ts +12 -11
- package/templates/component.tsx.template +17 -1
package/lib/defineConfig.d.ts
CHANGED
|
@@ -13,8 +13,10 @@ export type EmbeddableConfig = {
|
|
|
13
13
|
applicationEnvironment?: string;
|
|
14
14
|
rollbarAccessToken?: string;
|
|
15
15
|
previewBaseUrl?: string;
|
|
16
|
+
componentsSrc?: string;
|
|
17
|
+
modelsSrc?: string;
|
|
16
18
|
};
|
|
17
|
-
declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, }: EmbeddableConfig) => {
|
|
19
|
+
declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc, componentsSrc, }: EmbeddableConfig) => {
|
|
18
20
|
core: {
|
|
19
21
|
rootDir: string;
|
|
20
22
|
templatesDir: string;
|
|
@@ -22,8 +24,9 @@ declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authCl
|
|
|
22
24
|
};
|
|
23
25
|
client: {
|
|
24
26
|
rootDir: string;
|
|
25
|
-
buildDir: string;
|
|
26
27
|
srcDir: string;
|
|
28
|
+
modelsSrc: string | undefined;
|
|
29
|
+
buildDir: string;
|
|
27
30
|
tmpDir: string;
|
|
28
31
|
componentDir: string;
|
|
29
32
|
stencilBuild: string;
|
package/lib/index.esm.js
CHANGED
|
@@ -5,6 +5,7 @@ import { join } from 'node:path';
|
|
|
5
5
|
import * as vite from 'vite';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import * as fs$2 from 'node:fs';
|
|
8
|
+
import { existsSync } from 'node:fs';
|
|
8
9
|
import { createNodeLogger, createNodeSys } from '@stencil/core/sys/node';
|
|
9
10
|
import { loadConfig, createCompiler } from '@stencil/core/compiler';
|
|
10
11
|
import * as YAML from 'yaml';
|
|
@@ -4515,7 +4516,7 @@ var validate = async (ctx, exitIfInvalid = true) => {
|
|
|
4515
4516
|
const ora = (await import('ora')).default;
|
|
4516
4517
|
const spinnerValidate = ora("Data model validation...").start();
|
|
4517
4518
|
const filesList = await findFiles(ctx.client.srcDir, CUBE_YAML_FILE_REGEX);
|
|
4518
|
-
const securityContextFilesList = await findFiles(ctx.client.srcDir, SECURITY_CONTEXT_FILE_REGEX);
|
|
4519
|
+
const securityContextFilesList = await findFiles(ctx.client.modelsSrc || ctx.client.srcDir, SECURITY_CONTEXT_FILE_REGEX);
|
|
4519
4520
|
const dataModelErrors = await dataModelsValidation(filesList);
|
|
4520
4521
|
if (dataModelErrors.length) {
|
|
4521
4522
|
spinnerValidate.fail("One or more cube.yaml files are invalid:");
|
|
@@ -4631,13 +4632,14 @@ const cubeModelSchema = z
|
|
|
4631
4632
|
path: ["cubes"],
|
|
4632
4633
|
});
|
|
4633
4634
|
const viewModelSchema = z.object({
|
|
4634
|
-
views: z
|
|
4635
|
+
views: z
|
|
4636
|
+
.object({
|
|
4635
4637
|
name: z.string(),
|
|
4636
4638
|
cubes: z
|
|
4637
4639
|
.object({
|
|
4638
4640
|
join_path: z.string(),
|
|
4639
4641
|
})
|
|
4640
|
-
.array()
|
|
4642
|
+
.array(),
|
|
4641
4643
|
})
|
|
4642
4644
|
.array()
|
|
4643
4645
|
.min(1),
|
|
@@ -20226,7 +20228,7 @@ async function verify(ctx) {
|
|
|
20226
20228
|
}
|
|
20227
20229
|
async function buildArchive(config) {
|
|
20228
20230
|
const spinnerArchive = ora$1("Building...").start();
|
|
20229
|
-
const filesList = await findFiles(config.client.srcDir, YAML_OR_JS_FILES);
|
|
20231
|
+
const filesList = await findFiles(config.client.modelsSrc || config.client.srcDir, YAML_OR_JS_FILES);
|
|
20230
20232
|
await archive(config, filesList);
|
|
20231
20233
|
return spinnerArchive.succeed("Bundling completed");
|
|
20232
20234
|
}
|
|
@@ -20487,9 +20489,21 @@ const getPreviewWorkspace = async (ctx) => {
|
|
|
20487
20489
|
}
|
|
20488
20490
|
};
|
|
20489
20491
|
|
|
20490
|
-
var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, }) => {
|
|
20492
|
+
var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc, componentsSrc = "src", }) => {
|
|
20491
20493
|
const coreRoot = path$1.resolve(__dirname, "..");
|
|
20492
20494
|
const clientRoot = process.cwd();
|
|
20495
|
+
if (!path$1.isAbsolute(componentsSrc)) {
|
|
20496
|
+
componentsSrc = path$1.resolve(clientRoot, componentsSrc);
|
|
20497
|
+
if (!existsSync(componentsSrc)) {
|
|
20498
|
+
throw new Error(`componentsSrc directory ${componentsSrc} does not exist`);
|
|
20499
|
+
}
|
|
20500
|
+
}
|
|
20501
|
+
if (modelsSrc && !path$1.isAbsolute(modelsSrc)) {
|
|
20502
|
+
modelsSrc = path$1.resolve(clientRoot, modelsSrc);
|
|
20503
|
+
if (!existsSync(modelsSrc)) {
|
|
20504
|
+
throw new Error(`modelsSrc directory ${modelsSrc} does not exist`);
|
|
20505
|
+
}
|
|
20506
|
+
}
|
|
20493
20507
|
return {
|
|
20494
20508
|
core: {
|
|
20495
20509
|
rootDir: coreRoot,
|
|
@@ -20498,8 +20512,9 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
|
|
|
20498
20512
|
},
|
|
20499
20513
|
client: {
|
|
20500
20514
|
rootDir: clientRoot,
|
|
20515
|
+
srcDir: path$1.resolve(clientRoot, componentsSrc),
|
|
20516
|
+
modelsSrc: modelsSrc ? path$1.resolve(clientRoot, modelsSrc) : undefined,
|
|
20501
20517
|
buildDir: path$1.resolve(clientRoot, ".embeddable-build"),
|
|
20502
|
-
srcDir: path$1.resolve(clientRoot, "src"),
|
|
20503
20518
|
tmpDir: path$1.resolve(clientRoot, ".embeddable-tmp"),
|
|
20504
20519
|
componentDir: path$1.resolve(clientRoot, ".embeddable-build", "component"),
|
|
20505
20520
|
stencilBuild: path$1.resolve(clientRoot, ".embeddable-build", "dist", "embeddable-wrapper"),
|