@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/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Jeff Peterson
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,451 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @yaks/esbuild
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Compiles a web app's TypeScript, npm and platform toolkit imports with esbuild,
|
|
4
|
+
at deploy: the server source (a Worker module) and each
|
|
5
|
+
`<script type="module" src>` a page loads. An app that needs neither plans
|
|
6
|
+
nothing and deploys as it is written.
|
|
7
|
+
|
|
8
|
+
Two halves, because compiling needs a process of its own (native esbuild) and
|
|
9
|
+
deciding does not:
|
|
10
|
+
|
|
11
|
+
- **`.`** decides, anywhere, a Worker included: which files an app's code
|
|
12
|
+
reaches, and what must be compiled. It holds no compiler.
|
|
13
|
+
- **`./compile`** compiles, wherever a process can be started: it installs npm
|
|
14
|
+
packages from the registry and builds each entry with native esbuild. It is
|
|
15
|
+
handed every file it reads and holds no binding and no secret.
|
|
16
|
+
|
|
17
|
+
And `./strip`, sucrase reading TypeScript and JSX as JavaScript for the walk,
|
|
18
|
+
and `compiled`, one module as a browser runs it, which a host whose upload
|
|
19
|
+
cannot carry sucrase reaches elsewhere (yaks.app's kernel asks its compiler
|
|
20
|
+
Worker); `./file`, the name a compiled module is kept under and `compiledFiles`,
|
|
21
|
+
which compiles only what nobody kept (below); `./unpack`, the host's when it
|
|
22
|
+
fills an npm package's home (below); and `./dependencies`, `dependencies` and
|
|
23
|
+
`Unplanned` alone, for a host that reads an app's package.json without walking
|
|
24
|
+
its modules.
|
|
25
|
+
|
|
26
|
+
An **ask** (`Ask`) is what a compile is handed: the text of every file it reads,
|
|
27
|
+
and the entries to build. An **answer** (`Answer`) is what it returns: one
|
|
28
|
+
module per entry, the lock, and any errors, each a line an agent can act on.
|
|
29
|
+
|
|
30
|
+
## The verbs
|
|
31
|
+
|
|
32
|
+
- `plan({paths, read, main, flags, strip})` returns
|
|
33
|
+
`{ask, notes, inputs,
|
|
34
|
+
reads}`, or `null` when nothing needs compiling.
|
|
35
|
+
`main` is the server source, if the app has one; `flags` its compatibility
|
|
36
|
+
flags; `strip` how its TypeScript and JSX are read as JavaScript. It throws
|
|
37
|
+
`Unplanned` with a sentence the author can act on, such as a `package.json`
|
|
38
|
+
that is not JSON. Its `inputs` name each compiled entry's source paths, so a
|
|
39
|
+
host can reuse unchanged output across deploys. `reads` names every source
|
|
40
|
+
examined to form the plan, including plain scripts and HTML. A host with an
|
|
41
|
+
immutable file manifest can reuse the plan when its paths and the digests of
|
|
42
|
+
these files are unchanged.
|
|
43
|
+
- `modules(read, entry)` and `sources(strip)(read, entry)` walk the module graph
|
|
44
|
+
from one file: `modules` as the runtime links (a specifier names a file
|
|
45
|
+
exactly, and a TypeScript or JSX file is a leaf), `sources` as esbuild
|
|
46
|
+
resolves (extensions, `index` files, the `.ts` twin of a `.js` import),
|
|
47
|
+
reading TypeScript and JSX through `strip`. Each returns the files reached,
|
|
48
|
+
the packages named, and each Web Worker a file starts
|
|
49
|
+
(`new Worker(new URL('./grow.ts', import.meta.url))`) as that file and the
|
|
50
|
+
specifier: an entry of its own, not walked. Both parse: an import in a comment
|
|
51
|
+
or a string names nothing, and `import type` is gone with the types.
|
|
52
|
+
- `loaded(page, html)` is the module scripts a page loads, and `mapped(html)`
|
|
53
|
+
what its import maps name.
|
|
54
|
+
- `dependencies(text)` reads `package.json`'s `dependencies` (also
|
|
55
|
+
`./dependencies`).
|
|
56
|
+
- `compile(ask, catalog, origin)`, from `./compile`, builds what an ask names
|
|
57
|
+
and answers. It never throws for the app's own mistakes, which are the
|
|
58
|
+
answer's `errors`.
|
|
59
|
+
|
|
60
|
+
## A file at a time
|
|
61
|
+
|
|
62
|
+
`compiled(path, source, {jsxImportSource})` (`./strip`) is one module as a
|
|
63
|
+
browser runs it: TypeScript and JSX stripped, its imports as written, its lines
|
|
64
|
+
where they were, so a stack trace names the source line. Automatic JSX comes
|
|
65
|
+
from `jsxImportSource`, classic `React.createElement` without one. It does not
|
|
66
|
+
minify: the lines are what a trace reads, and HTTP compression takes most of the
|
|
67
|
+
whitespace.
|
|
68
|
+
|
|
69
|
+
`compiledName(path, address, options)` (`./file`) names the output: the digest
|
|
70
|
+
of the compiler's version (`COMPILER`), the file's kind, the options and the
|
|
71
|
+
source's address, the SHA-256 of its bytes (`addressOf`), which a host already
|
|
72
|
+
keeps a file under. The same source compiles to the same name in any app at any
|
|
73
|
+
path, so a host keeps each output once for everyone.
|
|
74
|
+
`compiledFiles(sources, keep, compile, {known})` names every file and compiles
|
|
75
|
+
only output `keep` lacks, reading a source (`Source.read`) only then; `known`,
|
|
76
|
+
the names the release before used, is taken without asking.
|
|
77
|
+
`keptIn(store, prefix)` is a `Keep` over a byte store, each module at
|
|
78
|
+
`<prefix><name>.js`. An app's own scripts are kept under `APP_MODULES`, apart
|
|
79
|
+
from package modules (`MODULES`), so the public `MODULES_AT` never answers one
|
|
80
|
+
and an app serves its own behind its access. yaks.app keeps them in its bucket
|
|
81
|
+
and compiles through its compiler Worker (@yaks/platform/hashed, with
|
|
82
|
+
workers/yak/esbuild.ts `compiling`).
|
|
83
|
+
|
|
84
|
+
## A package at a time
|
|
85
|
+
|
|
86
|
+
A package is compiled once for the whole platform, at one version: an npm
|
|
87
|
+
package at an exact version, a toolkit package at its catalog version.
|
|
88
|
+
`compilePackage({package: {name, version, toolkit?}, origin})` (`./compile`, and
|
|
89
|
+
the container's server for a job that names a `package`) installs the package
|
|
90
|
+
alone and builds every concrete browser export of it as an entry, the files
|
|
91
|
+
entries share split into chunks, minified. Every import of another package, and
|
|
92
|
+
of this one by its own name, stays bare as written, so its bytes never depend on
|
|
93
|
+
an app or on the versions of what it imports: the page's import map says where
|
|
94
|
+
each is. A CommonJS entry exports the names CommonJS assigns, and its `require`
|
|
95
|
+
of another package is that package imported bare. Each module is named for the
|
|
96
|
+
package's key and its place in the build, and its imports of the others are
|
|
97
|
+
rewritten to those names. A toolkit package's resources are kept beside its
|
|
98
|
+
modules, under its package's name, where its own `import.meta.url` finds them;
|
|
99
|
+
an npm package's are served from its home.
|
|
100
|
+
|
|
101
|
+
`keptPackage(store, key, compile)` (`./file`) answers a package version's
|
|
102
|
+
entries from its record, `modules/<packageName(key)>.json`, or compiles it,
|
|
103
|
+
keeps every module under `modules/`, and writes the record last.
|
|
104
|
+
`servedModule(store, file)` answers a kept module or resource, immutable and
|
|
105
|
+
readable from any origin; yaks.app serves them at `MODULES_AT`, `/__m/`, and
|
|
106
|
+
compiles each package a deploy's lock pins, and each toolkit package it was made
|
|
107
|
+
of, the first time a deploy names it (@yaks/platform/hashed `packageEntries`).
|
|
108
|
+
The record also says what each module imports statically (`links`), and
|
|
109
|
+
`scriptLinks` says the same of an app's own script; `packageLinks` puts the two
|
|
110
|
+
in one graph by address, which a page walks to preload every module it reaches
|
|
111
|
+
beside its first (@yaks/platform/asset-url `reached`).
|
|
112
|
+
|
|
113
|
+
## Packs
|
|
114
|
+
|
|
115
|
+
A page of hundreds of modules loads slower than the same app bundled: each
|
|
116
|
+
module is a request at the host's door, and a package's entries cannot shed what
|
|
117
|
+
the page never uses. `./pack`'s
|
|
118
|
+
`packModules({roots, modules, packages, imports})` packs what a page's roots
|
|
119
|
+
reach, by import or literal `import()`, from the modules as compiled, with
|
|
120
|
+
native esbuild: one file a root and chunks the roots share. A bare specifier the
|
|
121
|
+
page's map (`imports`) names a package module of `packages` for is packed with
|
|
122
|
+
the rest, tree-shaken; any other stays bare for the map. Every file it writes is
|
|
123
|
+
served at the app's root, so an app's import the pack does not hold is written
|
|
124
|
+
by its path from there, and a module's `import.meta.url` is its own address, as
|
|
125
|
+
when it loaded alone. A module that computes a path it imports from (an
|
|
126
|
+
`import()` of anything but a `new URL(…)`), reads `import.meta` beyond its URL,
|
|
127
|
+
or that esbuild refuses throws `Unpackable`, and its page keeps its modules. A
|
|
128
|
+
host posts `{pack}` to the container's server, which answers the `Packed` or
|
|
129
|
+
422, naming its packer in `PACKED_BY` (`./container`). `PACKER` (`./file`) is
|
|
130
|
+
the packer's version, raised when the same modules would pack to other bytes; a
|
|
131
|
+
host keeps only an answer of its own packer's, since containers roll out after
|
|
132
|
+
it. @yaks/platform/hashed `packFor` keeps a pack, after the release is live,
|
|
133
|
+
never before.
|
|
134
|
+
|
|
135
|
+
## Linked modules
|
|
136
|
+
|
|
137
|
+
A page's import map reaches neither a module worker nor a Worker's upload, so
|
|
138
|
+
`./link` writes a module graph with the addresses a map would give. A **linked**
|
|
139
|
+
module is kept under a name of its own: the digest of its module's name and of
|
|
140
|
+
everything it reaches, edges included, so the same graph links to the same names
|
|
141
|
+
in any app and an edit renames only the modules that reach it. A package module
|
|
142
|
+
that reaches no bare specifier needs no linking and keeps its name.
|
|
143
|
+
|
|
144
|
+
- `linkWorkers(release, {source, read, keep, previous})` finds each module
|
|
145
|
+
worker a release's scripts start (`startsIn`) and keeps every module the
|
|
146
|
+
worker reaches linked: an app's script at its own path with `?v=` naming its
|
|
147
|
+
linked module, a package module at its address. It answers a `Linking`, which
|
|
148
|
+
the next release passes back as `previous`, so only what changed is read and
|
|
149
|
+
only what nobody kept is written. yaks.app serves the worker's own address as
|
|
150
|
+
`import "./grow.ts?v=<linked>"` (workers/yak/release.ts), and
|
|
151
|
+
`yak release serve` answers it with the linked module (@yaks/platform
|
|
152
|
+
files-routes.ts).
|
|
153
|
+
- `serverUpload(main, release, files, read, source)` is a Worker's upload of
|
|
154
|
+
what its server source reaches, each file compiled on its own: an app's script
|
|
155
|
+
under its path, a package module under `__m/`, every specifier written as the
|
|
156
|
+
name it links to. A JSON or text file imported with its type
|
|
157
|
+
(`with { type: 'json' }`) uploads as a module whose default is its value. It
|
|
158
|
+
answers undefined when nothing needs compiling, and null when the container
|
|
159
|
+
must build the source: an import of another type, or a static import of a bare
|
|
160
|
+
specifier the map does not name.
|
|
161
|
+
|
|
162
|
+
`linkNames`, `graphOf`, `resolver`, `rewritten` and `linkedTexts` are the parts.
|
|
163
|
+
|
|
164
|
+
## The compile
|
|
165
|
+
|
|
166
|
+
```ts ignore
|
|
167
|
+
import { equal } from '@yaks/testing'
|
|
168
|
+
import { compile } from '@yaks/esbuild/compile'
|
|
169
|
+
|
|
170
|
+
let answer = await compile({
|
|
171
|
+
files: {
|
|
172
|
+
'main.ts': "import { twice } from './twice'\n" +
|
|
173
|
+
'export let n: number = twice(21)',
|
|
174
|
+
'twice.ts': 'export let twice = (n: number) => n * 2',
|
|
175
|
+
},
|
|
176
|
+
pages: ['main.ts'],
|
|
177
|
+
})
|
|
178
|
+
equal(answer.errors, [])
|
|
179
|
+
let page = await import(
|
|
180
|
+
`data:text/javascript,${encodeURIComponent(answer.pages['main.ts'])}`
|
|
181
|
+
)
|
|
182
|
+
equal(page.n, 42)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
esbuild runs as a process beside the compile's own, started by the first build
|
|
186
|
+
and kept for the next. Every build reads from the ask's files and the installed
|
|
187
|
+
packages, never the disk. The same ask, catalog, npm pins and shared-module
|
|
188
|
+
origin compile to the same bytes on any host.
|
|
189
|
+
|
|
190
|
+
The module's default export is a server's `fetch`, for `deno serve`. A host
|
|
191
|
+
posts it a **job** (`Job`): `{ask, catalog, origin?, shared?}`, the app's ask
|
|
192
|
+
and the host's toolkit catalog (below). The server responds with the answer as
|
|
193
|
+
JSON, or with 503 when esbuild's process ended under the build. Its service
|
|
194
|
+
channel gives no exit reason, so `compile` throws `Stopped` and the next build
|
|
195
|
+
starts esbuild again. The container relay returns 507 if it observes the
|
|
196
|
+
container exit after a SIGKILL. yaks.app replays either interruption once on
|
|
197
|
+
another container with the same ask and catalog. If both runs are interrupted
|
|
198
|
+
and the final response is 503, a release remake stays queued for another try. A
|
|
199
|
+
job the server knows no shape of is answered 501 (`UNKNOWN`), never compiled: a
|
|
200
|
+
container rolls out after the host that posts a new kind of job, and yaks.app's
|
|
201
|
+
page packs ask again rather than fail.
|
|
202
|
+
|
|
203
|
+
A host opts into shared browser modules with `shared: true` once it can store
|
|
204
|
+
and serve `Answer.shared`. Jobs omitting this flag return fully bundled pages
|
|
205
|
+
and app-local resources, so a compiler rollout keeps answering older hosts.
|
|
206
|
+
Direct `compile` calls enable sharing by default; the fourth argument
|
|
207
|
+
`{shared: false}` selects fully bundled pages, and its `get` replaces `fetch`
|
|
208
|
+
for reaching the npm registry.
|
|
209
|
+
|
|
210
|
+
## Compiler timing
|
|
211
|
+
|
|
212
|
+
The server always includes `Answer.timing`, measured with `performance.now()` in
|
|
213
|
+
the compiler process. Direct calls request it with the fourth argument
|
|
214
|
+
`{timing: true}`; calls without it retain the same answer shape.
|
|
215
|
+
|
|
216
|
+
`install`, `registry`, `shelf`, `worker`, `carried`, `used`, `groups`, `cache`,
|
|
217
|
+
`pages` and `total` are milliseconds. `install` includes seeding toolkit sources
|
|
218
|
+
and making the lock. `registry` is the wall time spent on registry requests and
|
|
219
|
+
their bodies during installation, counted once where requests overlap; `shelf`
|
|
220
|
+
is the same for reads from the shelf (below). `carried` measures the consumer
|
|
221
|
+
graph build and common-package analysis; `used` measures export trimming.
|
|
222
|
+
`groups` measures shared-group work excluding `carried` and `used`; `cache` is
|
|
223
|
+
the lookup and source-validation subset of `groups`, not another phase to add to
|
|
224
|
+
it. `pages` sums all page entry builds. `hits` and `misses` count shared-group
|
|
225
|
+
cache lookups, not milliseconds: a compile whose groups all come from one kept
|
|
226
|
+
result counts one hit. A phase that did not run is zero; app errors retain
|
|
227
|
+
timing for the work attempted. The timings contain no source text or package
|
|
228
|
+
names.
|
|
229
|
+
|
|
230
|
+
The server's `Server-Timing` header names these durations `compiler_install`,
|
|
231
|
+
`compiler_worker`, and so on. `compiler_parse` measures reading and parsing the
|
|
232
|
+
job, `compiler_serialize` measures serializing the answer, and
|
|
233
|
+
`compiler_request` spans both and the compile. These are separate from
|
|
234
|
+
`compiler_total`, which measures only the compiler work. The yaks.app host
|
|
235
|
+
forwards these metrics beside its own `compile` round-trip duration.
|
|
236
|
+
`compiler_start` appears when the container starts during the call.
|
|
237
|
+
`compiler_container` spans that startup and the wait for its response headers.
|
|
238
|
+
`compiler_retry` measures the first attempt when a job is replayed. The host
|
|
239
|
+
reports `compiler_resources` for writing compiled assets and `worker_upload` for
|
|
240
|
+
uploading the executable. Hit and miss counts remain in the JSON answer.
|
|
241
|
+
|
|
242
|
+
## Platform toolkit sources
|
|
243
|
+
|
|
244
|
+
An app declares toolkit dependencies in `package.json` with the compiler-owned
|
|
245
|
+
version, not a registry version:
|
|
246
|
+
|
|
247
|
+
```json
|
|
248
|
+
{ "dependencies": { "@yaks/client": "platform", "preact": "^10" } }
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`compile(ask, catalog = {}, origin = 'https://yaks.app')` accepts the catalog
|
|
252
|
+
and shared-module origin from its host wrapper. The app sends only its `Ask`; it
|
|
253
|
+
cannot supply a catalog. Existing npm-only callers need no second argument. A
|
|
254
|
+
toolkit dependency requires that its compiler has the package and rejects any
|
|
255
|
+
version other than `"platform"`, never fetching a stale `@yaks/*` registry
|
|
256
|
+
release.
|
|
257
|
+
|
|
258
|
+
`platform.ts` exports `Catalog`, a map from package name to
|
|
259
|
+
`{files, resources, dependencies, version}`. `files` are npm-shaped paths
|
|
260
|
+
relative to the package root, including `package.json` with its exports. The
|
|
261
|
+
host's generator normalizes source imports and includes runtime dependencies,
|
|
262
|
+
not test imports or unrelated server exports. `dependencies` maps toolkit
|
|
263
|
+
packages to `"platform"` and external npm packages to their ranges. `version` is
|
|
264
|
+
`sha256:<64 lowercase hex digits>` over the generated package's source bytes.
|
|
265
|
+
|
|
266
|
+
The pure `seed(files, catalog)` returns
|
|
267
|
+
`{files, assets, dependencies, platform}`: app files plus the declared toolkit
|
|
268
|
+
roots and their package-level dependency closure under `node_modules/`, npm
|
|
269
|
+
roots including every reached toolkit external, and toolkit names mapped to
|
|
270
|
+
exact source digests. Unused catalog entries stay out. External ranges from
|
|
271
|
+
multiple consumers must overlap because the installer is flat. Toolkit externals
|
|
272
|
+
are explicit npm roots because the installer keeps a preseeded package as it is,
|
|
273
|
+
without installing its dependencies or reporting it as installed.
|
|
274
|
+
|
|
275
|
+
`resources` holds runtime text files by package-relative path. The generator
|
|
276
|
+
reads each browser package's `package.json` resource globs (for example,
|
|
277
|
+
`"resources": ["**/*.css"]`); their bytes contribute to the catalog digest.
|
|
278
|
+
`seed` and `Answer.assets` place them under `__packages/<package>/<path>` for
|
|
279
|
+
server builds. The compiler rewrites parsed server package `import.meta.url`
|
|
280
|
+
references to the original package module's absolute logical location, such as
|
|
281
|
+
`file:///__packages/@yaks/ui/Button.tsx`. Hosts retain these assets beside
|
|
282
|
+
compiled output. Comments, strings and the app's own module URLs are unchanged.
|
|
283
|
+
|
|
284
|
+
A page imports toolkit packages, Preact and Preact Signals as **shared
|
|
285
|
+
modules**: browser modules compiled separately from the app's entry. An npm
|
|
286
|
+
package is a shared module too when more than one of a page's **consumers**
|
|
287
|
+
imports it, directly or through npm packages bundled into it: the page scripts
|
|
288
|
+
are one consumer, and each toolkit package and each shared npm package is
|
|
289
|
+
another. A page and a toolkit package that both import `three` load one `three`.
|
|
290
|
+
A package only one consumer imports stays bundled into it, where esbuild keeps
|
|
291
|
+
only what it uses. So does one an ES module URL cannot stand in for: something
|
|
292
|
+
`require`s it, or an import of it names a CommonJS or non-script file. A toolkit
|
|
293
|
+
package's or Preact's concrete browser exports are the entries of its splitting
|
|
294
|
+
build, each keeping all it exports, so every app loads the same module. A shared
|
|
295
|
+
npm package's entries are the specifiers of it that anything imports, each
|
|
296
|
+
carrying only the exports of it the page's consumers use, so the one instance
|
|
297
|
+
costs what one bundled copy of their union would, and each package's subpaths
|
|
298
|
+
share it. esbuild decides what is used, as it does for a bundled copy: a
|
|
299
|
+
namespace read by property names uses those exports, and one passed along or
|
|
300
|
+
read by computed keys uses every export. Packages with cyclic dependencies share
|
|
301
|
+
one build. Dependency groups import one another through absolute URLs on
|
|
302
|
+
`origin`. A group's URL names its emitted bytes, so two apps with the same
|
|
303
|
+
sources, npm pins, imported specifiers and used exports reuse the same modules,
|
|
304
|
+
and another pinned version is another module. Preact's main, hooks, compat and
|
|
305
|
+
JSX exports share one instance; Signals and its core import that same Preact
|
|
306
|
+
instance. Preact server-rendering adapters need an optional renderer peer and
|
|
307
|
+
are refused as shared browser imports.
|
|
308
|
+
|
|
309
|
+
`Answer.shared` maps `__packages/<sha256>/<path>` to emitted modules and runtime
|
|
310
|
+
resources. Each group's `modules.json` records its exported specifiers, keeping
|
|
311
|
+
distinct packages' module state distinct even when their JavaScript is
|
|
312
|
+
identical. The SHA256 names the complete group's emitted bytes and resource
|
|
313
|
+
bytes, including its dependency URLs. Hosts store these files once, serve them
|
|
314
|
+
with `Cache-Control: public, max-age=31536000, immutable`, and keep them
|
|
315
|
+
available for retained versions and published releases. A package source's
|
|
316
|
+
`import.meta.url` resolves inside its group's
|
|
317
|
+
`resources/<package>/<original-path>` namespace, so
|
|
318
|
+
`new URL('./Button.css', import.meta.url)` keeps loading beside that source.
|
|
319
|
+
|
|
320
|
+
The compiler retains completed shared groups under a 16 MiB cache budget across
|
|
321
|
+
jobs, and every group of a compile together under another. Which npm packages
|
|
322
|
+
the pages share, and which of their exports are used, is read from each
|
|
323
|
+
consumer's entries apart, the pages' and each toolkit package's: a page edit
|
|
324
|
+
builds only the pages again, and a change to one toolkit package only that
|
|
325
|
+
package's entries. A cache key includes the actual catalog sources and
|
|
326
|
+
resources, dependency URLs and npm pins, and cache hits validate every source
|
|
327
|
+
file the group read; a claimed digest or unchanged npm manifest cannot conceal
|
|
328
|
+
changed source bytes. The catalog travels with every job. Hosts need no compiler
|
|
329
|
+
redeploy when toolkit packages change, and include their catalog identity in
|
|
330
|
+
compile reuse fingerprints. A page's shared modules are the toolkit its compile
|
|
331
|
+
saw, for as long as its output serves, so a host that wants a toolkit fix to
|
|
332
|
+
reach output already made keeps what each compile was made of:
|
|
333
|
+
`toolkits(catalog)` is each toolkit package's source digest and the toolkit
|
|
334
|
+
packages it depends on, small enough to keep beside the catalog, and
|
|
335
|
+
`toolkitOf(packageJson, toolkits)` is the digest of each one a package.json
|
|
336
|
+
reaches. yaks.app records the latter with every compile and compiles a release
|
|
337
|
+
again when a page of it is served by a toolkit whose digests differ
|
|
338
|
+
(workers/yak/toolkit.ts). An absent toolkit package or browser export refuses
|
|
339
|
+
compilation with the missing specifier in its error. App files cannot use the
|
|
340
|
+
reserved `node_modules/` namespace, and shared builds read only compiler-owned
|
|
341
|
+
package files, so an app's private source cannot enter public shared output.
|
|
342
|
+
|
|
343
|
+
## The shelf
|
|
344
|
+
|
|
345
|
+
A container keeps its caches in memory, and loses them when it sleeps. The
|
|
346
|
+
**shelf** (`./shelf.ts`) is what it keeps beyond that: a key-value door over
|
|
347
|
+
HTTP, `GET` for a key's bytes (404 when there are none) and `PUT` to keep them,
|
|
348
|
+
which the host answers. `serving(compile, shelves)` takes two: `packages`, for
|
|
349
|
+
registry releases, whose tarball and dependencies a pinned install takes without
|
|
350
|
+
asking the registry, and `builds`, for the shared-module analysis and every
|
|
351
|
+
shared group of a compile, kept whole so a container that starts reads them at
|
|
352
|
+
once. A tarball is used only when its bytes are the SHA-256 its release names,
|
|
353
|
+
and a build only when every source it read is unchanged, as in memory.
|
|
354
|
+
`serve.ts` keeps builds under a digest of the compiler's own sources and Deno's
|
|
355
|
+
version, so another compiler never takes them. Puts run in the background, and a
|
|
356
|
+
shelf that fails is a miss and is left alone for a minute.
|
|
357
|
+
|
|
358
|
+
yaks.app's compiler Worker answers the shelf from its Compiler object's SQLite
|
|
359
|
+
(`workers/yak/esbuild` `Shelf`), beside the container, at a host name the
|
|
360
|
+
container's object intercepts (`./container.ts` `SHELF`), and starts the
|
|
361
|
+
container with that address in `SHELF`. A container started without it compiles
|
|
362
|
+
without a shelf.
|
|
363
|
+
|
|
364
|
+
## What is compiled
|
|
365
|
+
|
|
366
|
+
- The server source, when a file it reaches is TypeScript or JSX, or when it
|
|
367
|
+
imports a package other than `cloudflare:` and `node:` ones.
|
|
368
|
+
- A page script, when a file it reaches is TypeScript or JSX, or when it imports
|
|
369
|
+
a package `package.json` names. A package it does not name is left for the
|
|
370
|
+
page's import map, and the plan says so when the import map of a page that
|
|
371
|
+
loads the script does not name it.
|
|
372
|
+
- A module worker a page script starts, by the same rule as a page script,
|
|
373
|
+
except that no import map reaches a worker: every package it imports by name
|
|
374
|
+
must be one `package.json` names. The host serves it compiled at its source's
|
|
375
|
+
address. esbuild leaves `import.meta.url` as written, so in a compiled script
|
|
376
|
+
the worker's path resolves against the entry, not the file that names it. A
|
|
377
|
+
release of modules compiled one by one links its workers instead (Linked
|
|
378
|
+
modules, above), and they import what the page's map names.
|
|
379
|
+
|
|
380
|
+
A page script compiles to one minified file with `process.env.NODE_ENV` set to
|
|
381
|
+
`"production"`, importing its **pack** (`pack`): every shared module the page
|
|
382
|
+
scripts an HTML page loads together import, linked into one file under
|
|
383
|
+
`__packages/<sha256>/`, named by its bytes like a group. A shared group is many
|
|
384
|
+
small modules, and a cold page that imported them asked for each, 95 files for a
|
|
385
|
+
form; the pack is one. Scripts loaded together import the same pack, so a module
|
|
386
|
+
two of them import is one instance, and in the pack each module keeps its own
|
|
387
|
+
`import.meta.url`, so its resources load from its group. Any other script, a
|
|
388
|
+
module worker included, gets a pack of its own and evaluates only what it
|
|
389
|
+
imports. A release that changes only the app's own code keeps the pack its
|
|
390
|
+
browsers cached, and apps importing the same shared modules share it. Modules
|
|
391
|
+
evaluate in the order the pages first import them, and one imported lazily
|
|
392
|
+
evaluates when its import runs; its bytes come with the pack. A host compiles an
|
|
393
|
+
app's pages together, never keeping one from an older compile beside a new one,
|
|
394
|
+
and the plan's `together` names the scripts each HTML page loads together. The
|
|
395
|
+
server source compiles to one module; files it reaches that esbuild does not
|
|
396
|
+
load (text, WebAssembly) are named in `carry` for the host to upload beside it.
|
|
397
|
+
A file imported `with { type: 'text' }` is compiled in as its text, whatever its
|
|
398
|
+
extension, and a platform package's resources are importable that way
|
|
399
|
+
(`import sheet from '@yaks/ui/Button.css' with { type: 'text' }`), so a worker
|
|
400
|
+
answers a stylesheet composed of them without reading a file. An import esbuild
|
|
401
|
+
could not resolve is an error naming the package to add to `package.json`, never
|
|
402
|
+
a module left missing.
|
|
403
|
+
|
|
404
|
+
A package's file is an ES module or not as Node reads it: by its extension, or
|
|
405
|
+
for `.js`, `.jsx`, `.ts` and `.tsx`, by the `type` of the nearest package.json
|
|
406
|
+
within its package. That decides what an ES module's default import of CommonJS
|
|
407
|
+
reads, and it is `module.exports` from a package file typed as an ES module, as
|
|
408
|
+
in Node (tslib's `modules/index.js` imports `../tslib.js` that way). An app's
|
|
409
|
+
own files keep esbuild's reading, `exports.default` where CommonJS claims
|
|
410
|
+
`__esModule`.
|
|
411
|
+
|
|
412
|
+
## The installer
|
|
413
|
+
|
|
414
|
+
The compile installs what `package.json` names and what each package depends on,
|
|
415
|
+
one version of each name, flat under `node_modules/`. A package stays in its
|
|
416
|
+
gzipped tarball, and a file comes out of it the first time a build reads it, so
|
|
417
|
+
a compile holds the files its builds read rather than every file every package
|
|
418
|
+
ships: a page importing `three` reads 2 MB of the 20 MB of sources `three`
|
|
419
|
+
ships. Of a package's files, a build can read its text (scripts, JSON, CSS and
|
|
420
|
+
the like), never an image or a binary.
|
|
421
|
+
|
|
422
|
+
## A package's files
|
|
423
|
+
|
|
424
|
+
A page that bundles an npm package reaches the package's files as shipped: a
|
|
425
|
+
`.wasm`, a font, an image, a worker script. They are served from the package's
|
|
426
|
+
**home**, `__packages/<sha256>/` on `origin`, where the SHA-256 names the
|
|
427
|
+
registry tarball they come out of, so every app and every compile that pins that
|
|
428
|
+
release shares one home. The `import.meta.url` of a package module names its own
|
|
429
|
+
file in its home, so `new URL('./draco_decoder.wasm', import.meta.url)` resolves
|
|
430
|
+
to the file as shipped, and a folder named from it holds its siblings. That
|
|
431
|
+
holds for a page script's own packages and for shared ones alike. Toolkit
|
|
432
|
+
packages have no home: their resources come from the catalog.
|
|
433
|
+
|
|
434
|
+
A compile carries none of a package's files. `Answer.tarballs` maps the SHA-256
|
|
435
|
+
of each home the compiled code names to the tarball that fills it, and the host
|
|
436
|
+
keeps that note. The host fills a home a file at a time, the first time a page
|
|
437
|
+
asks for one: `unpacked(tarball, path)`, from `./unpack`, reads the registry's
|
|
438
|
+
tarball as it streams in and answers the file's bytes, every path the tarball
|
|
439
|
+
holds, and its SHA-256, which must be the home's name before the bytes are
|
|
440
|
+
served. A home is served like the shared modules, immutable.
|
|
441
|
+
|
|
442
|
+
## The lock
|
|
443
|
+
|
|
444
|
+
`package-lock.json`, npm's lockfile version 3, top level only. Every locked
|
|
445
|
+
version installs exactly; a declared range installs only where the lock holds no
|
|
446
|
+
version satisfying it. The answer's `lock` is the lock rewritten from what the
|
|
447
|
+
declared packages reach, so the next deploy installs the same external code.
|
|
448
|
+
Toolkit entries instead hold the compiler's current exact source digest in
|
|
449
|
+
`version`, with `resolved: "platform"`. Old toolkit pins (including old registry
|
|
450
|
+
versions) are never passed to the npm installer. The current catalog replaces
|
|
451
|
+
that provenance on every compile, while external versions remain pinned.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** esbuild's process ended under a build. That is the compiler's room, not
|
|
2
|
+
* the app's code: a process killed for memory ends this way, and so does one
|
|
3
|
+
* stopped with the container it runs in. */ export declare class Stopped extends Error {
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=bundle.d.ts.map
|