@adep/cli 0.1.11 → 0.1.13

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/dist/vite.js CHANGED
@@ -1134,6 +1134,10 @@ function toNumber(raw) {
1134
1134
  const n = Number(t);
1135
1135
  return Number.isNaN(n) ? null : n;
1136
1136
  }
1137
+ function arithmeticOperand(v) {
1138
+ const n = Number(v);
1139
+ return Number.isFinite(n) ? n : 0;
1140
+ }
1137
1141
  function stripQuotes(raw) {
1138
1142
  const t = raw.trim();
1139
1143
  if (/^'.*'$/.test(t)) return t.slice(1, -1);
@@ -1303,10 +1307,6 @@ function resolveSetValue(value, existing, row) {
1303
1307
  return value;
1304
1308
  }
1305
1309
  function evalArithmetic(src, existing, row) {
1306
- const num = (v) => {
1307
- const n2 = Number(v);
1308
- return Number.isFinite(n2) ? n2 : 0;
1309
- };
1310
1310
  let i = 0;
1311
1311
  const n = src.length;
1312
1312
  const skip = () => {
@@ -1351,7 +1351,7 @@ function evalArithmetic(src, existing, row) {
1351
1351
  const id = parseIdent();
1352
1352
  if (id !== null) {
1353
1353
  const v = id.excluded ? row[id.col] : existing[id.col];
1354
- return num(v);
1354
+ return arithmeticOperand(v);
1355
1355
  }
1356
1356
  return 0;
1357
1357
  };
@@ -1781,6 +1781,9 @@ function parseSelectItem(raw) {
1781
1781
  const plain = unqualifyColumn(ident(name));
1782
1782
  return { name: plain, qualified, alias: as === null ? plain : ident(as[1] ?? ""), star: false };
1783
1783
  }
1784
+ function projectValueOf(row, item) {
1785
+ return item.qualified !== "" && row[item.qualified] !== void 0 ? row[item.qualified] : row[item.name];
1786
+ }
1784
1787
  function project(rows, selectRaw) {
1785
1788
  if (/^count\s*\(\s*\*/i.test(selectRaw) || /^count\s*\(\s*1\)/i.test(selectRaw)) {
1786
1789
  const alias = selectRaw.match(/\bAS\s+([A-Za-z_][A-Za-z0-9_]*)/i)?.[1] ?? "n";
@@ -1792,20 +1795,19 @@ function project(rows, selectRaw) {
1792
1795
  }
1793
1796
  if (selectRaw.trim() === "*") return rows;
1794
1797
  const items = selectRaw.split(",").map(parseSelectItem);
1795
- const valueOf = (row, item) => item.qualified !== "" && row[item.qualified] !== void 0 ? row[item.qualified] : row[item.name];
1796
1798
  if (items.some((item) => item.star)) {
1797
1799
  return rows.map((row) => {
1798
1800
  const out = { ...row };
1799
1801
  for (const item of items) {
1800
1802
  if (item.star) continue;
1801
- out[item.alias] = valueOf(row, item);
1803
+ out[item.alias] = projectValueOf(row, item);
1802
1804
  }
1803
1805
  return out;
1804
1806
  });
1805
1807
  }
1806
1808
  return rows.map((row) => {
1807
1809
  const out = {};
1808
- for (const item of items) out[item.alias] = valueOf(row, item);
1810
+ for (const item of items) out[item.alias] = projectValueOf(row, item);
1809
1811
  return out;
1810
1812
  });
1811
1813
  }
@@ -2058,7 +2060,7 @@ var rotr = (x, n) => x >>> n | x << 32 - n;
2058
2060
  function compress(h, block, w) {
2059
2061
  for (let i = 0; i < 16; i += 1) {
2060
2062
  const j = i * 4;
2061
- w[i] = (block[j] ?? 0) << 24 | (block[j + 1] ?? 0) << 16 | (block[j + 2] ?? 0) << 8 | (block[j + 3] ?? 0);
2063
+ w[i] = block[j] << 24 | block[j + 1] << 16 | block[j + 2] << 8 | block[j + 3];
2062
2064
  }
2063
2065
  for (let i = 16; i < 64; i += 1) {
2064
2066
  const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ w[i - 15] >>> 3;
@@ -2600,10 +2602,10 @@ function jsonStorage(cwd) {
2600
2602
  };
2601
2603
  }
2602
2604
  async function createSimRuntime(options) {
2603
- const db = createSimDbCapability({
2605
+ const db = options.driver === void 0 ? createSimDbCapability({
2604
2606
  storage: options.dbStorage ?? jsonStorage(options.cwd),
2605
2607
  ...options.log === void 0 ? {} : { log: options.log }
2606
- });
2608
+ }) : { bundle: createDbCapability(options.driver), driver: options.driver, engine: null };
2607
2609
  const storage = createSimStorageCapability({
2608
2610
  cwd: options.cwd,
2609
2611
  ...options.baseUrl === void 0 ? {} : { baseUrl: options.baseUrl },
@@ -2612,7 +2614,7 @@ async function createSimRuntime(options) {
2612
2614
  const simRealtime = createSimRealtimeCapability();
2613
2615
  const kvBundle = createKvCapability(db.driver);
2614
2616
  const bundle = mergeBundles([db.bundle, storage.bundle, kvBundle, simRealtime.bundle]);
2615
- await db.engine.load();
2617
+ if (db.engine !== null) await db.engine.load();
2616
2618
  return {
2617
2619
  bundle,
2618
2620
  realtime: simRealtime.realtime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adep/cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "type": "module",
5
5
  "description": "`adep` 命令行工具包位:登录 / 初始化 / 本地调试 / 部署 / 数据库维护 / 云存储 / 静态托管 / 微前端组件(widget),实现见任务单 CLI-001 ~ CLI-003 与 FE-002;子路径 `@adep/cli/vite` 提供云函数 vite 插件(CLI-014)",
6
6
  "bin": {
@@ -24,7 +24,7 @@
24
24
  "@adep/vite-plugin": "0.1.5"
25
25
  },
26
26
  "devDependencies": {
27
- "@adep/runtime": "0.2.5",
27
+ "@adep/runtime": "0.2.6",
28
28
  "@adep/types": "0.2.3"
29
29
  },
30
30
  "scripts": {