@somewhere-tech/cli 0.31.16 → 0.31.18
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/commands/browser.js +1 -1
- package/dist/commands/browser.js.map +1 -1
- package/dist/commands/check.js +1 -2
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/db.js +8 -5
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/dev.js +18 -383
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/status.js +0 -36
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/typecheck.js +1 -1
- package/dist/commands/typecheck.js.map +1 -1
- package/dist/commands/verify.js +1 -1
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/{local → lib}/browser-run.js +1 -1
- package/dist/lib/browser-run.js.map +1 -0
- package/dist/lib/chrome.js.map +1 -0
- package/dist/lib/envfile-write.js +2 -2
- package/dist/lib/envfile-write.js.map +1 -1
- package/dist/lib/frontend-dev.js +122 -0
- package/dist/lib/frontend-dev.js.map +1 -0
- package/dist/lib/init-agent-guide.js +15 -19
- package/dist/lib/init-agent-guide.js.map +1 -1
- package/dist/lib/init-green-template.js +1 -1
- package/dist/lib/project-urls.js +13 -0
- package/dist/lib/project-urls.js.map +1 -1
- package/npm-shrinkwrap.json +2 -17
- package/package.json +3 -5
- package/runtime/VENDOR.json +0 -2
- package/dist/commands/exec.js +0 -145
- package/dist/commands/exec.js.map +0 -1
- package/dist/local/browser-run.js.map +0 -1
- package/dist/local/chrome.js.map +0 -1
- package/dist/local/compiler-core.js +0 -51
- package/dist/local/compiler-core.js.map +0 -1
- package/dist/local/compiler.js +0 -683
- package/dist/local/compiler.js.map +0 -1
- package/dist/local/dev-server.js +0 -517
- package/dist/local/dev-server.js.map +0 -1
- package/dist/local/envfile.js +0 -40
- package/dist/local/envfile.js.map +0 -1
- package/dist/local/loader.js +0 -299
- package/dist/local/loader.js.map +0 -1
- package/dist/local/loopback.js +0 -129
- package/dist/local/loopback.js.map +0 -1
- package/dist/local/request-timing.js +0 -101
- package/dist/local/request-timing.js.map +0 -1
- package/dist/local/router.js +0 -114
- package/dist/local/router.js.map +0 -1
- package/dist/local/runtime.js +0 -345
- package/dist/local/runtime.js.map +0 -1
- package/dist/local/server.js +0 -309
- package/dist/local/server.js.map +0 -1
- package/dist/local/telemetry-filter.js +0 -120
- package/dist/local/telemetry-filter.js.map +0 -1
- package/node_modules/esbuild-wasm/LICENSE.md +0 -21
- package/node_modules/esbuild-wasm/README.md +0 -3
- package/node_modules/esbuild-wasm/bin/esbuild +0 -91
- package/node_modules/esbuild-wasm/esbuild.wasm +0 -0
- package/node_modules/esbuild-wasm/esm/browser.d.ts +0 -705
- package/node_modules/esbuild-wasm/esm/browser.js +0 -2393
- package/node_modules/esbuild-wasm/esm/browser.min.js +0 -20
- package/node_modules/esbuild-wasm/lib/browser.d.ts +0 -705
- package/node_modules/esbuild-wasm/lib/browser.js +0 -2438
- package/node_modules/esbuild-wasm/lib/browser.min.js +0 -22
- package/node_modules/esbuild-wasm/lib/main.d.ts +0 -705
- package/node_modules/esbuild-wasm/lib/main.js +0 -2051
- package/node_modules/esbuild-wasm/package.json +0 -19
- package/node_modules/esbuild-wasm/wasm_exec.js +0 -561
- package/node_modules/esbuild-wasm/wasm_exec_node.js +0 -39
- package/runtime/compiler/VENDOR.json +0 -64
- package/runtime/compiler/compile-core.cjs +0 -2007
- package/runtime/compiler/graph-contract.cjs +0 -124
- package/runtime/compiler/typed-functions.cjs +0 -575
- package/runtime/platform-context.mjs +0 -8193
- package/runtime/sw-init.mjs +0 -283
- /package/dist/{local → lib}/chrome.js +0 -0
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Side-effect-free compiler graph contract. The compiler server and every
|
|
4
|
-
// checker import this exact module; there is no copied graph implementation.
|
|
5
|
-
const path = require('path');
|
|
6
|
-
|
|
7
|
-
const GRAPH_MAX_EDGES = 25_000;
|
|
8
|
-
const GRAPH_MAX_BYTES = 2 * 1024 * 1024;
|
|
9
|
-
|
|
10
|
-
function importGraphFromMetafile(metafile, root) {
|
|
11
|
-
const graph = {};
|
|
12
|
-
if (!metafile) return graph;
|
|
13
|
-
for (const [inputPath, info] of Object.entries(metafile.inputs || {})) {
|
|
14
|
-
const rel = path.relative(root, path.resolve(root, inputPath));
|
|
15
|
-
if (rel.startsWith('..') || rel.includes('node_modules')) continue;
|
|
16
|
-
graph[rel] = (info.imports || [])
|
|
17
|
-
.map((item) => path.relative(root, path.resolve(root, item.path)))
|
|
18
|
-
.filter((item) => !item.startsWith('..') && !item.includes('node_modules'));
|
|
19
|
-
}
|
|
20
|
-
return graph;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function stripMetafilePath(inputPath, root) {
|
|
24
|
-
let value = String(inputPath || '').replace(/\\/g, '/');
|
|
25
|
-
if (/^(?:https?:|node:|cloudflare:|workerd:)/.test(value)) return null;
|
|
26
|
-
const namespaced = /^([A-Za-z0-9_-]+):(.*)$/.exec(value);
|
|
27
|
-
if (namespaced) value = namespaced[2];
|
|
28
|
-
if (!value || /^(?:https?:|node:|cloudflare:|workerd:)/.test(value)) return null;
|
|
29
|
-
if (root) {
|
|
30
|
-
const absolute = path.isAbsolute(value) ? value : path.resolve(root, value);
|
|
31
|
-
value = path.relative(root, absolute).replace(/\\/g, '/');
|
|
32
|
-
} else if (path.isAbsolute(value)) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
value = value.replace(/^\.\//, '').replace(/^\/+/, '');
|
|
36
|
-
if (!value || value === '..' || value.startsWith('../') || value.startsWith('<') || value.includes('node_modules/')) return null;
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function graphWithCounts(edges, originalEdges, originalBytes) {
|
|
41
|
-
const graph = {
|
|
42
|
-
edges,
|
|
43
|
-
truncated: true,
|
|
44
|
-
original_edges: originalEdges,
|
|
45
|
-
retained_edges: edges.length,
|
|
46
|
-
dropped_edges: Math.max(0, originalEdges - edges.length),
|
|
47
|
-
max_bytes: GRAPH_MAX_BYTES,
|
|
48
|
-
};
|
|
49
|
-
if (typeof originalBytes === 'number') graph.original_bytes = originalBytes;
|
|
50
|
-
return graph;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function graphJsonBytes(value) {
|
|
54
|
-
return Buffer.byteLength(JSON.stringify(value), 'utf8');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function truncateGraphEdgesForBytes(edges, entryFiles, originalEdges, originalBytes) {
|
|
58
|
-
const candidates = [];
|
|
59
|
-
const candidateKeys = new Set();
|
|
60
|
-
const degree = new Map();
|
|
61
|
-
const byNode = new Map();
|
|
62
|
-
for (const edge of edges) {
|
|
63
|
-
degree.set(edge.from, (degree.get(edge.from) || 0) + 1);
|
|
64
|
-
degree.set(edge.to, (degree.get(edge.to) || 0) + 1);
|
|
65
|
-
byNode.set(edge.from, [...(byNode.get(edge.from) || []), edge]);
|
|
66
|
-
byNode.set(edge.to, [...(byNode.get(edge.to) || []), edge]);
|
|
67
|
-
}
|
|
68
|
-
const add = (edge) => {
|
|
69
|
-
const key = `${edge.from}\0${edge.to}`;
|
|
70
|
-
if (candidateKeys.has(key)) return;
|
|
71
|
-
candidateKeys.add(key);
|
|
72
|
-
candidates.push(edge);
|
|
73
|
-
};
|
|
74
|
-
for (const edge of edges) if (entryFiles.has(edge.from) || entryFiles.has(edge.to)) add(edge);
|
|
75
|
-
for (const [node] of [...degree.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))) {
|
|
76
|
-
for (const edge of byNode.get(node) || []) add(edge);
|
|
77
|
-
}
|
|
78
|
-
let low = 0;
|
|
79
|
-
let high = candidates.length;
|
|
80
|
-
while (low < high) {
|
|
81
|
-
const mid = Math.ceil((low + high) / 2);
|
|
82
|
-
if (graphJsonBytes(graphWithCounts(candidates.slice(0, mid), originalEdges, originalBytes)) <= GRAPH_MAX_BYTES) low = mid;
|
|
83
|
-
else high = mid - 1;
|
|
84
|
-
}
|
|
85
|
-
return graphWithCounts(candidates.slice(0, low), originalEdges, originalBytes);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function graphFromMetafile(metafile, root) {
|
|
89
|
-
if (!metafile) return { edges: [] };
|
|
90
|
-
const edges = [];
|
|
91
|
-
const seen = new Set();
|
|
92
|
-
let originalEdges = 0;
|
|
93
|
-
for (const [inputPath, input] of Object.entries(metafile.inputs || {})) {
|
|
94
|
-
const from = stripMetafilePath(inputPath, root);
|
|
95
|
-
if (!from) continue;
|
|
96
|
-
for (const item of input.imports || []) {
|
|
97
|
-
const to = stripMetafilePath(item.path, root);
|
|
98
|
-
if (!to || to === from) continue;
|
|
99
|
-
const key = `${from}\0${to}`;
|
|
100
|
-
if (seen.has(key)) continue;
|
|
101
|
-
seen.add(key);
|
|
102
|
-
originalEdges++;
|
|
103
|
-
if (edges.length < GRAPH_MAX_EDGES) edges.push({ from, to });
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
edges.sort((a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to));
|
|
107
|
-
const entryFiles = new Set();
|
|
108
|
-
for (const output of Object.values(metafile.outputs || {})) {
|
|
109
|
-
const entry = output && output.entryPoint ? stripMetafilePath(output.entryPoint, root) : null;
|
|
110
|
-
if (entry) entryFiles.add(entry);
|
|
111
|
-
}
|
|
112
|
-
const stored = { edges };
|
|
113
|
-
const bytes = graphJsonBytes(stored);
|
|
114
|
-
if (bytes > GRAPH_MAX_BYTES) return truncateGraphEdgesForBytes(edges, entryFiles, originalEdges, bytes);
|
|
115
|
-
if (originalEdges > edges.length) return graphWithCounts(edges, originalEdges);
|
|
116
|
-
return stored;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
module.exports = {
|
|
120
|
-
GRAPH_MAX_EDGES,
|
|
121
|
-
GRAPH_MAX_BYTES,
|
|
122
|
-
importGraphFromMetafile,
|
|
123
|
-
graphFromMetafile,
|
|
124
|
-
};
|