clarusjs 0.19.0 → 0.19.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.
- package/dist/vite/plugin.js +28 -12
- package/package.json +1 -1
package/dist/vite/plugin.js
CHANGED
|
@@ -196,7 +196,14 @@ const renderEntry = (name) => `render/${name}`;
|
|
|
196
196
|
const CLIENT_OUT = 'dist/client';
|
|
197
197
|
const CHUNK_TOKEN = '__CLARUS_CHUNK__';
|
|
198
198
|
const SERVER_OUT = 'dist/server';
|
|
199
|
-
const
|
|
199
|
+
const sourceName = (root, file) => {
|
|
200
|
+
let path = relative(root, file).split(sep).join('/');
|
|
201
|
+
const pkg = path.lastIndexOf('node_modules/');
|
|
202
|
+
if (pkg !== -1)
|
|
203
|
+
path = '_pkg/' + path.slice(pkg + 'node_modules/'.length);
|
|
204
|
+
return path.replace(/^(\.\.\/)+/, (ups) => '_/'.repeat(ups.length / 3)).replace(/(^|\/)\./g, '$1_');
|
|
205
|
+
};
|
|
206
|
+
const entryName = (root, file) => sourceName(root, file).replace(/\.[^./]+$/, '');
|
|
200
207
|
function clientPages(appRoot, modes, files) {
|
|
201
208
|
const pages = new Map();
|
|
202
209
|
for (const file of files.pages(appRoot)) {
|
|
@@ -335,26 +342,35 @@ export default function clarusjs(options = {}) {
|
|
|
335
342
|
throw new Error(`clarusjs: relative base "${userConfig.base}" is not supported; use an absolute base such as "/" or "/docs/"`);
|
|
336
343
|
}
|
|
337
344
|
const appRoot = resolve(userConfig.root ?? process.cwd());
|
|
338
|
-
const input =
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
if (
|
|
342
|
-
|
|
343
|
-
|
|
345
|
+
const input = Object.create(null);
|
|
346
|
+
const add = (name, file) => {
|
|
347
|
+
const taken = input[name];
|
|
348
|
+
if (taken !== undefined && taken !== file) {
|
|
349
|
+
const show = (f) => relative(appRoot, f.replace(/\?render$/, '')).split(sep).join('/');
|
|
350
|
+
throw new Error(`clarusjs: ${show(taken)} and ${show(file)} would be built under the same name "${name}" (a folder starting with a dot is named with _, a package's files after the package): rename one, or use one version of the package`);
|
|
351
|
+
}
|
|
352
|
+
input[name] = file;
|
|
353
|
+
};
|
|
354
|
+
add(LOADER_ENTRY, here('../runtime/loader'));
|
|
344
355
|
const client = clientPages(appRoot, modes, files);
|
|
345
356
|
if (client.size)
|
|
346
|
-
|
|
357
|
+
add(ROUTER_ENTRY, here('../runtime/router'));
|
|
347
358
|
if (options.fragments)
|
|
348
|
-
|
|
359
|
+
add(NAV_ENTRY, here('../runtime/fragments'));
|
|
349
360
|
if (writeStyles(appRoot, files))
|
|
350
|
-
|
|
361
|
+
add(STYLES_ENTRY, resolve(appRoot, STYLES_FILE));
|
|
362
|
+
const components = files.components(appRoot);
|
|
363
|
+
for (const file of components) {
|
|
364
|
+
if (compile(files.read(file, appRoot), { file, target: 'client', icon: iconsFor(file), layouts: files.layouts(file, appRoot), components: files.names(appRoot) }).stateful)
|
|
365
|
+
add(entryName(appRoot, file), file);
|
|
366
|
+
}
|
|
351
367
|
for (const sheet of new Set([...pageGraph(appRoot, files, aliases).values()].flatMap((p) => p.css))) {
|
|
352
368
|
if (!existsSync(sheet))
|
|
353
369
|
throw new Error(`clarusjs: imported stylesheet not found: ${relative(appRoot, sheet)}`);
|
|
354
|
-
|
|
370
|
+
add(`css/${sourceName(appRoot, sheet).replace(/\.css$/, '')}`, sheet);
|
|
355
371
|
}
|
|
356
372
|
for (const file of client.values())
|
|
357
|
-
|
|
373
|
+
add(renderEntry(entryName(appRoot, file)), `${file}?render`);
|
|
358
374
|
config.builder = {};
|
|
359
375
|
config.environments = {
|
|
360
376
|
client: { build: { outDir: CLIENT_OUT, manifest: true, rolldownOptions: { input, preserveEntrySignatures: 'exports-only' } } },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clarusjs",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Clear, compiled views: templates compiled to server HTML, with JavaScript only for interactive islands. SSR, SSG and CSR from one component model, built on Vite.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|