@primate/core 0.3.4 → 0.4.1

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.
Files changed (157) hide show
  1. package/lib/private/App.d.ts +5 -19
  2. package/lib/private/App.js +13 -75
  3. package/lib/private/Binder.d.ts +1 -3
  4. package/lib/private/Flags.d.ts +7 -0
  5. package/lib/private/Flags.js +7 -0
  6. package/lib/private/Module.d.ts +2 -2
  7. package/lib/private/backend/TAG.d.ts +1 -1
  8. package/lib/private/backend/TAG.js +1 -1
  9. package/lib/private/build/App.d.ts +34 -0
  10. package/lib/private/build/App.js +103 -0
  11. package/lib/private/build/client/index.d.ts +3 -0
  12. package/lib/private/build/client/index.js +95 -0
  13. package/lib/private/build/client/plugin/alias.d.ts +4 -0
  14. package/lib/private/build/client/plugin/alias.js +12 -0
  15. package/lib/private/build/client/plugin/entrypoint.d.ts +4 -0
  16. package/lib/private/build/client/plugin/entrypoint.js +15 -0
  17. package/lib/private/build/client/plugin/frontend.d.ts +4 -0
  18. package/lib/private/build/client/plugin/frontend.js +15 -0
  19. package/lib/private/build/client/plugin/server-stamp.d.ts +4 -0
  20. package/lib/private/build/client/plugin/server-stamp.js +14 -0
  21. package/lib/private/build/client/reload.d.ts +7 -0
  22. package/lib/private/build/client/reload.js +6 -0
  23. package/lib/private/{hook/build.d.ts → build/hook.d.ts} +2 -2
  24. package/lib/private/build/hook.js +49 -0
  25. package/lib/private/build/index.d.ts +4 -0
  26. package/lib/private/{build.js → build/index.js} +7 -5
  27. package/lib/private/build/server/index.d.ts +3 -0
  28. package/lib/private/build/server/index.js +90 -0
  29. package/lib/private/build/server/plugin/assets.d.ts +4 -0
  30. package/lib/private/build/server/plugin/assets.js +67 -0
  31. package/lib/private/build/server/plugin/config.d.ts +4 -0
  32. package/lib/private/build/server/plugin/config.js +43 -0
  33. package/lib/private/build/server/plugin/database-default.d.ts +4 -0
  34. package/lib/private/build/server/plugin/database-default.js +48 -0
  35. package/lib/private/build/server/plugin/frontend.d.ts +4 -0
  36. package/lib/private/build/server/plugin/frontend.js +21 -0
  37. package/lib/private/build/server/plugin/hot-reload.d.ts +4 -0
  38. package/lib/private/build/server/plugin/hot-reload.js +36 -0
  39. package/lib/private/build/server/plugin/native-addons.d.ts +4 -0
  40. package/lib/private/build/server/plugin/native-addons.js +55 -0
  41. package/lib/private/build/server/plugin/node-imports.d.ts +4 -0
  42. package/lib/private/build/server/plugin/node-imports.js +32 -0
  43. package/lib/private/build/server/plugin/requires.d.ts +4 -0
  44. package/lib/private/build/server/plugin/requires.js +30 -0
  45. package/lib/private/build/server/plugin/roots.d.ts +4 -0
  46. package/lib/private/build/server/plugin/roots.js +18 -0
  47. package/lib/private/build/server/plugin/route.d.ts +4 -0
  48. package/lib/private/build/server/plugin/route.js +56 -0
  49. package/lib/private/build/server/plugin/store-wrap.d.ts +4 -0
  50. package/lib/private/build/server/plugin/store-wrap.js +33 -0
  51. package/lib/private/build/server/plugin/store.d.ts +4 -0
  52. package/lib/private/build/server/plugin/store.js +47 -0
  53. package/lib/private/build/server/plugin/stores.d.ts +4 -0
  54. package/lib/private/build/server/plugin/stores.js +25 -0
  55. package/lib/private/build/server/plugin/view.d.ts +4 -0
  56. package/lib/private/build/server/plugin/view.js +64 -0
  57. package/lib/private/build/server/plugin/views.d.ts +4 -0
  58. package/lib/private/build/server/plugin/views.js +36 -0
  59. package/lib/private/build/server/plugin/virtual-pages.d.ts +4 -0
  60. package/lib/private/build/server/plugin/virtual-pages.js +41 -0
  61. package/lib/private/build/server/plugin/virtual-routes.d.ts +4 -0
  62. package/lib/private/build/server/plugin/virtual-routes.js +46 -0
  63. package/lib/private/build/server/plugin/wasm.d.ts +4 -0
  64. package/lib/private/build/server/plugin/wasm.js +36 -0
  65. package/lib/private/client/Data.d.ts +2 -0
  66. package/lib/private/client/app.js +4 -1
  67. package/lib/private/config/index.d.ts +0 -2
  68. package/lib/private/config/schema.d.ts +4 -6
  69. package/lib/private/config/schema.js +9 -19
  70. package/lib/private/database/Store.d.ts +4 -1
  71. package/lib/private/database/Store.js +8 -2
  72. package/lib/private/database/test.js +8 -8
  73. package/lib/private/frontend/Module.d.ts +4 -3
  74. package/lib/private/frontend/Module.js +47 -50
  75. package/lib/private/frontend/Publish.d.ts +1 -1
  76. package/lib/private/i18n/Module.d.ts +1 -1
  77. package/lib/private/i18n/Module.js +2 -2
  78. package/lib/private/location.d.ts +0 -6
  79. package/lib/private/location.js +0 -12
  80. package/lib/private/module/BuildHook.d.ts +1 -1
  81. package/lib/private/module/NextBuild.d.ts +1 -1
  82. package/lib/private/module/NextServe.d.ts +1 -1
  83. package/lib/private/paths.d.ts +5 -0
  84. package/lib/private/paths.js +30 -0
  85. package/lib/private/reducer.d.ts +2 -2
  86. package/lib/private/request/route.d.ts +1 -1
  87. package/lib/private/request/route.js +6 -8
  88. package/lib/private/response/ResponseFunction.d.ts +1 -1
  89. package/lib/private/response/binary.d.ts +1 -1
  90. package/lib/private/response/json.d.ts +1 -1
  91. package/lib/private/response/sse.d.ts +1 -1
  92. package/lib/private/response/text.d.ts +1 -1
  93. package/lib/private/response/view.d.ts +6 -9
  94. package/lib/private/response/view.js +12 -8
  95. package/lib/private/response.d.ts +1 -1
  96. package/lib/private/route/router.d.ts +3 -2
  97. package/lib/private/route/router.js +5 -4
  98. package/lib/private/{ServeApp.d.ts → serve/App.d.ts} +5 -22
  99. package/lib/private/{ServeApp.js → serve/App.js} +106 -35
  100. package/lib/private/{ServeInit.d.ts → serve/Init.d.ts} +16 -12
  101. package/lib/private/serve/Init.js +2 -0
  102. package/lib/private/{hook/serve.d.ts → serve/hook.d.ts} +2 -2
  103. package/lib/private/{hook/serve.js → serve/hook.js} +1 -1
  104. package/lib/private/serve/index.d.ts +5 -0
  105. package/lib/private/serve/index.js +6 -0
  106. package/lib/private/{builtin/DevModule.d.ts → serve/module/Dev.d.ts} +2 -2
  107. package/lib/private/{builtin/DevModule.js → serve/module/Dev.js} +4 -6
  108. package/lib/private/{builtin/HandleModule.d.ts → serve/module/Handle.d.ts} +2 -2
  109. package/lib/private/{builtin/HandleModule.js → serve/module/Handle.js} +2 -2
  110. package/lib/private/session/SessionModule.d.ts +3 -2
  111. package/lib/private/session/SessionModule.js +47 -24
  112. package/lib/private/session/index.d.ts +11 -8
  113. package/lib/private/session/index.js +5 -3
  114. package/lib/private/session/schema.d.ts +2 -4
  115. package/lib/private/session/schema.js +14 -16
  116. package/lib/private/target/Manager.js +5 -1
  117. package/lib/private/wasm/instantiate.js +2 -2
  118. package/lib/public/BuildApp.d.ts +1 -1
  119. package/lib/public/BuildApp.js +1 -1
  120. package/lib/public/Flags.d.ts +2 -0
  121. package/lib/public/Flags.js +2 -0
  122. package/lib/public/ServeApp.d.ts +1 -1
  123. package/lib/public/ServeApp.js +1 -1
  124. package/lib/public/build.d.ts +1 -1
  125. package/lib/public/build.js +1 -1
  126. package/lib/public/serve.d.ts +1 -1
  127. package/lib/public/serve.js +1 -1
  128. package/package.json +7 -7
  129. package/lib/private/BindingContext.d.ts +0 -3
  130. package/lib/private/BindingContext.js +0 -2
  131. package/lib/private/BuildApp.d.ts +0 -31
  132. package/lib/private/BuildApp.js +0 -130
  133. package/lib/private/Loader.d.ts +0 -17
  134. package/lib/private/Loader.js +0 -47
  135. package/lib/private/ServeInit.js +0 -2
  136. package/lib/private/build.d.ts +0 -4
  137. package/lib/private/config/config/app.d.ts +0 -3
  138. package/lib/private/config/config/app.js +0 -3
  139. package/lib/private/config/config/database/index.d.ts +0 -3
  140. package/lib/private/config/config/database/index.js +0 -3
  141. package/lib/private/config/config/session.d.ts +0 -3
  142. package/lib/private/config/config/session.js +0 -3
  143. package/lib/private/frontend/bundle-server.d.ts +0 -13
  144. package/lib/private/frontend/bundle-server.js +0 -48
  145. package/lib/private/hook/build.js +0 -260
  146. package/lib/private/serve.d.ts +0 -5
  147. package/lib/private/serve.js +0 -8
  148. package/lib/private/session/InMemoryManager.d.ts +0 -9
  149. package/lib/private/session/InMemoryManager.js +0 -23
  150. package/lib/private/session/Manager.d.ts +0 -9
  151. package/lib/private/session/Manager.js +0 -4
  152. package/lib/private/target/web.d.ts +0 -4
  153. package/lib/private/target/web.js +0 -58
  154. package/lib/public/Loader.d.ts +0 -2
  155. package/lib/public/Loader.js +0 -2
  156. package/lib/public/session/Manager.d.ts +0 -2
  157. package/lib/public/session/Manager.js +0 -2
@@ -1,260 +0,0 @@
1
- import fail from "#fail";
2
- import location from "#location";
3
- import log from "#log";
4
- import reducer from "#reducer";
5
- import $router from "#request/router";
6
- import wrap from "#route/wrap";
7
- import s_layout_depth from "#symbol/layout-depth";
8
- import FileRef from "@rcompat/fs/FileRef";
9
- import json from "@rcompat/package/json";
10
- import dedent from "@rcompat/string/dedent";
11
- const dirname = import.meta.dirname;
12
- const pre = async (app) => {
13
- // remove build directory in case exists
14
- await app.path.build.remove();
15
- await app.path.build.create();
16
- await Promise.all(["server", "client", "views"]
17
- .map(directory => app.runpath(directory).create()));
18
- // this has to occur before post, so that layout depth is available for
19
- // compiling root views
20
- // bindings should have been registered during `init`
21
- const router = await $router(app.path.routes, app.extensions);
22
- app.set(s_layout_depth, router.depth("layout"));
23
- const i18n_config_path = app.path.config.join("i18n.ts");
24
- const i18n_config_js_path = app.path.config.join("i18n.js");
25
- // minimal effort: check if i18n.ts exists (heavier effort during serve)
26
- const has_i18n_config = await i18n_config_path.exists()
27
- || await i18n_config_js_path.exists();
28
- app.i18n_active = has_i18n_config;
29
- return app;
30
- };
31
- async function index_database(base) {
32
- // app/config/database does not exist -> use prelayered default
33
- if (!await base.exists())
34
- return "";
35
- const databases = await base.list();
36
- const n = databases.length;
37
- // none in app/config/database -> use prelayered default
38
- if (n === 0)
39
- return "";
40
- const names = databases.map(d => d.name);
41
- // index database file found, will be overwritten in next step -> do nothing
42
- if (names.includes("index.ts") || names.includes("index.js")) {
43
- return ""; // empty string means: don't generate, user provided own
44
- }
45
- // app/config/default.ts -> reexport
46
- if (names.includes("default.ts")) {
47
- return "export { default } from \"./default.js\";";
48
- }
49
- // app/config/default.js -> reexport
50
- if (names.includes("default.js")) {
51
- return "export { default } from \"./default.js\";";
52
- }
53
- // exactly one in app/config/database -> reexport that
54
- if (n === 1) {
55
- const onlyFile = names[0];
56
- const withoutExt = onlyFile.replace(/\.(ts|js)$/, ".js");
57
- return `export { default } from "./${withoutExt}";`;
58
- }
59
- // multiple files, none is index or default -> error
60
- throw fail("multiple database drivers, add index or default.(ts|js); found {0}", names.join(", "));
61
- }
62
- const js_re = /^.*.js$/;
63
- const write_directories = async (build_directory, app) => {
64
- for (const name of app.server_build) {
65
- const d = app.runpath(`${name}s`);
66
- const e = await Promise.all((await FileRef.collect(d, file => js_re.test(file.path)))
67
- .map(async (path) => `${path}`.replace(d.toString(), _ => "")));
68
- const files_js = `
69
- const ${name} = [];
70
- ${e.map(path => path.slice(1, -".js".length)).map((bare, i) => `const ${name}${i} = (await import("${FileRef.webpath(`#${name}/${bare}`)}")).default;
71
- ${name}.push(["${FileRef.webpath(bare)}", ${name}${i}]);`).join("\n")}
72
- export default ${name};`;
73
- await build_directory.join(`${name}s.js`).write(files_js);
74
- }
75
- };
76
- const write_stores = async (build_directory, app) => {
77
- const d2 = app.runpath(location.stores);
78
- const e = await Promise.all((await FileRef.collect(d2, file => js_re.test(file.path)))
79
- .map(async (path) => `${path}`.replace(d2.toString(), _ => "")));
80
- const stores_js = `
81
- const store = [];
82
- ${e.map(path => path.slice(1, -".js".length)).map((bare, i) => `import * as store${i} from "${FileRef.webpath(`#store/${bare}`)}";
83
- store.push(["${FileRef.webpath(bare)}", store${i}]);`).join("\n")}
84
-
85
- export default store;`;
86
- await build_directory.join("stores.js").write(stores_js);
87
- };
88
- const write_views = async (build_directory, app) => {
89
- const d2 = app.runpath(location.views);
90
- const e = await Promise.all((await FileRef.collect(d2, file => js_re.test(file.path)))
91
- .map(async (path) => `${path}`.replace(d2.toString(), _ => "")));
92
- const views_js = `
93
- const view = [];
94
- ${e.map(path => path.slice(1, -".js".length)).map((bare, i) => `import * as view${i} from "${FileRef.webpath(`#view/${bare}`)}";
95
- view.push(["${FileRef.webpath(bare)}", view${i}]);`).join("\n")}
96
-
97
- ${app.roots.map((root, i) => `
98
- import * as root${i} from "${FileRef.webpath(`../server/${root.name}`)}";
99
- view.push(["${root.name.slice(0, -".js".length)}", root${i}]);
100
- `).join("\n")}
101
-
102
- export default view;`;
103
- await build_directory.join("views.js").write(views_js);
104
- };
105
- const write_bootstrap = async (app, mode, i18n_active) => {
106
- const build_start_script = `
107
- import serve from "primate/serve";
108
- const files = {};
109
- ${app.server_build.map(name => `${name}s`).map(name => `import ${name} from "./${app.id}/${name}.js";
110
- files.${name} = ${name};`).join("\n")}
111
- import views from "./${app.id}/views.js";
112
- import stores from "./${app.id}/stores.js";
113
- import target from "./target.js";
114
- import session from "#session";
115
- import config from "#config";
116
- import s_config from "primate/symbol/config";
117
-
118
- ${i18n_active ? `
119
- import t from "#i18n";
120
- const i18n_config = t[s_config];
121
- ` : `
122
- const i18n_config = undefined;
123
- `}
124
-
125
- const app = await serve(import.meta.url, {
126
- ...target,
127
- config,
128
- files,
129
- views,
130
- stores,
131
- mode: "${mode}",
132
- session_config: session[s_config],
133
- i18n_config,
134
- });
135
-
136
- export default app;
137
- `;
138
- await app.path.build.join("serve.js").write(build_start_script);
139
- };
140
- const post = async (app) => {
141
- const defaults = FileRef.join(import.meta.url, "../../defaults");
142
- await app.compile(app.path.routes, "routes", {
143
- loader: (source, file) => {
144
- const path = app.basename(file, app.path.routes);
145
- return wrap(source, path, app.id);
146
- },
147
- });
148
- await app.compile(app.path.stores, "stores", {
149
- resolver: basename => `${basename}.original`, // First pass: save original
150
- });
151
- if (await app.path.stores.exists()) {
152
- const stores = await app.path.stores.collect(({ path }) => app.extensions.some(e => path.endsWith(e)));
153
- for (const file of stores) {
154
- const basename = app.basename(file, app.path.stores);
155
- const wrapper = dedent `
156
- import database from "#database";
157
- import store from "./${basename}.original.js";
158
- import wrap from "primate/database/wrap";
159
- export default wrap("${basename}", store, database);
160
- `;
161
- const target = app.runpath("stores", `${basename}.js`);
162
- await target.write(wrapper);
163
- }
164
- }
165
- const configs = FileRef.join(dirname, "../../private/config/config");
166
- const database_base = app.path.config.join("database");
167
- // prelayer config default
168
- await app.compile(configs, "config", {
169
- loader: async (source, file) => {
170
- const relative = file.debase(configs);
171
- if (relative.path === "/database/index.js") {
172
- const indexContent = await index_database(database_base);
173
- // if empty, user provided own index -> use the compiled source
174
- return indexContent || source;
175
- }
176
- return source;
177
- },
178
- });
179
- await app.compile(app.path.modules, "modules");
180
- await app.compile(app.path.locales, "locales");
181
- await app.compile(app.path.config, "config");
182
- // reusable components
183
- await app.compile(app.path.components, "components");
184
- // view components
185
- await app.compile(app.path.views, "views");
186
- // copy framework pages
187
- await defaults.copy(app.runpath(location.server, location.pages));
188
- // copy pages to build
189
- if (await app.path.pages.exists()) {
190
- await app.path.pages.copy(app.runpath(location.server, location.pages));
191
- }
192
- if (await app.path.static.exists()) {
193
- // copy static files to build/static
194
- await app.path.static.copy(app.runpath(location.static));
195
- }
196
- // publish JavaScript and CSS files
197
- const imports = await FileRef.collect(app.path.static, file => /\.(?:js|ts|css)$/.test(file.path));
198
- await Promise.all(imports.map(async (file) => {
199
- const src = file.debase(app.path.static);
200
- app.build.export(`import "./${location.static}${src}";`);
201
- }));
202
- app.build.export("import \"primate/client/app\";");
203
- app.build.plugin({
204
- name: "@primate/core/frontend",
205
- setup(build) {
206
- build.onResolve({ filter: /#frontends/ }, ({ path }) => {
207
- return { namespace: "frontends", path };
208
- });
209
- build.onLoad({ filter: /#frontends/ }, async () => {
210
- const contents = [...app.frontends.keys()].map(name => `export { default as ${name} } from "@primate/${name}";`).join("\n");
211
- return { contents, resolveDir: app.root.path };
212
- });
213
- },
214
- });
215
- app.build.plugin({
216
- name: "@primate/core/alias",
217
- setup(build) {
218
- build.onResolve({ filter: /#static/ }, args => {
219
- const path = args.path.slice(1);
220
- return { path: app.root.join(path).path };
221
- });
222
- },
223
- });
224
- // start the build
225
- await app.build.start();
226
- // a target needs to create an `assets.js` that exports assets
227
- await app.target.run();
228
- const build_directory = app.path.build.join(app.id);
229
- // TODO: remove after rcompat automatically creates directories
230
- await build_directory.create();
231
- await write_views(build_directory, app);
232
- await write_stores(build_directory, app);
233
- await write_directories(build_directory, app);
234
- await write_bootstrap(app, app.mode, app.i18n_active);
235
- const manifest_data = {
236
- ...await (await json()).json(),
237
- type: "module",
238
- imports: {
239
- "#config": "./config/app.js",
240
- "#config/*": "./config/*.js",
241
- "#database": "./config/database/index.js",
242
- "#database/*": "./config/database/*.js",
243
- "#session": "./config/session.js",
244
- "#i18n": "./config/i18n.js",
245
- "#view/*": "./views/*.js",
246
- "#component/*": "./components/*.js",
247
- "#locale/*": "./locales/*.js",
248
- "#module/*": "./modules/*.js",
249
- "#route/*": "./routes/*.js",
250
- "#store/*": "./stores/*.js",
251
- },
252
- };
253
- // create package.json
254
- await app.path.build.join("package.json").writeJSON(manifest_data);
255
- log.system("build written to {0}", app.path.build);
256
- app.cleanup();
257
- return app;
258
- };
259
- export default async (app) => post(await reducer(app.modules, await pre(app), "build"));
260
- //# sourceMappingURL=build.js.map
@@ -1,5 +0,0 @@
1
- import ServeApp from "#ServeApp";
2
- import type ServeInit from "#ServeInit";
3
- declare const _default: (root: string, options: ServeInit) => Promise<ServeApp>;
4
- export default _default;
5
- //# sourceMappingURL=serve.d.ts.map
@@ -1,8 +0,0 @@
1
- import serve from "#hook/serve";
2
- import ServeApp from "#ServeApp";
3
- export default async (root, options) => {
4
- const app = await new ServeApp(root, options)
5
- .init(options.target);
6
- return serve(app);
7
- };
8
- //# sourceMappingURL=serve.js.map
@@ -1,9 +0,0 @@
1
- import SessionManager from "#session/Manager";
2
- export default class InMemorySessionManager<Data> extends SessionManager<Data> {
3
- #private;
4
- load(id: string): Data | undefined;
5
- create(id: string, data: Data): void;
6
- save(id: string, data: Data): void;
7
- destroy(id: string): void;
8
- }
9
- //# sourceMappingURL=InMemoryManager.d.ts.map
@@ -1,23 +0,0 @@
1
- import SessionManager from "#session/Manager";
2
- import assert from "@rcompat/assert";
3
- export default class InMemorySessionManager extends SessionManager {
4
- // id -> JSON
5
- #sessions = new Map();
6
- load(id) {
7
- const raw = this.#sessions.get(id);
8
- return raw === undefined ? undefined : JSON.parse(raw);
9
- }
10
- create(id, data) {
11
- assert(!this.#sessions.has(id), `session already exists: ${id}`);
12
- this.#sessions.set(id, JSON.stringify(data));
13
- }
14
- save(id, data) {
15
- assert(this.#sessions.has(id), `session not found: ${id}`);
16
- this.#sessions.set(id, JSON.stringify(data));
17
- }
18
- // idempotent
19
- destroy(id) {
20
- this.#sessions.delete(id);
21
- }
22
- }
23
- //# sourceMappingURL=InMemoryManager.js.map
@@ -1,9 +0,0 @@
1
- import type MaybePromise from "@rcompat/type/MaybePromise";
2
- export default abstract class SessionManager<Data> {
3
- init?(): MaybePromise<void>;
4
- abstract load(id: string): MaybePromise<Data | undefined>;
5
- abstract create(id: string, data: Data): MaybePromise<void>;
6
- abstract save(id: string, data: Data): MaybePromise<void>;
7
- abstract destroy(id: string): MaybePromise<void>;
8
- }
9
- //# sourceMappingURL=Manager.d.ts.map
@@ -1,4 +0,0 @@
1
- export default class SessionManager {
2
- init() { }
3
- }
4
- //# sourceMappingURL=Manager.js.map
@@ -1,4 +0,0 @@
1
- import type Target from "#target/Target";
2
- declare const web: Target;
3
- export default web;
4
- //# sourceMappingURL=web.d.ts.map
@@ -1,58 +0,0 @@
1
- import location from "#location";
2
- import FileRef from "@rcompat/fs/FileRef";
3
- const html = /^.*.html$/ui;
4
- const web = {
5
- name: "web",
6
- runner: async (app) => {
7
- const client = app.runpath(location.client);
8
- const client_imports = (await client.collect())
9
- .map((file, i) => {
10
- const type = file.extension === ".css" ? "style" : "js";
11
- const src = `/${file.debase(client).name}`;
12
- const path = `./${file.debase(`${app.path.build}/`)}`;
13
- return {
14
- code: `await load_text(asset${i})`,
15
- path,
16
- src,
17
- type,
18
- };
19
- });
20
- const d = app.runpath(location.server, location.pages);
21
- const pages = await Promise.all((await FileRef.collect(d, file => html.test(file.path)))
22
- .map(async (file) => `${file.debase(d)}`.slice(1)));
23
- const pages_str = pages.map(page => `"${page}": await load_text(import.meta.url,
24
- "${FileRef.webpath(`../${location.server}/${location.pages}/${page}`)}"),`)
25
- .join("\n");
26
- const assets_scripts = `
27
- import Loader from "primate/Loader";
28
- import load_text from "primate/load-text";
29
-
30
- ${client_imports.map(({ path }, i) => `const asset${i} = await load_text(import.meta.url, "../${path}");`)
31
- .join("\n ")}
32
- const assets = [${client_imports.map(($import, i) => `{
33
- src: "${$import.src}",
34
- code: asset${i},
35
- type: "${$import.type}",
36
- inline: false,
37
- }`).join(",\n ")}];
38
-
39
- const pages = {
40
- ${pages_str}
41
- };
42
-
43
- export default {
44
- assets,
45
- loader: new Loader({
46
- pages,
47
- rootfile: import.meta.url,
48
- static_root: "${app.config("http.static.root")}",
49
- }),
50
- target: "web",
51
- };
52
- `;
53
- await app.path.build.join("target.js").write(assets_scripts);
54
- },
55
- target: "web",
56
- };
57
- export default web;
58
- //# sourceMappingURL=web.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#Loader";
2
- //# sourceMappingURL=Loader.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#Loader";
2
- //# sourceMappingURL=Loader.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#session/Manager";
2
- //# sourceMappingURL=Manager.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#session/Manager";
2
- //# sourceMappingURL=Manager.js.map