@yaks/esbuild 0.0.0-stage → 0.2.36
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/LICENSE +202 -0
- package/README.md +450 -2
- package/_dist/bundle.d.ts +6 -0
- package/_dist/bundle.d.ts.map +1 -0
- package/_dist/compile.d.ts +72 -0
- package/_dist/compile.d.ts.map +1 -0
- package/_dist/dependencies.d.ts +15 -0
- package/_dist/dependencies.d.ts.map +1 -0
- package/_dist/file.d.ts +185 -0
- package/_dist/file.d.ts.map +1 -0
- package/_dist/graph.d.ts +104 -0
- package/_dist/graph.d.ts.map +1 -0
- package/_dist/home.d.ts +15 -0
- package/_dist/home.d.ts.map +1 -0
- package/_dist/link.d.ts +192 -0
- package/_dist/link.d.ts.map +1 -0
- package/_dist/lock.d.ts +30 -0
- package/_dist/lock.d.ts.map +1 -0
- package/_dist/mod.d.ts +6 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/pack.d.ts +42 -0
- package/_dist/pack.d.ts.map +1 -0
- package/_dist/package.d.ts +11 -0
- package/_dist/package.d.ts.map +1 -0
- package/_dist/plan.d.ts +135 -0
- package/_dist/plan.d.ts.map +1 -0
- package/_dist/platform.d.ts +27 -0
- package/_dist/platform.d.ts.map +1 -0
- package/_dist/resolve.d.ts +42 -0
- package/_dist/resolve.d.ts.map +1 -0
- package/_dist/shelf.d.ts +11 -0
- package/_dist/shelf.d.ts.map +1 -0
- package/_dist/strip.d.ts +51 -0
- package/_dist/strip.d.ts.map +1 -0
- package/_dist/timing.d.ts +6 -0
- package/_dist/timing.d.ts.map +1 -0
- package/_dist/unpack.d.ts +14 -0
- package/_dist/unpack.d.ts.map +1 -0
- package/analysis.js +72 -0
- package/analysis.js.map +1 -0
- package/analysis.ts +82 -0
- package/bundle.js +320 -0
- package/bundle.js.map +1 -0
- package/bundle.ts +415 -0
- package/common.js +129 -0
- package/common.js.map +1 -0
- package/common.ts +138 -0
- package/compile.js +500 -0
- package/compile.js.map +1 -0
- package/compile.ts +622 -0
- package/container.js +142 -0
- package/container.js.map +1 -0
- package/container.ts +183 -0
- package/deno.json +1 -0
- package/dependencies.js +31 -0
- package/dependencies.js.map +1 -0
- package/dependencies.ts +40 -0
- package/file.js +303 -0
- package/file.js.map +1 -0
- package/file.ts +443 -0
- package/forward.ts +49 -0
- package/graph.js +297 -0
- package/graph.js.map +1 -0
- package/graph.ts +360 -0
- package/home.js +40 -0
- package/home.js.map +1 -0
- package/home.ts +52 -0
- package/link.js +455 -0
- package/link.js.map +1 -0
- package/link.ts +596 -0
- package/lock.js +129 -0
- package/lock.js.map +1 -0
- package/lock.ts +161 -0
- package/mod.js +14 -0
- package/mod.js.map +1 -0
- package/mod.ts +43 -0
- package/npm.js +362 -0
- package/npm.js.map +1 -0
- package/npm.ts +429 -0
- package/pack.js +188 -0
- package/pack.js.map +1 -0
- package/pack.ts +225 -0
- package/package.js +199 -0
- package/package.js.map +1 -0
- package/package.json +60 -4
- package/package.ts +255 -0
- package/plan.js +273 -0
- package/plan.js.map +1 -0
- package/plan.ts +395 -0
- package/platform.js +160 -0
- package/platform.js.map +1 -0
- package/platform.ts +238 -0
- package/resolve.js +86 -0
- package/resolve.js.map +1 -0
- package/resolve.ts +144 -0
- package/said.js +44 -0
- package/said.js.map +1 -0
- package/said.ts +61 -0
- package/serve.ts +37 -0
- package/sha256.js +7 -0
- package/sha256.js.map +1 -0
- package/sha256.ts +10 -0
- package/shared.js +646 -0
- package/shared.js.map +1 -0
- package/shared.ts +813 -0
- package/shelf.js +73 -0
- package/shelf.js.map +1 -0
- package/shelf.ts +110 -0
- package/strip.js +114 -0
- package/strip.js.map +1 -0
- package/strip.ts +117 -0
- package/tar.js +87 -0
- package/tar.js.map +1 -0
- package/tar.ts +99 -0
- package/timing.js +37 -0
- package/timing.js.map +1 -0
- package/timing.ts +71 -0
- package/unpack.js +40 -0
- package/unpack.js.map +1 -0
- package/unpack.ts +60 -0
- package/used.js +91 -0
- package/used.js.map +1 -0
- package/used.ts +116 -0
package/lock.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// The lock: which version of each package a build installed, kept so the next
|
|
2
|
+
// build installs the same ones. It is npm's own `package-lock.json` (lockfile
|
|
3
|
+
// version 3), read and written for its top level only: each package at
|
|
4
|
+
// `packages["node_modules/<name>"].version`. A compile installs one version
|
|
5
|
+
// of each package name, flat (./npm.ts), so a nested entry
|
|
6
|
+
// (`node_modules/a/node_modules/b`) that `npm install` wrote is not read.
|
|
7
|
+
//
|
|
8
|
+
// A build installs every locked version exactly, and a declared range only
|
|
9
|
+
// where the lock holds no version that satisfies it. Then the lock is written
|
|
10
|
+
// again from what the declared packages reach, so a package nothing needs any
|
|
11
|
+
// more leaves it. A published npm version never changes, so the same lock is
|
|
12
|
+
// the same code.
|
|
13
|
+
/* @ts-types="npm:@types/semver@^7.8.0" */ import { satisfies } from "semver";
|
|
14
|
+
let TOP = /^node_modules\/((?:@[^/]+\/)?[^/]+)$/;
|
|
15
|
+
/** The npm versions a package-lock.json pins; toolkit provenance is not an
|
|
16
|
+
* installer input, including legacy @yaks registry versions.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { assertEquals } from '@std/assert'
|
|
20
|
+
* assertEquals(pins(JSON.stringify({ lockfileVersion: 3, packages: {
|
|
21
|
+
* '': { dependencies: { three: '^0.180.0' } },
|
|
22
|
+
* 'node_modules/three': { version: '0.180.1' },
|
|
23
|
+
* 'node_modules/a/node_modules/b': { version: '2.0.0' },
|
|
24
|
+
* } })), { three: '0.180.1' })
|
|
25
|
+
* ```
|
|
26
|
+
*/ export let pins = (text)=>{
|
|
27
|
+
if (text == null) return {};
|
|
28
|
+
let lock;
|
|
29
|
+
try {
|
|
30
|
+
lock = JSON.parse(text);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
throw new Error(`package-lock.json is not JSON: ${e.message}`);
|
|
33
|
+
}
|
|
34
|
+
let out = {};
|
|
35
|
+
for (let [key, entry] of Object.entries(lock?.packages ?? {})){
|
|
36
|
+
let name = key.match(TOP)?.[1];
|
|
37
|
+
if (name && !name.startsWith('@yaks/') && typeof entry?.version == 'string' && !entry.version.startsWith('sha256:') && entry.version != 'platform') out[name] = entry.version;
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
};
|
|
41
|
+
/** What to install: every pinned version, and each declared range the pins
|
|
42
|
+
* do not satisfy.
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* import { assertEquals } from '@std/assert'
|
|
46
|
+
* assertEquals(
|
|
47
|
+
* wanted({ three: '^0.180.0', hono: '^4' }, { three: '0.180.1', tslib: '2.8.1' }),
|
|
48
|
+
* { three: '0.180.1', tslib: '2.8.1', hono: '^4' },
|
|
49
|
+
* )
|
|
50
|
+
* assertEquals(wanted({ three: '^0.181.0' }, { three: '0.180.1' }), {
|
|
51
|
+
* three: '^0.181.0',
|
|
52
|
+
* })
|
|
53
|
+
* ```
|
|
54
|
+
*/ export let wanted = (ranges, pinned)=>{
|
|
55
|
+
let out = Object.fromEntries(Object.entries(pinned).filter(([n, v])=>!n.startsWith('@yaks/') && v != 'platform' && !v.startsWith('sha256:')));
|
|
56
|
+
for (let [name, range] of Object.entries(ranges)){
|
|
57
|
+
if (name.startsWith('@yaks/') || range == 'platform') {
|
|
58
|
+
throw new Error(`${name}: seed platform dependencies before npm installation`);
|
|
59
|
+
}
|
|
60
|
+
let pin = out[name];
|
|
61
|
+
if (!pin || !safely(pin, range)) out[name] = range;
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
};
|
|
65
|
+
// A range semver cannot read (a tag, a URL) never keeps a pin: the build
|
|
66
|
+
// resolves it again, which is what npm would do.
|
|
67
|
+
let safely = (version, range)=>{
|
|
68
|
+
try {
|
|
69
|
+
return satisfies(version, range);
|
|
70
|
+
} catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
/** The installed packages the declared ones reach, through each package's own
|
|
75
|
+
* dependencies, with the version installed.
|
|
76
|
+
*
|
|
77
|
+
* ```ts
|
|
78
|
+
* import { assertEquals } from '@std/assert'
|
|
79
|
+
* let deps: Record<string, string[]> = { a: ['b'], b: ['a'], c: [] }
|
|
80
|
+
* assertEquals(
|
|
81
|
+
* reached(['a'], { a: '1.0.0', b: '2.0.0', c: '3.0.0' }, (n) => deps[n] ?? []),
|
|
82
|
+
* { a: '1.0.0', b: '2.0.0' },
|
|
83
|
+
* )
|
|
84
|
+
* ```
|
|
85
|
+
*/ export let reached = (roots, installed, needs)=>{
|
|
86
|
+
let out = {};
|
|
87
|
+
let visit = (name)=>{
|
|
88
|
+
if (name in out || !(name in installed)) return;
|
|
89
|
+
out[name] = installed[name];
|
|
90
|
+
for (let dep of needs(name))visit(dep);
|
|
91
|
+
};
|
|
92
|
+
for (let name of roots)visit(name);
|
|
93
|
+
return out;
|
|
94
|
+
};
|
|
95
|
+
/** A package-lock.json holding these versions under these declared ranges,
|
|
96
|
+
* named as package.json names the app, if it does. */ export let lockfile = (name, ranges, versions)=>JSON.stringify({
|
|
97
|
+
name,
|
|
98
|
+
lockfileVersion: 3,
|
|
99
|
+
requires: true,
|
|
100
|
+
packages: {
|
|
101
|
+
'': {
|
|
102
|
+
name,
|
|
103
|
+
dependencies: ranges
|
|
104
|
+
},
|
|
105
|
+
...Object.fromEntries(Object.keys(versions).sort().map((pkg)=>[
|
|
106
|
+
`node_modules/${pkg}`,
|
|
107
|
+
{
|
|
108
|
+
version: versions[pkg],
|
|
109
|
+
...versions[pkg].startsWith('sha256:') ? {
|
|
110
|
+
resolved: 'platform'
|
|
111
|
+
} : {}
|
|
112
|
+
}
|
|
113
|
+
]))
|
|
114
|
+
}
|
|
115
|
+
}, null, 2) + '\n';
|
|
116
|
+
/** `name@version` as the installer says it, split at the version's `@`.
|
|
117
|
+
*
|
|
118
|
+
* ```ts
|
|
119
|
+
* import { assertEquals } from '@std/assert'
|
|
120
|
+
* assertEquals(split('@hono/zod-validator@0.4.3'), ['@hono/zod-validator', '0.4.3'])
|
|
121
|
+
* ```
|
|
122
|
+
*/ export let split = (said)=>{
|
|
123
|
+
let at = said.lastIndexOf('@');
|
|
124
|
+
return [
|
|
125
|
+
said.slice(0, at),
|
|
126
|
+
said.slice(at + 1)
|
|
127
|
+
];
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=lock.js.map
|
package/lock.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.js","sources":["./lock.ts"],"names":[],"mappings":"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"}
|
package/lock.ts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// The lock: which version of each package a build installed, kept so the next
|
|
2
|
+
// build installs the same ones. It is npm's own `package-lock.json` (lockfile
|
|
3
|
+
// version 3), read and written for its top level only: each package at
|
|
4
|
+
// `packages["node_modules/<name>"].version`. A compile installs one version
|
|
5
|
+
// of each package name, flat (./npm.ts), so a nested entry
|
|
6
|
+
// (`node_modules/a/node_modules/b`) that `npm install` wrote is not read.
|
|
7
|
+
//
|
|
8
|
+
// A build installs every locked version exactly, and a declared range only
|
|
9
|
+
// where the lock holds no version that satisfies it. Then the lock is written
|
|
10
|
+
// again from what the declared packages reach, so a package nothing needs any
|
|
11
|
+
// more leaves it. A published npm version never changes, so the same lock is
|
|
12
|
+
// the same code.
|
|
13
|
+
/* @ts-types="npm:@types/semver@^7.8.0" */ import { satisfies } from 'semver'
|
|
14
|
+
|
|
15
|
+
/** Package name to exact version. */
|
|
16
|
+
export type Pins = Record<string, string>
|
|
17
|
+
|
|
18
|
+
let TOP = /^node_modules\/((?:@[^/]+\/)?[^/]+)$/
|
|
19
|
+
|
|
20
|
+
/** The npm versions a package-lock.json pins; toolkit provenance is not an
|
|
21
|
+
* installer input, including legacy @yaks registry versions.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { assertEquals } from '@std/assert'
|
|
25
|
+
* assertEquals(pins(JSON.stringify({ lockfileVersion: 3, packages: {
|
|
26
|
+
* '': { dependencies: { three: '^0.180.0' } },
|
|
27
|
+
* 'node_modules/three': { version: '0.180.1' },
|
|
28
|
+
* 'node_modules/a/node_modules/b': { version: '2.0.0' },
|
|
29
|
+
* } })), { three: '0.180.1' })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export let pins = (text: string | null): Pins => {
|
|
33
|
+
if (text == null) return {}
|
|
34
|
+
let lock: { packages?: Record<string, { version?: unknown }> }
|
|
35
|
+
try {
|
|
36
|
+
lock = JSON.parse(text)
|
|
37
|
+
} catch (e) {
|
|
38
|
+
throw new Error(`package-lock.json is not JSON: ${(e as Error).message}`)
|
|
39
|
+
}
|
|
40
|
+
let out: Pins = {}
|
|
41
|
+
for (let [key, entry] of Object.entries(lock?.packages ?? {})) {
|
|
42
|
+
let name = key.match(TOP)?.[1]
|
|
43
|
+
if (
|
|
44
|
+
name && !name.startsWith('@yaks/') &&
|
|
45
|
+
typeof entry?.version == 'string' &&
|
|
46
|
+
!entry.version.startsWith('sha256:') && entry.version != 'platform'
|
|
47
|
+
) out[name] = entry.version
|
|
48
|
+
}
|
|
49
|
+
return out
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** What to install: every pinned version, and each declared range the pins
|
|
53
|
+
* do not satisfy.
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { assertEquals } from '@std/assert'
|
|
57
|
+
* assertEquals(
|
|
58
|
+
* wanted({ three: '^0.180.0', hono: '^4' }, { three: '0.180.1', tslib: '2.8.1' }),
|
|
59
|
+
* { three: '0.180.1', tslib: '2.8.1', hono: '^4' },
|
|
60
|
+
* )
|
|
61
|
+
* assertEquals(wanted({ three: '^0.181.0' }, { three: '0.180.1' }), {
|
|
62
|
+
* three: '^0.181.0',
|
|
63
|
+
* })
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export let wanted = (ranges: Record<string, string>, pinned: Pins): Pins => {
|
|
67
|
+
let out: Pins = Object.fromEntries(
|
|
68
|
+
Object.entries(pinned).filter(([n, v]) =>
|
|
69
|
+
!n.startsWith('@yaks/') && v != 'platform' && !v.startsWith('sha256:')
|
|
70
|
+
),
|
|
71
|
+
)
|
|
72
|
+
for (let [name, range] of Object.entries(ranges)) {
|
|
73
|
+
if (name.startsWith('@yaks/') || range == 'platform') {
|
|
74
|
+
throw new Error(
|
|
75
|
+
`${name}: seed platform dependencies before npm installation`,
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
let pin = out[name]
|
|
79
|
+
if (!pin || !safely(pin, range)) out[name] = range
|
|
80
|
+
}
|
|
81
|
+
return out
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// A range semver cannot read (a tag, a URL) never keeps a pin: the build
|
|
85
|
+
// resolves it again, which is what npm would do.
|
|
86
|
+
let safely = (version: string, range: string) => {
|
|
87
|
+
try {
|
|
88
|
+
return satisfies(version, range)
|
|
89
|
+
} catch {
|
|
90
|
+
return false
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** The installed packages the declared ones reach, through each package's own
|
|
95
|
+
* dependencies, with the version installed.
|
|
96
|
+
*
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { assertEquals } from '@std/assert'
|
|
99
|
+
* let deps: Record<string, string[]> = { a: ['b'], b: ['a'], c: [] }
|
|
100
|
+
* assertEquals(
|
|
101
|
+
* reached(['a'], { a: '1.0.0', b: '2.0.0', c: '3.0.0' }, (n) => deps[n] ?? []),
|
|
102
|
+
* { a: '1.0.0', b: '2.0.0' },
|
|
103
|
+
* )
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export let reached = (
|
|
107
|
+
roots: string[],
|
|
108
|
+
installed: Pins,
|
|
109
|
+
needs: (name: string) => string[],
|
|
110
|
+
): Pins => {
|
|
111
|
+
let out: Pins = {}
|
|
112
|
+
let visit = (name: string) => {
|
|
113
|
+
if (name in out || !(name in installed)) return
|
|
114
|
+
out[name] = installed[name]
|
|
115
|
+
for (let dep of needs(name)) visit(dep)
|
|
116
|
+
}
|
|
117
|
+
for (let name of roots) visit(name)
|
|
118
|
+
return out
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** A package-lock.json holding these versions under these declared ranges,
|
|
122
|
+
* named as package.json names the app, if it does. */
|
|
123
|
+
export let lockfile = (
|
|
124
|
+
name: string | undefined,
|
|
125
|
+
ranges: Record<string, string>,
|
|
126
|
+
versions: Pins,
|
|
127
|
+
): string =>
|
|
128
|
+
JSON.stringify(
|
|
129
|
+
{
|
|
130
|
+
name,
|
|
131
|
+
lockfileVersion: 3,
|
|
132
|
+
requires: true,
|
|
133
|
+
packages: {
|
|
134
|
+
'': { name, dependencies: ranges },
|
|
135
|
+
...Object.fromEntries(
|
|
136
|
+
Object.keys(versions).sort().map((
|
|
137
|
+
pkg,
|
|
138
|
+
) => [`node_modules/${pkg}`, {
|
|
139
|
+
version: versions[pkg],
|
|
140
|
+
...(versions[pkg].startsWith('sha256:')
|
|
141
|
+
? { resolved: 'platform' }
|
|
142
|
+
: {}),
|
|
143
|
+
}]),
|
|
144
|
+
),
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
null,
|
|
148
|
+
2,
|
|
149
|
+
) + '\n'
|
|
150
|
+
|
|
151
|
+
/** `name@version` as the installer says it, split at the version's `@`.
|
|
152
|
+
*
|
|
153
|
+
* ```ts
|
|
154
|
+
* import { assertEquals } from '@std/assert'
|
|
155
|
+
* assertEquals(split('@hono/zod-validator@0.4.3'), ['@hono/zod-validator', '0.4.3'])
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export let split = (said: string): [string, string] => {
|
|
159
|
+
let at = said.lastIndexOf('@')
|
|
160
|
+
return [said.slice(0, at), said.slice(at + 1)]
|
|
161
|
+
}
|
package/mod.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @yaks/esbuild: an app's code, and compiling the parts of it a runtime cannot
|
|
2
|
+
// load as written. The module graph (./graph.ts) is how a host finds what an
|
|
3
|
+
// entry reaches, reading TypeScript through a `Strip` it is handed (sucrase's
|
|
4
|
+
// is `./strip`, ./strip.ts); the plan (./plan.ts) is what a deploy must
|
|
5
|
+
// compile; the compile itself is `./compile` (./compile.ts), which starts
|
|
6
|
+
// native esbuild; and a package's home (./home.ts) is where a host serves an
|
|
7
|
+
// npm package's files from, filled out of its registry tarball by `./unpack`
|
|
8
|
+
// (./unpack.ts).
|
|
9
|
+
export { modules, packageOf, relative, resolved, script, sources, specifiers, started, startsIn, twins, typed } from "./graph.js";
|
|
10
|
+
export { COMPILER, dependencies, loaded, mapped, plan, toolkitOf, toolkits, Unplanned } from "./plan.js";
|
|
11
|
+
export { homeOf, REGISTRY } from "./home.js";
|
|
12
|
+
export { lockfile, pins, wanted } from "./lock.js";
|
|
13
|
+
export { seed } from "./platform.js";
|
|
14
|
+
//# sourceMappingURL=mod.js.map
|
package/mod.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sources":["./mod.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6EAA6E;AAC7E,8EAA8E;AAC9E,wEAAwE;AACxE,0EAA0E;AAC1E,6EAA6E;AAC7E,6EAA6E;AAC7E,iBAAiB;AACjB,SACE,OAAO,EACP,SAAS,EAGT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,UAAU,EACV,OAAO,EACP,QAAQ,EAER,KAAK,EACL,KAAK,qBAEY;AACnB,SAIE,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,MAAM,EAEN,IAAI,EACJ,SAAS,EAET,QAAQ,EACR,SAAS,oBACO;AAClB,SAAS,MAAM,EAAE,QAAQ,oBAAiC;AAC1D,SAAS,QAAQ,EAAa,IAAI,EAAE,MAAM,oBAAmB;AAC7D,SAAuB,IAAI,wBAAuB"}
|
package/mod.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @yaks/esbuild: an app's code, and compiling the parts of it a runtime cannot
|
|
2
|
+
// load as written. The module graph (./graph.ts) is how a host finds what an
|
|
3
|
+
// entry reaches, reading TypeScript through a `Strip` it is handed (sucrase's
|
|
4
|
+
// is `./strip`, ./strip.ts); the plan (./plan.ts) is what a deploy must
|
|
5
|
+
// compile; the compile itself is `./compile` (./compile.ts), which starts
|
|
6
|
+
// native esbuild; and a package's home (./home.ts) is where a host serves an
|
|
7
|
+
// npm package's files from, filled out of its registry tarball by `./unpack`
|
|
8
|
+
// (./unpack.ts).
|
|
9
|
+
export {
|
|
10
|
+
modules,
|
|
11
|
+
packageOf,
|
|
12
|
+
type Reached,
|
|
13
|
+
type Read,
|
|
14
|
+
relative,
|
|
15
|
+
resolved,
|
|
16
|
+
script,
|
|
17
|
+
sources,
|
|
18
|
+
specifiers,
|
|
19
|
+
started,
|
|
20
|
+
startsIn,
|
|
21
|
+
type Strip,
|
|
22
|
+
twins,
|
|
23
|
+
typed,
|
|
24
|
+
type Walk,
|
|
25
|
+
} from './graph.js'
|
|
26
|
+
export {
|
|
27
|
+
type Answer,
|
|
28
|
+
type App,
|
|
29
|
+
type Ask,
|
|
30
|
+
COMPILER,
|
|
31
|
+
dependencies,
|
|
32
|
+
loaded,
|
|
33
|
+
mapped,
|
|
34
|
+
type Plan,
|
|
35
|
+
plan,
|
|
36
|
+
toolkitOf,
|
|
37
|
+
type Toolkits,
|
|
38
|
+
toolkits,
|
|
39
|
+
Unplanned,
|
|
40
|
+
} from './plan.js'
|
|
41
|
+
export { homeOf, REGISTRY, type Tarball } from './home.js'
|
|
42
|
+
export { lockfile, type Pins, pins, wanted } from './lock.js'
|
|
43
|
+
export { type Catalog, seed } from './platform.js'
|