silgi 0.8.31 → 0.8.33
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 +22 -12
- package/dist/cli/run.mjs +11 -2
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -1413,8 +1413,10 @@ async function scanFiles$1(silgi) {
|
|
|
1413
1413
|
if (createServices.length > 0) {
|
|
1414
1414
|
for (const createService of createServices) {
|
|
1415
1415
|
const { exportName, path } = createService;
|
|
1416
|
+
const randomString = hash(basename(path) + exportName);
|
|
1417
|
+
const _name = `_v${randomString}`;
|
|
1416
1418
|
silgi.hook("prepare:core.ts", (options) => {
|
|
1417
|
-
options.services.push(
|
|
1419
|
+
options.services.push(_name);
|
|
1418
1420
|
});
|
|
1419
1421
|
silgi.hook("prepare:core.ts", (options) => {
|
|
1420
1422
|
options.importItems[path] ??= {
|
|
@@ -1422,7 +1424,7 @@ async function scanFiles$1(silgi) {
|
|
|
1422
1424
|
from: relativeWithDot(silgi.options.silgi.serverDir, path)
|
|
1423
1425
|
};
|
|
1424
1426
|
options.importItems[path].import.push({
|
|
1425
|
-
name: exportName
|
|
1427
|
+
name: `${exportName} as ${_name}`
|
|
1426
1428
|
});
|
|
1427
1429
|
});
|
|
1428
1430
|
}
|
|
@@ -1431,8 +1433,10 @@ async function scanFiles$1(silgi) {
|
|
|
1431
1433
|
if (createSchemas.length > 0) {
|
|
1432
1434
|
for (const createSchema of createSchemas) {
|
|
1433
1435
|
const { exportName, path } = createSchema;
|
|
1436
|
+
const randomString = hash(basename(path) + exportName);
|
|
1437
|
+
const _name = `_v${randomString}`;
|
|
1434
1438
|
silgi.hook("prepare:core.ts", (options) => {
|
|
1435
|
-
options.schemas.push(
|
|
1439
|
+
options.schemas.push(_name);
|
|
1436
1440
|
});
|
|
1437
1441
|
silgi.hook("prepare:core.ts", (options) => {
|
|
1438
1442
|
options.importItems[path] ??= {
|
|
@@ -1440,7 +1444,7 @@ async function scanFiles$1(silgi) {
|
|
|
1440
1444
|
from: relativeWithDot(silgi.options.silgi.serverDir, path)
|
|
1441
1445
|
};
|
|
1442
1446
|
options.importItems[path].import.push({
|
|
1443
|
-
name: exportName
|
|
1447
|
+
name: `${exportName} as ${_name}`
|
|
1444
1448
|
});
|
|
1445
1449
|
});
|
|
1446
1450
|
}
|
|
@@ -1449,8 +1453,10 @@ async function scanFiles$1(silgi) {
|
|
|
1449
1453
|
if (createShareds.length > 0) {
|
|
1450
1454
|
for (const createShared of createShareds) {
|
|
1451
1455
|
const { exportName, path } = createShared;
|
|
1456
|
+
const randomString = hash(basename(path) + exportName);
|
|
1457
|
+
const _name = `_v${randomString}`;
|
|
1452
1458
|
silgi.hook("prepare:core.ts", (options) => {
|
|
1453
|
-
options.shareds.push(
|
|
1459
|
+
options.shareds.push(_name);
|
|
1454
1460
|
});
|
|
1455
1461
|
silgi.hook("prepare:core.ts", (options) => {
|
|
1456
1462
|
options.importItems[path] ??= {
|
|
@@ -1459,7 +1465,7 @@ async function scanFiles$1(silgi) {
|
|
|
1459
1465
|
from: relativeWithDot(silgi.options.silgi.serverDir, path)
|
|
1460
1466
|
};
|
|
1461
1467
|
options.importItems[path].import.push({
|
|
1462
|
-
name: exportName
|
|
1468
|
+
name: `${exportName} as ${_name}`
|
|
1463
1469
|
});
|
|
1464
1470
|
});
|
|
1465
1471
|
}
|
|
@@ -1468,10 +1474,12 @@ async function scanFiles$1(silgi) {
|
|
|
1468
1474
|
if (sharedsTypes.length > 0) {
|
|
1469
1475
|
for (const sharedType of sharedsTypes) {
|
|
1470
1476
|
const { exportName, path } = sharedType;
|
|
1477
|
+
const randomString = hash(basename(path) + exportName);
|
|
1478
|
+
const _name = `_v${randomString}`;
|
|
1471
1479
|
silgi.hook("prepare:schema.ts", (options) => {
|
|
1472
1480
|
options.shareds.push({
|
|
1473
|
-
key:
|
|
1474
|
-
value:
|
|
1481
|
+
key: _name,
|
|
1482
|
+
value: _name
|
|
1475
1483
|
});
|
|
1476
1484
|
});
|
|
1477
1485
|
silgi.hook("prepare:schema.ts", (options) => {
|
|
@@ -1480,7 +1488,7 @@ async function scanFiles$1(silgi) {
|
|
|
1480
1488
|
from: path
|
|
1481
1489
|
};
|
|
1482
1490
|
options.importItems[path].import.push({
|
|
1483
|
-
name: exportName
|
|
1491
|
+
name: `${exportName} as ${_name}`,
|
|
1484
1492
|
type: true
|
|
1485
1493
|
});
|
|
1486
1494
|
});
|
|
@@ -1490,10 +1498,12 @@ async function scanFiles$1(silgi) {
|
|
|
1490
1498
|
if (contextTypes.length > 0) {
|
|
1491
1499
|
for (const contextType of contextTypes) {
|
|
1492
1500
|
const { exportName, path } = contextType;
|
|
1501
|
+
const randomString = hash(basename(path) + exportName);
|
|
1502
|
+
const _name = `_v${randomString}`;
|
|
1493
1503
|
silgi.hook("prepare:schema.ts", (options) => {
|
|
1494
1504
|
options.contexts.push({
|
|
1495
|
-
key:
|
|
1496
|
-
value:
|
|
1505
|
+
key: _name,
|
|
1506
|
+
value: _name
|
|
1497
1507
|
});
|
|
1498
1508
|
});
|
|
1499
1509
|
silgi.hook("prepare:schema.ts", (options) => {
|
|
@@ -1502,7 +1512,7 @@ async function scanFiles$1(silgi) {
|
|
|
1502
1512
|
from: path
|
|
1503
1513
|
};
|
|
1504
1514
|
options.importItems[path].import.push({
|
|
1505
|
-
name: exportName
|
|
1515
|
+
name: `${exportName} as ${_name}`,
|
|
1506
1516
|
type: true
|
|
1507
1517
|
});
|
|
1508
1518
|
});
|
package/dist/cli/run.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { existsSync, promises, readFileSync } from 'node:fs';
|
|
|
3
3
|
import * as p from '@clack/prompts';
|
|
4
4
|
import { defineCommand } from 'citty';
|
|
5
5
|
import { consola } from 'consola';
|
|
6
|
+
import { createJiti } from 'dev-jiti';
|
|
6
7
|
import { resolve } from 'pathe';
|
|
7
8
|
import color from 'picocolors';
|
|
8
9
|
import { version } from 'silgi/meta';
|
|
@@ -162,8 +163,16 @@ const run = defineCommand({
|
|
|
162
163
|
execSync(script.handler, { stdio: "inherit" });
|
|
163
164
|
}
|
|
164
165
|
if (script.type === "function") {
|
|
165
|
-
const
|
|
166
|
-
|
|
166
|
+
const jiti = createJiti(import.meta.url, {
|
|
167
|
+
moduleCache: false,
|
|
168
|
+
fsCache: false,
|
|
169
|
+
alias: silgiConfig.alias
|
|
170
|
+
});
|
|
171
|
+
await jiti.evalModule(`(${script.handler})`, {
|
|
172
|
+
filename: "path/to/file.ts",
|
|
173
|
+
async: true,
|
|
174
|
+
conditions: silgiConfig.conditions
|
|
175
|
+
});
|
|
167
176
|
}
|
|
168
177
|
}
|
|
169
178
|
});
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED