@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/lib/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readdir, lstat } from 'node:fs/promises';
|
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import path__default, { join } from 'node:path';
|
|
5
5
|
import * as vite from 'vite';
|
|
6
|
-
import ora
|
|
6
|
+
import ora from 'ora';
|
|
7
7
|
import 'node:child_process';
|
|
8
8
|
import * as crypto from 'node:crypto';
|
|
9
9
|
import * as fs$1 from 'node:fs';
|
|
@@ -19,8 +19,7 @@ import require$$1 from 'os';
|
|
|
19
19
|
import require$$3 from 'http';
|
|
20
20
|
import require$$4 from 'https';
|
|
21
21
|
import require$$0$1 from 'url';
|
|
22
|
-
import
|
|
23
|
-
import require$$2__default, { createReadStream } from 'fs';
|
|
22
|
+
import require$$2$1, { createReadStream } from 'fs';
|
|
24
23
|
import * as path$1 from 'path';
|
|
25
24
|
import path__default$1, { basename } from 'path';
|
|
26
25
|
import axios from 'axios';
|
|
@@ -29,8 +28,11 @@ import { select } from '@inquirer/prompts';
|
|
|
29
28
|
import * as http from 'node:http';
|
|
30
29
|
import { WebSocketServer } from 'ws';
|
|
31
30
|
import * as chokidar from 'chokidar';
|
|
31
|
+
import minimist from 'minimist';
|
|
32
32
|
import fg from 'fast-glob';
|
|
33
33
|
import * as dotenv from 'dotenv';
|
|
34
|
+
import finalhandler from 'finalhandler';
|
|
35
|
+
import serveStatic from 'serve-static';
|
|
34
36
|
import { stat } from 'fs/promises';
|
|
35
37
|
|
|
36
38
|
var findFiles = async (initialSrcDir, regex) => {
|
|
@@ -372,7 +374,7 @@ const getContentHash = (contentString) => {
|
|
|
372
374
|
const EMB_TYPE_FILE_REGEX = /^(.*)\.type\.emb\.[jt]s$/;
|
|
373
375
|
const EMB_OPTIONS_FILE_REGEX = /^(.*)\.options\.emb\.[jt]s$/;
|
|
374
376
|
var buildTypes = async (ctx) => {
|
|
375
|
-
const progress = ora
|
|
377
|
+
const progress = ora("Building types...").start();
|
|
376
378
|
await generate$1(ctx);
|
|
377
379
|
await build$1(ctx);
|
|
378
380
|
await cleanup$1(ctx);
|
|
@@ -561,7 +563,7 @@ const CREDENTIALS_DIR = path.resolve(os.homedir(), ".embeddable");
|
|
|
561
563
|
const CREDENTIALS_FILE = path.resolve(CREDENTIALS_DIR, "credentials");
|
|
562
564
|
|
|
563
565
|
const checkNodeVersion = async () => {
|
|
564
|
-
const spinner = ora
|
|
566
|
+
const spinner = ora("Checking node version...").start();
|
|
565
567
|
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
566
568
|
let packageJson;
|
|
567
569
|
try {
|
|
@@ -4989,7 +4991,7 @@ const SECURITY_CONTEXT_FILE_REGEX = /^(.*)\.sc\.ya?ml$/;
|
|
|
4989
4991
|
const CLIENT_CONTEXT_FILE_REGEX = /^(.*)\.cc\.ya?ml$/;
|
|
4990
4992
|
var validate = async (ctx) => {
|
|
4991
4993
|
checkNodeVersion();
|
|
4992
|
-
const spinnerValidate = ora
|
|
4994
|
+
const spinnerValidate = ora("Data model validation...").start();
|
|
4993
4995
|
const cubeFilesList = await findFiles(ctx.client.modelsSrc || ctx.client.srcDir, CUBE_YAML_FILE_REGEX);
|
|
4994
4996
|
const securityContextFilesList = await findFiles(ctx.client.presetsSrc || ctx.client.srcDir, SECURITY_CONTEXT_FILE_REGEX);
|
|
4995
4997
|
const clientContextFilesList = await findFiles(ctx.client.presetsSrc || ctx.client.srcDir, CLIENT_CONTEXT_FILE_REGEX);
|
|
@@ -17912,7 +17914,7 @@ function requireStackTrace () {
|
|
|
17912
17914
|
hasRequiredStackTrace = 1;
|
|
17913
17915
|
var SourceMapConsumer = requireSourceMap().SourceMapConsumer;
|
|
17914
17916
|
var path = path__default$1;
|
|
17915
|
-
var fs = require$$
|
|
17917
|
+
var fs = require$$2$1;
|
|
17916
17918
|
|
|
17917
17919
|
/**
|
|
17918
17920
|
* Uses Node source-map to map transpiled JS stack locations to original
|
|
@@ -18120,7 +18122,7 @@ function requireParser () {
|
|
|
18120
18122
|
|
|
18121
18123
|
var logger = requireLogger();
|
|
18122
18124
|
var async = require$$0;
|
|
18123
|
-
var fs = require$$
|
|
18125
|
+
var fs = require$$2$1;
|
|
18124
18126
|
var lru = requireLruCache();
|
|
18125
18127
|
var util = require$$4$1;
|
|
18126
18128
|
var stackTrace = requireStackTrace();
|
|
@@ -21375,13 +21377,13 @@ var build = async () => {
|
|
|
21375
21377
|
}
|
|
21376
21378
|
};
|
|
21377
21379
|
|
|
21378
|
-
const oraP
|
|
21380
|
+
const oraP = import('ora');
|
|
21379
21381
|
const openP = import('open');
|
|
21380
21382
|
var login = async () => {
|
|
21381
21383
|
var _a;
|
|
21382
21384
|
await initLogger("login");
|
|
21383
21385
|
const breadcrumbs = [];
|
|
21384
|
-
const ora = (await oraP
|
|
21386
|
+
const ora = (await oraP).default;
|
|
21385
21387
|
const authenticationSpinner = ora("Waiting for code verification...").start();
|
|
21386
21388
|
try {
|
|
21387
21389
|
const open = (await openP).default;
|
|
@@ -21542,7 +21544,7 @@ var push = async () => {
|
|
|
21542
21544
|
}
|
|
21543
21545
|
const config = await provideConfig();
|
|
21544
21546
|
if (process.argv.includes("--api-key") || process.argv.includes("-k")) {
|
|
21545
|
-
spinnerPushing = ora
|
|
21547
|
+
spinnerPushing = ora("Using API key...").start();
|
|
21546
21548
|
breadcrumbs.push("push by api key");
|
|
21547
21549
|
await pushByApiKey(config, spinnerPushing);
|
|
21548
21550
|
spinnerPushing.succeed("Published using API key");
|
|
@@ -21550,11 +21552,11 @@ var push = async () => {
|
|
|
21550
21552
|
}
|
|
21551
21553
|
breadcrumbs.push("push by standard login");
|
|
21552
21554
|
const token = await verify(config);
|
|
21553
|
-
spinnerPushing = ora
|
|
21555
|
+
spinnerPushing = ora()
|
|
21554
21556
|
.start()
|
|
21555
21557
|
.info("No API Key provided. Standard login will be used.");
|
|
21556
21558
|
breadcrumbs.push("select workspace");
|
|
21557
|
-
const { workspaceId, name: workspaceName } = await selectWorkspace(ora
|
|
21559
|
+
const { workspaceId, name: workspaceName } = await selectWorkspace(ora, config, token);
|
|
21558
21560
|
const workspacePreviewUrl = `${config.previewBaseUrl}/workspace/${workspaceId}`;
|
|
21559
21561
|
breadcrumbs.push("build archive");
|
|
21560
21562
|
await buildArchive(config);
|
|
@@ -21608,7 +21610,7 @@ async function verify(ctx) {
|
|
|
21608
21610
|
return token;
|
|
21609
21611
|
}
|
|
21610
21612
|
async function buildArchive(config) {
|
|
21611
|
-
const spinnerArchive = ora
|
|
21613
|
+
const spinnerArchive = ora("Building...").start();
|
|
21612
21614
|
if (!config.pushModels && !config.pushComponents) {
|
|
21613
21615
|
spinnerArchive.fail("Cannot push: both pushModels and pushComponents are disabled");
|
|
21614
21616
|
process.exit(1);
|
|
@@ -21689,13 +21691,10 @@ async function uploadFile(formData, url, token) {
|
|
|
21689
21691
|
});
|
|
21690
21692
|
}
|
|
21691
21693
|
|
|
21692
|
-
const minimist = require("minimist");
|
|
21693
21694
|
dotenv.config();
|
|
21694
|
-
const oraP = import('ora');
|
|
21695
21695
|
let wss;
|
|
21696
21696
|
let changedFiles = [];
|
|
21697
21697
|
let browserWindow = null;
|
|
21698
|
-
let ora;
|
|
21699
21698
|
let previewWorkspace;
|
|
21700
21699
|
const SERVER_PORT = 8926;
|
|
21701
21700
|
const BUILD_DEV_DIR = ".embeddable-dev-build";
|
|
@@ -21705,7 +21704,6 @@ const buildWebComponent = async (config) => {
|
|
|
21705
21704
|
};
|
|
21706
21705
|
const addToGitingore = async () => {
|
|
21707
21706
|
try {
|
|
21708
|
-
const fs = require("fs").promises;
|
|
21709
21707
|
const gitignorePath = path$1.resolve(process.cwd(), ".gitignore");
|
|
21710
21708
|
const gitignoreContent = await fs.readFile(gitignorePath, "utf8");
|
|
21711
21709
|
if (!gitignoreContent.includes(BUILD_DEV_DIR)) {
|
|
@@ -21732,7 +21730,6 @@ var dev = async () => {
|
|
|
21732
21730
|
breadcrumbs.push("run dev");
|
|
21733
21731
|
checkNodeVersion();
|
|
21734
21732
|
addToGitingore();
|
|
21735
|
-
ora = (await oraP).default;
|
|
21736
21733
|
process.on("warning", (e) => console.warn(e.stack));
|
|
21737
21734
|
const logger = createNodeLogger();
|
|
21738
21735
|
const sys = createNodeSys({ process });
|
|
@@ -21755,8 +21752,6 @@ var dev = async () => {
|
|
|
21755
21752
|
};
|
|
21756
21753
|
breadcrumbs.push("prepare config");
|
|
21757
21754
|
await prepare(config);
|
|
21758
|
-
const finalhandler = require("finalhandler");
|
|
21759
|
-
const serveStatic = require("serve-static");
|
|
21760
21755
|
const serve = serveStatic(config.client.buildDir);
|
|
21761
21756
|
let workspacePreparation = ora("Preparing workspace...").start();
|
|
21762
21757
|
breadcrumbs.push("get preview workspace");
|
|
@@ -21776,7 +21771,7 @@ var dev = async () => {
|
|
|
21776
21771
|
}
|
|
21777
21772
|
}
|
|
21778
21773
|
workspacePreparation.succeed("Workspace is ready");
|
|
21779
|
-
const server = http.createServer((request, res) => {
|
|
21774
|
+
const server = http.createServer(async (request, res) => {
|
|
21780
21775
|
var _a;
|
|
21781
21776
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
21782
21777
|
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
@@ -21791,7 +21786,7 @@ var dev = async () => {
|
|
|
21791
21786
|
try {
|
|
21792
21787
|
if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.endsWith(GLOBAL_CSS)) {
|
|
21793
21788
|
res.writeHead(200, { "Content-Type": "text/css" });
|
|
21794
|
-
res.end(
|
|
21789
|
+
res.end(await fs.readFile(config.client.globalCss));
|
|
21795
21790
|
return;
|
|
21796
21791
|
}
|
|
21797
21792
|
}
|