@embeddable.com/sdk-core 3.14.2-next.1 → 3.14.2-next.3
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/dev.d.ts +8 -0
- package/lib/index.esm.js +18 -33
- package/lib/index.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/buildGlobalHooks.int.test.ts +3 -0
- package/src/buildGlobalHooks.ts +2 -1
- package/src/buildGlobalHooks.unit.test.ts +4 -0
- package/src/cleanup.ts +5 -0
- package/src/dev.test.ts +177 -7
- package/src/dev.ts +38 -29
- package/src/push.test.ts +8 -9
- package/src/push.ts +11 -2
- package/src/validate.ts +3 -24
- package/lib/index.js +0 -22492
- package/lib/index.js.map +0 -1
package/lib/dev.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
import { RollupWatcher } from "rollup";
|
|
2
|
+
import { ChildProcess } from "node:child_process";
|
|
3
|
+
import { ResolvedEmbeddableConfig } from "./defineConfig";
|
|
4
|
+
export declare const buildWebComponent: (config: any) => Promise<void>;
|
|
1
5
|
declare const _default: () => Promise<void>;
|
|
2
6
|
export default _default;
|
|
7
|
+
export declare const configureWatcher: (watcher: RollupWatcher, ctx: ResolvedEmbeddableConfig) => Promise<void>;
|
|
8
|
+
export declare const globalHookWatcher: (watcher: RollupWatcher) => Promise<void>;
|
|
9
|
+
export declare const openDevWorkspacePage: (previewBaseUrl: string, workspaceId: string) => Promise<ChildProcess>;
|
|
10
|
+
export declare const sendBuildChanges: (ctx: ResolvedEmbeddableConfig) => Promise<void>;
|
package/lib/index.esm.js
CHANGED
|
@@ -16,6 +16,7 @@ import { loadConfig, createCompiler } from '@stencil/core/compiler';
|
|
|
16
16
|
import * as sorcery from 'sorcery';
|
|
17
17
|
import * as os from 'node:os';
|
|
18
18
|
import * as YAML from 'yaml';
|
|
19
|
+
import { MEASURE_TYPES, DIMENSION_TYPES } from '@embeddable.com/core';
|
|
19
20
|
import * as url from 'node:url';
|
|
20
21
|
import require$$4$1 from 'util';
|
|
21
22
|
import require$$1 from 'os';
|
|
@@ -26,6 +27,7 @@ import require$$2$1, { createReadStream } from 'fs';
|
|
|
26
27
|
import axios from 'axios';
|
|
27
28
|
import archiver from 'archiver';
|
|
28
29
|
import { select } from '@inquirer/prompts';
|
|
30
|
+
import open from 'open';
|
|
29
31
|
import * as http from 'node:http';
|
|
30
32
|
import { WebSocketServer } from 'ws';
|
|
31
33
|
import * as chokidar from 'chokidar';
|
|
@@ -471,6 +473,7 @@ var buildGlobalHooks = async (ctx) => {
|
|
|
471
473
|
const watch = (_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch;
|
|
472
474
|
const progress = watch ? undefined : ora("Building global hooks...").start();
|
|
473
475
|
try {
|
|
476
|
+
await fs.mkdir(ctx.client.tmpDir, { recursive: true });
|
|
474
477
|
const { fileName: themeProvider, watcher: themeWatcher } = await buildThemeHook(ctx);
|
|
475
478
|
const { lifecycleHooks, watcher: lifecycleWatcher } = await buildLifecycleHooks(ctx);
|
|
476
479
|
await saveGlobalHooksMeta(ctx, themeProvider, lifecycleHooks);
|
|
@@ -610,7 +613,7 @@ async function cleanupTemporaryHookFile(ctx) {
|
|
|
610
613
|
* Get the path to the temporary hook file in the build directory.
|
|
611
614
|
*/
|
|
612
615
|
function getTempHookFilePath(ctx) {
|
|
613
|
-
return path$1.resolve(ctx.client.
|
|
616
|
+
return path$1.resolve(ctx.client.tmpDir, TEMP_JS_HOOK_FILE);
|
|
614
617
|
}
|
|
615
618
|
function waitForInitialBuild(watcher) {
|
|
616
619
|
return new Promise((resolve, reject) => {
|
|
@@ -1003,6 +1006,10 @@ async function createManifest({ ctx, typesFileName, metaFileName, editorsMetaFil
|
|
|
1003
1006
|
await fs.writeFile(path$1.join(ctx.client.tmpDir, "embeddable-manifest.json"), JSON.stringify(manifest));
|
|
1004
1007
|
}
|
|
1005
1008
|
async function extractBuild(ctx) {
|
|
1009
|
+
// Ensure tmpDir is removed before attempting to rename a directory to it.
|
|
1010
|
+
// This helps prevent EPERM errors on Windows if tmpDir already exists and is non-empty
|
|
1011
|
+
// from a previous failed run or other reasons.
|
|
1012
|
+
await fs.rm(ctx.client.tmpDir, { recursive: true, force: true });
|
|
1006
1013
|
const stencilBuildFiles = await findFiles(ctx.client.stencilBuild, /embeddable-wrapper.esm-[a-z0-9]+\.js/);
|
|
1007
1014
|
const [[, stencilWrapperFilePath]] = stencilBuildFiles || [];
|
|
1008
1015
|
const stencilWrapperFileName = path$1.basename(stencilWrapperFilePath);
|
|
@@ -5552,28 +5559,6 @@ async function clientContextValidation(filesList) {
|
|
|
5552
5559
|
}
|
|
5553
5560
|
return errors;
|
|
5554
5561
|
}
|
|
5555
|
-
var MeasureTypeEnum;
|
|
5556
|
-
(function (MeasureTypeEnum) {
|
|
5557
|
-
MeasureTypeEnum["string"] = "string";
|
|
5558
|
-
MeasureTypeEnum["time"] = "time";
|
|
5559
|
-
MeasureTypeEnum["boolean"] = "boolean";
|
|
5560
|
-
MeasureTypeEnum["number"] = "number";
|
|
5561
|
-
MeasureTypeEnum["count"] = "count";
|
|
5562
|
-
MeasureTypeEnum["count_distinct"] = "count_distinct";
|
|
5563
|
-
MeasureTypeEnum["count_distinct_approx"] = "count_distinct_approx";
|
|
5564
|
-
MeasureTypeEnum["sum"] = "sum";
|
|
5565
|
-
MeasureTypeEnum["avg"] = "avg";
|
|
5566
|
-
MeasureTypeEnum["min"] = "min";
|
|
5567
|
-
MeasureTypeEnum["max"] = "max";
|
|
5568
|
-
})(MeasureTypeEnum || (MeasureTypeEnum = {}));
|
|
5569
|
-
var DimensionTypeEnum;
|
|
5570
|
-
(function (DimensionTypeEnum) {
|
|
5571
|
-
DimensionTypeEnum["string"] = "string";
|
|
5572
|
-
DimensionTypeEnum["time"] = "time";
|
|
5573
|
-
DimensionTypeEnum["boolean"] = "boolean";
|
|
5574
|
-
DimensionTypeEnum["number"] = "number";
|
|
5575
|
-
DimensionTypeEnum["geo"] = "geo";
|
|
5576
|
-
})(DimensionTypeEnum || (DimensionTypeEnum = {}));
|
|
5577
5562
|
const cubeModelSchema = z
|
|
5578
5563
|
.object({
|
|
5579
5564
|
cubes: z
|
|
@@ -5582,14 +5567,14 @@ const cubeModelSchema = z
|
|
|
5582
5567
|
dimensions: z
|
|
5583
5568
|
.object({
|
|
5584
5569
|
name: z.string(),
|
|
5585
|
-
type: z.
|
|
5570
|
+
type: z.enum(DIMENSION_TYPES),
|
|
5586
5571
|
})
|
|
5587
5572
|
.array()
|
|
5588
5573
|
.optional(),
|
|
5589
5574
|
measures: z
|
|
5590
5575
|
.object({
|
|
5591
5576
|
name: z.string(),
|
|
5592
|
-
type: z.
|
|
5577
|
+
type: z.enum(MEASURE_TYPES),
|
|
5593
5578
|
})
|
|
5594
5579
|
.array()
|
|
5595
5580
|
.optional(),
|
|
@@ -22210,16 +22195,16 @@ var dev = async () => {
|
|
|
22210
22195
|
const customGlobalCssWatch = globalCssWatcher(config);
|
|
22211
22196
|
watchers.push(customGlobalCssWatch);
|
|
22212
22197
|
if (themeWatcher) {
|
|
22213
|
-
await globalHookWatcher(themeWatcher
|
|
22198
|
+
await globalHookWatcher(themeWatcher);
|
|
22214
22199
|
watchers.push(themeWatcher);
|
|
22215
22200
|
}
|
|
22216
22201
|
if (lifecycleWatcher) {
|
|
22217
|
-
await globalHookWatcher(lifecycleWatcher
|
|
22202
|
+
await globalHookWatcher(lifecycleWatcher);
|
|
22218
22203
|
watchers.push(lifecycleWatcher);
|
|
22219
22204
|
}
|
|
22220
22205
|
}
|
|
22221
22206
|
else {
|
|
22222
|
-
await openDevWorkspacePage(config.previewBaseUrl);
|
|
22207
|
+
await openDevWorkspacePage(config.previewBaseUrl, previewWorkspace);
|
|
22223
22208
|
}
|
|
22224
22209
|
const cubeSecurityContextAndClientContextWatch = await cubeSecurityContextAndClientContextWatcher(config);
|
|
22225
22210
|
watchers.push(cubeSecurityContextAndClientContextWatch);
|
|
@@ -22250,7 +22235,7 @@ const configureWatcher = async (watcher, ctx) => {
|
|
|
22250
22235
|
}
|
|
22251
22236
|
});
|
|
22252
22237
|
};
|
|
22253
|
-
const globalHookWatcher = async (watcher
|
|
22238
|
+
const globalHookWatcher = async (watcher) => {
|
|
22254
22239
|
watcher.on("change", (path) => {
|
|
22255
22240
|
changedFiles.push(path);
|
|
22256
22241
|
});
|
|
@@ -22285,16 +22270,16 @@ const onBuildStart = async (ctx) => {
|
|
|
22285
22270
|
}
|
|
22286
22271
|
sendMessage("componentsBuildStart", { changedFiles });
|
|
22287
22272
|
};
|
|
22288
|
-
const openDevWorkspacePage = async (previewBaseUrl) => {
|
|
22289
|
-
|
|
22290
|
-
return await open(`${previewBaseUrl}/workspace/${
|
|
22273
|
+
const openDevWorkspacePage = async (previewBaseUrl, workspaceId) => {
|
|
22274
|
+
ora(`Preview workspace is available at ${previewBaseUrl}/workspace/${workspaceId}`).info();
|
|
22275
|
+
return await open(`${previewBaseUrl}/workspace/${workspaceId}`);
|
|
22291
22276
|
};
|
|
22292
22277
|
const onBundleBuildEnd = async (ctx) => {
|
|
22293
22278
|
if (!onlyTypesChanged() || changedFiles.length === 0) {
|
|
22294
22279
|
await buildWebComponent(ctx);
|
|
22295
22280
|
}
|
|
22296
22281
|
if (browserWindow == null) {
|
|
22297
|
-
browserWindow = await openDevWorkspacePage(ctx.previewBaseUrl);
|
|
22282
|
+
browserWindow = await openDevWorkspacePage(ctx.previewBaseUrl, previewWorkspace);
|
|
22298
22283
|
}
|
|
22299
22284
|
else {
|
|
22300
22285
|
sendMessage("componentsBuildSuccess");
|