@embeddable.com/sdk-core 3.13.0-next.3 → 3.13.0-next.4
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 +18 -23
- package/lib/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/dev.ts +7 -14
package/package.json
CHANGED
package/src/dev.ts
CHANGED
|
@@ -26,21 +26,20 @@ import validate from "./validate";
|
|
|
26
26
|
import { checkNodeVersion } from "./utils";
|
|
27
27
|
import { createManifest } from "./cleanup";
|
|
28
28
|
import { selectWorkspace } from "./workspaceUtils";
|
|
29
|
-
import * as fs from "fs";
|
|
30
|
-
|
|
29
|
+
import * as fs from "node:fs/promises";
|
|
30
|
+
import minimist from "minimist";
|
|
31
31
|
import { initLogger, logError } from "./logger";
|
|
32
32
|
import fg from "fast-glob";
|
|
33
33
|
import * as dotenv from "dotenv";
|
|
34
|
-
import
|
|
35
|
-
|
|
34
|
+
import ora from "ora";
|
|
35
|
+
import finalhandler from "finalhandler";
|
|
36
|
+
import serveStatic from "serve-static";
|
|
36
37
|
dotenv.config();
|
|
37
38
|
|
|
38
|
-
const oraP = import("ora");
|
|
39
39
|
let wss: WSServer;
|
|
40
40
|
let changedFiles: string[] = [];
|
|
41
41
|
let browserWindow: ChildProcess | null = null;
|
|
42
42
|
|
|
43
|
-
let ora: any;
|
|
44
43
|
let previewWorkspace: string;
|
|
45
44
|
|
|
46
45
|
const SERVER_PORT = 8926;
|
|
@@ -53,7 +52,6 @@ const buildWebComponent = async (config: any) => {
|
|
|
53
52
|
|
|
54
53
|
const addToGitingore = async () => {
|
|
55
54
|
try {
|
|
56
|
-
const fs = require("fs").promises;
|
|
57
55
|
const gitignorePath = path.resolve(process.cwd(), ".gitignore");
|
|
58
56
|
const gitignoreContent = await fs.readFile(gitignorePath, "utf8");
|
|
59
57
|
|
|
@@ -83,8 +81,6 @@ export default async () => {
|
|
|
83
81
|
checkNodeVersion();
|
|
84
82
|
addToGitingore();
|
|
85
83
|
|
|
86
|
-
ora = (await oraP).default;
|
|
87
|
-
|
|
88
84
|
process.on("warning", (e) => console.warn(e.stack));
|
|
89
85
|
|
|
90
86
|
const logger = createNodeLogger();
|
|
@@ -116,9 +112,6 @@ export default async () => {
|
|
|
116
112
|
breadcrumbs.push("prepare config");
|
|
117
113
|
await prepare(config);
|
|
118
114
|
|
|
119
|
-
const finalhandler = require("finalhandler");
|
|
120
|
-
const serveStatic = require("serve-static");
|
|
121
|
-
|
|
122
115
|
const serve = serveStatic(config.client.buildDir);
|
|
123
116
|
|
|
124
117
|
let workspacePreparation = ora("Preparing workspace...").start();
|
|
@@ -149,7 +142,7 @@ export default async () => {
|
|
|
149
142
|
workspacePreparation.succeed("Workspace is ready");
|
|
150
143
|
|
|
151
144
|
const server = http.createServer(
|
|
152
|
-
(request: IncomingMessage, res: ServerResponse) => {
|
|
145
|
+
async (request: IncomingMessage, res: ServerResponse) => {
|
|
153
146
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
154
147
|
res.setHeader(
|
|
155
148
|
"Access-Control-Allow-Methods",
|
|
@@ -172,7 +165,7 @@ export default async () => {
|
|
|
172
165
|
try {
|
|
173
166
|
if (request.url?.endsWith(GLOBAL_CSS)) {
|
|
174
167
|
res.writeHead(200, { "Content-Type": "text/css" });
|
|
175
|
-
res.end(fs.
|
|
168
|
+
res.end(await fs.readFile(config.client.globalCss));
|
|
176
169
|
return;
|
|
177
170
|
}
|
|
178
171
|
} catch {}
|