silgi 0.7.19 → 0.7.21
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/_chunks/index.mjs +1 -1
- package/dist/cli/prepare.mjs +6 -6
- package/dist/kit/index.mjs +3 -1
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -1457,7 +1457,10 @@ const logger = useLogger("silgi");
|
|
|
1457
1457
|
async function generateApp(app, options = {}) {
|
|
1458
1458
|
app.templates = Object.values(defaultTemplates).concat(app.options.build.templates);
|
|
1459
1459
|
await app.callHook("app:templates", app);
|
|
1460
|
-
app.templates = app.templates.map((tmpl) =>
|
|
1460
|
+
app.templates = app.templates.map((tmpl) => {
|
|
1461
|
+
const dir = tmpl.where === ".silgi" ? app.options.build.dir : tmpl.where === "server" ? app.options.silgi.serverDir : tmpl.where === "client" ? app.options.silgi.clientDir : app.options.silgi.vfsDir;
|
|
1462
|
+
return normalizeTemplate(tmpl, dir);
|
|
1463
|
+
});
|
|
1461
1464
|
const filteredTemplates = {
|
|
1462
1465
|
pre: [],
|
|
1463
1466
|
post: []
|
|
@@ -1471,11 +1474,11 @@ async function generateApp(app, options = {}) {
|
|
|
1471
1474
|
}
|
|
1472
1475
|
const templateContext = { app };
|
|
1473
1476
|
const writes = [];
|
|
1474
|
-
const indexImports = [];
|
|
1475
1477
|
const dirs = /* @__PURE__ */ new Set();
|
|
1476
1478
|
const changedTemplates = [];
|
|
1477
1479
|
async function processTemplate(template) {
|
|
1478
|
-
const
|
|
1480
|
+
const dir = template.where === ".silgi" ? app.options.build.dir : template.where === "server" ? app.options.silgi.serverDir : template.where === "client" ? app.options.silgi.clientDir : app.options.silgi.vfsDir;
|
|
1481
|
+
const fullPath = template.dst || resolve(dir, template.filename);
|
|
1479
1482
|
const start = performance.now();
|
|
1480
1483
|
const contents = await compileTemplate(template, templateContext).catch((e) => {
|
|
1481
1484
|
logger.error(`Could not compile template \`${template.filename}\`.`);
|
|
@@ -1493,9 +1496,6 @@ async function generateApp(app, options = {}) {
|
|
|
1493
1496
|
}
|
|
1494
1497
|
if (template.modified && template.write) {
|
|
1495
1498
|
dirs.add(dirname(fullPath));
|
|
1496
|
-
if (!fullPath.endsWith(".d.ts")) {
|
|
1497
|
-
indexImports.push(relativeWithDot(app.options.silgi.serverDir, fullPath));
|
|
1498
|
-
}
|
|
1499
1499
|
writes.push(() => writeFileSync(fullPath, contents, "utf8"));
|
|
1500
1500
|
}
|
|
1501
1501
|
}
|
package/dist/kit/index.mjs
CHANGED
|
@@ -291,7 +291,9 @@ function normalizeTemplate(template, buildDir) {
|
|
|
291
291
|
template.write = true;
|
|
292
292
|
}
|
|
293
293
|
if (!template.dst) {
|
|
294
|
-
|
|
294
|
+
const silgi = useSilgiCLI();
|
|
295
|
+
const dir = template.where === ".silgi" ? silgi.options.build.dir : template.where === "server" ? silgi.options.silgi.serverDir : template.where === "client" ? silgi.options.silgi.clientDir : silgi.options.silgi.serverDir;
|
|
296
|
+
template.dst = resolve(buildDir ?? dir, template.filename);
|
|
295
297
|
}
|
|
296
298
|
return template;
|
|
297
299
|
}
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
package/dist/types/index.d.mts
CHANGED
|
@@ -199,6 +199,7 @@ interface SilgiTemplate<Options = TemplateDefaultOptions> {
|
|
|
199
199
|
/** The resolved path to the source file to be template */
|
|
200
200
|
src?: string;
|
|
201
201
|
/** Provided compile option instead of src */
|
|
202
|
+
where?: 'server' | 'client' | '.silgi';
|
|
202
203
|
getContents?: (data: {
|
|
203
204
|
app: SilgiCLI;
|
|
204
205
|
options: Options;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -199,6 +199,7 @@ interface SilgiTemplate<Options = TemplateDefaultOptions> {
|
|
|
199
199
|
/** The resolved path to the source file to be template */
|
|
200
200
|
src?: string;
|
|
201
201
|
/** Provided compile option instead of src */
|
|
202
|
+
where?: 'server' | 'client' | '.silgi';
|
|
202
203
|
getContents?: (data: {
|
|
203
204
|
app: SilgiCLI;
|
|
204
205
|
options: Options;
|