@embeddable.com/sdk-core 3.14.7-next.3 → 4.0.0-next.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/index.esm.js +14 -49
- package/lib/index.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/buildTypes.test.ts +0 -46
- package/src/buildTypes.ts +0 -3
- package/src/defineConfig.test.ts +7 -7
- package/src/dev.test.ts +41 -1529
- package/src/dev.ts +11 -52
package/src/dev.ts
CHANGED
|
@@ -53,10 +53,6 @@ let browserWindow: ChildProcess | null = null;
|
|
|
53
53
|
|
|
54
54
|
let previewWorkspace: string;
|
|
55
55
|
|
|
56
|
-
// Build coordination to prevent duplicate plugin builds
|
|
57
|
-
let pluginBuildInProgress = false;
|
|
58
|
-
let pendingPluginBuilds: (() => Promise<void>)[] = [];
|
|
59
|
-
|
|
60
56
|
const SERVER_PORT = 8926;
|
|
61
57
|
const BUILD_DEV_DIR = ".embeddable-dev-build";
|
|
62
58
|
// NOTE: for backward compatibility, keep the file name as global.css
|
|
@@ -66,52 +62,6 @@ export const buildWebComponent = async (config: any) => {
|
|
|
66
62
|
await generate(config, "sdk-react");
|
|
67
63
|
};
|
|
68
64
|
|
|
69
|
-
const executePluginBuilds = async (
|
|
70
|
-
config: ResolvedEmbeddableConfig,
|
|
71
|
-
watchers: Array<RollupWatcher | FSWatcher>,
|
|
72
|
-
) => {
|
|
73
|
-
if (pluginBuildInProgress) {
|
|
74
|
-
// If a plugin build is already in progress, queue this one
|
|
75
|
-
return new Promise<void>((resolve) => {
|
|
76
|
-
pendingPluginBuilds.push(async () => {
|
|
77
|
-
await doPluginBuilds(config, watchers);
|
|
78
|
-
resolve();
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
} else {
|
|
82
|
-
// Start the plugin build immediately
|
|
83
|
-
await doPluginBuilds(config, watchers);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const doPluginBuilds = async (
|
|
88
|
-
config: ResolvedEmbeddableConfig,
|
|
89
|
-
watchers: Array<RollupWatcher | FSWatcher>,
|
|
90
|
-
) => {
|
|
91
|
-
pluginBuildInProgress = true;
|
|
92
|
-
|
|
93
|
-
try {
|
|
94
|
-
for (const getPlugin of config.plugins) {
|
|
95
|
-
const plugin = getPlugin();
|
|
96
|
-
|
|
97
|
-
await plugin.validate(config);
|
|
98
|
-
const watcher = await plugin.build(config);
|
|
99
|
-
await configureWatcher(watcher as RollupWatcher, config);
|
|
100
|
-
watchers.push(watcher as RollupWatcher);
|
|
101
|
-
}
|
|
102
|
-
} finally {
|
|
103
|
-
pluginBuildInProgress = false;
|
|
104
|
-
|
|
105
|
-
// Process any pending builds
|
|
106
|
-
if (pendingPluginBuilds.length > 0) {
|
|
107
|
-
const nextBuild = pendingPluginBuilds.shift();
|
|
108
|
-
if (nextBuild) {
|
|
109
|
-
await nextBuild();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
65
|
const addToGitingore = async () => {
|
|
116
66
|
try {
|
|
117
67
|
const gitignorePath = path.resolve(process.cwd(), ".gitignore");
|
|
@@ -265,8 +215,17 @@ export default async () => {
|
|
|
265
215
|
await sendBuildChanges(config);
|
|
266
216
|
|
|
267
217
|
if (config.pushComponents) {
|
|
268
|
-
|
|
269
|
-
|
|
218
|
+
for (const getPlugin of config.plugins) {
|
|
219
|
+
const plugin = getPlugin();
|
|
220
|
+
|
|
221
|
+
breadcrumbs.push("validate plugin");
|
|
222
|
+
await plugin.validate(config);
|
|
223
|
+
breadcrumbs.push("build plugin");
|
|
224
|
+
const watcher = await plugin.build(config);
|
|
225
|
+
breadcrumbs.push("configure watcher");
|
|
226
|
+
await configureWatcher(watcher as RollupWatcher, config);
|
|
227
|
+
watchers.push(watcher as RollupWatcher);
|
|
228
|
+
}
|
|
270
229
|
|
|
271
230
|
const customCanvasCssWatch = globalCustomCanvasWatcher(config);
|
|
272
231
|
watchers.push(customCanvasCssWatch);
|