silgi 0.9.30 → 0.9.31
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 +2 -1
- package/dist/core/index.mjs +7 -3
- package/dist/kit/index.mjs +3 -3
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/presets/_all.gen.d.ts +1 -1
- package/dist/presets/_all.gen.mjs +2 -0
- package/dist/presets/npmPackage/preset.d.ts +2 -0
- package/dist/presets/npmPackage/preset.mjs +20 -0
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -147,7 +147,8 @@ async function readCoreFile(silgi) {
|
|
|
147
147
|
});
|
|
148
148
|
try {
|
|
149
149
|
if (silgi.options.commandType === "prepare") {
|
|
150
|
-
|
|
150
|
+
globalThis.$silgiSharedRuntimeConfig = silgi.options.runtimeConfig;
|
|
151
|
+
injectedResult.code = `globalThis.$silgiSharedRuntimeConfig = ${JSON.stringify(silgi.options.runtimeConfig)};
|
|
151
152
|
${injectedResult.code}`;
|
|
152
153
|
injectedResult.code = injectedResult.code.replace(/runtimeConfig: \{\}/, `runtimeConfig: ${JSON.stringify(silgi.options.runtimeConfig)}`);
|
|
153
154
|
}
|
package/dist/core/index.mjs
CHANGED
|
@@ -661,14 +661,18 @@ async function cacheExecute(input, operation, handler, event) {
|
|
|
661
661
|
};
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
-
function merge(items, maxLevel = 4, currentLevel =
|
|
664
|
+
function merge(items, maxLevel = 4, currentLevel = 1) {
|
|
665
665
|
const arrayItems = Array.isArray(items) ? items : [items];
|
|
666
666
|
return arrayItems.reduce((acc, item) => {
|
|
667
|
+
if (!item)
|
|
668
|
+
return acc;
|
|
667
669
|
Object.keys(item).forEach((key) => {
|
|
668
670
|
if (typeof item[key] === "object" && item[key] !== null && currentLevel < maxLevel) {
|
|
669
|
-
acc[key]
|
|
671
|
+
if (!acc[key] || typeof acc[key] !== "object") {
|
|
672
|
+
acc[key] = {};
|
|
673
|
+
}
|
|
670
674
|
acc[key] = merge([acc[key], item[key]], maxLevel, currentLevel + 1);
|
|
671
|
-
} else {
|
|
675
|
+
} else if (acc[key] === void 0) {
|
|
672
676
|
acc[key] = item[key];
|
|
673
677
|
}
|
|
674
678
|
});
|
package/dist/kit/index.mjs
CHANGED
|
@@ -270,9 +270,9 @@ const _sharedRuntimeConfig = _deepFreeze(
|
|
|
270
270
|
function useSilgiRuntimeConfig(event) {
|
|
271
271
|
const silgi = tryUseSilgi();
|
|
272
272
|
if (!silgi) {
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
275
|
-
return
|
|
273
|
+
const globalRuntimeConfig = globalThis.$silgiSharedRuntimeConfig;
|
|
274
|
+
if (globalRuntimeConfig && !event) {
|
|
275
|
+
return globalRuntimeConfig;
|
|
276
276
|
}
|
|
277
277
|
if (!event) {
|
|
278
278
|
return _sharedRuntimeConfig;
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: readonly [any, any, any, any];
|
|
1
|
+
declare const _default: readonly [any, any, any, any, any];
|
|
2
2
|
export default _default;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _h3 from "./h3/preset.mjs";
|
|
2
2
|
import _nitro from "./nitro/preset.mjs";
|
|
3
|
+
import _npmPackage from "./npmPackage/preset.mjs";
|
|
3
4
|
import _npmpackage from "./npmpackage/preset.mjs";
|
|
4
5
|
import _nuxt from "./nuxt/preset.mjs";
|
|
5
6
|
export default [
|
|
6
7
|
..._h3,
|
|
7
8
|
..._nitro,
|
|
9
|
+
..._npmPackage,
|
|
8
10
|
..._npmpackage,
|
|
9
11
|
..._nuxt
|
|
10
12
|
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineSilgiPreset } from "silgi/kit";
|
|
2
|
+
const npmPackage = defineSilgiPreset(
|
|
3
|
+
{
|
|
4
|
+
output: {
|
|
5
|
+
dir: "{{ rootDir }}/.output",
|
|
6
|
+
publicDir: "{{ output.dir }}/public"
|
|
7
|
+
},
|
|
8
|
+
serverDir: "{{ rootDir }}/src",
|
|
9
|
+
silgi: {
|
|
10
|
+
serverDir: "{{ serverDir }}/silgi"
|
|
11
|
+
},
|
|
12
|
+
modules: ["./src"]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "npm-package",
|
|
16
|
+
compatibilityDate: "2025-02-04",
|
|
17
|
+
url: import.meta.url
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
export default [npmPackage];
|