@dtwo/schema 3.1.0 → 3.1.2
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/LICENSE +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +21 -9
- package/package.json +8 -8
package/LICENSE
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -611,8 +611,9 @@ interface ModuleDefinition<T extends ModuleOptions = ModuleOptions> {
|
|
|
611
611
|
setup?: (this: void, resolvedOptions: T, dtwo: Dtwo) => void | Promise<void>;
|
|
612
612
|
}
|
|
613
613
|
/** Dtwo modules are always a simple function. */
|
|
614
|
+
type Awaitable<T> = T | Promise<T>;
|
|
614
615
|
interface DtwoModule<T extends ModuleOptions = ModuleOptions> {
|
|
615
|
-
(this: void, inlineOptions: T, dtwo: Dtwo): void |
|
|
616
|
+
(this: void, inlineOptions: T, dtwo: Dtwo): Awaitable<void | false>;
|
|
616
617
|
getOptions?: (inlineOptions?: T, dtwo?: Dtwo) => Promise<T>;
|
|
617
618
|
getMeta?: () => Promise<ModuleMeta>;
|
|
618
619
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineUntypedSchema } from 'untyped';
|
|
2
|
-
import defu from 'defu';
|
|
2
|
+
import { defu } from 'defu';
|
|
3
3
|
import { join, resolve } from 'pathe';
|
|
4
4
|
import { isDevelopment, isDebug } from 'std-env';
|
|
5
5
|
import { findWorkspaceDir } from 'pkg-types';
|
|
@@ -757,14 +757,17 @@ const common = defineUntypedSchema({
|
|
|
757
757
|
* @type {typeof import('../src/types/config').RuntimeConfig}
|
|
758
758
|
*/
|
|
759
759
|
runtimeConfig: {
|
|
760
|
-
$resolve: async (val, get) =>
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
760
|
+
$resolve: async (val, get) => {
|
|
761
|
+
provideFallbackValues(val);
|
|
762
|
+
return defu(val, {
|
|
763
|
+
public: {},
|
|
764
|
+
app: {
|
|
765
|
+
baseURL: (await get("app")).baseURL,
|
|
766
|
+
buildAssetsDir: (await get("app")).buildAssetsDir,
|
|
767
|
+
cdnURL: (await get("app")).cdnURL
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
}
|
|
768
771
|
},
|
|
769
772
|
/**
|
|
770
773
|
* Additional app configuration
|
|
@@ -777,6 +780,15 @@ const common = defineUntypedSchema({
|
|
|
777
780
|
appConfig: {},
|
|
778
781
|
$schema: {}
|
|
779
782
|
});
|
|
783
|
+
function provideFallbackValues(obj) {
|
|
784
|
+
for (const key in obj) {
|
|
785
|
+
if (typeof obj[key] === "undefined" || obj[key] === null) {
|
|
786
|
+
obj[key] = "";
|
|
787
|
+
} else if (typeof obj[key] === "object") {
|
|
788
|
+
provideFallbackValues(obj[key]);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
780
792
|
|
|
781
793
|
const dev = defineUntypedSchema({
|
|
782
794
|
devServer: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dtwo/schema",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"repository": "d2js/dtwo",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,25 +13,25 @@
|
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/lodash.template": "4.5.1",
|
|
15
15
|
"@types/semver": "7.3.13",
|
|
16
|
-
"@kdhead/schema": "1.0.
|
|
16
|
+
"@kdhead/schema": "1.0.20",
|
|
17
17
|
"@witejs/plugin-kdu": "4.0.0",
|
|
18
|
-
"holepack": "2.
|
|
18
|
+
"holepack": "2.1.1",
|
|
19
19
|
"kdu-router": "4.1.6",
|
|
20
20
|
"unbuild": "1.1.1",
|
|
21
|
-
"wite": "4.
|
|
21
|
+
"wite": "4.2.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"c12": "1.1.0",
|
|
25
25
|
"create-require": "1.1.1",
|
|
26
|
-
"defu": "6.1.
|
|
26
|
+
"defu": "6.1.2",
|
|
27
27
|
"hookable": "5.4.2",
|
|
28
28
|
"jiti": "1.16.2",
|
|
29
|
-
"kdimport": "2.0
|
|
30
|
-
"pathe": "1.
|
|
29
|
+
"kdimport": "2.1.0",
|
|
30
|
+
"pathe": "1.1.0",
|
|
31
31
|
"pkg-types": "1.0.1",
|
|
32
32
|
"postcss-import-resolver": "2.0.0",
|
|
33
33
|
"scule": "1.0.0",
|
|
34
|
-
"std-env": "3.3.
|
|
34
|
+
"std-env": "3.3.2",
|
|
35
35
|
"ufo": "1.0.1",
|
|
36
36
|
"untyped": "1.2.2"
|
|
37
37
|
},
|