@nuxt/bridge-schema-edge 0.0.0 → 3.0.0-27833237.ddd8ecc

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/index.mjs ADDED
@@ -0,0 +1,545 @@
1
+ import { existsSync, readdirSync } from 'node:fs';
2
+ import { defineUntypedSchema } from 'untyped';
3
+ import { resolve, join } from 'pathe';
4
+ import defu from 'defu';
5
+ import { isCI, isTest } from 'std-env';
6
+ import { withTrailingSlash, normalizeURL, joinURL } from 'ufo';
7
+ import createRequire from 'create-require';
8
+ import { pascalCase } from 'scule';
9
+ import jiti from 'jiti';
10
+
11
+ const app = defineUntypedSchema({
12
+ vue: {
13
+ config: {
14
+ silent: {
15
+ $resolve: async (val, get) => val ?? !await get("dev")
16
+ },
17
+ performance: {
18
+ $resolve: async (val, get) => val ?? await get("dev")
19
+ }
20
+ }
21
+ },
22
+ app: {
23
+ assetsPath: {
24
+ $resolve: async (val, get) => val ?? await get("buildAssetsDir")
25
+ }
26
+ },
27
+ appTemplatePath: {
28
+ $resolve: async (val, get) => {
29
+ if (val) {
30
+ return resolve(await get("srcDir"), val);
31
+ }
32
+ if (existsSync(join(await get("srcDir"), "app.html"))) {
33
+ return join(await get("srcDir"), "app.html");
34
+ }
35
+ return resolve(await get("buildDir"), "views/app.template.html");
36
+ }
37
+ },
38
+ store: {
39
+ $resolve: async (val, get) => val !== false && existsSync(join(await get("srcDir"), await get("dir.store"))) && readdirSync(join(await get("srcDir"), await get("dir.store"))).find((filename) => filename !== "README.md" && filename[0] !== ".")
40
+ },
41
+ vueMeta: null,
42
+ head: {
43
+ meta: [],
44
+ link: [],
45
+ style: [],
46
+ script: []
47
+ },
48
+ meta: {
49
+ meta: [],
50
+ link: [],
51
+ style: [],
52
+ script: []
53
+ },
54
+ fetch: {
55
+ server: true,
56
+ client: true
57
+ },
58
+ extendPlugins: null,
59
+ layouts: {},
60
+ ErrorPage: null,
61
+ loading: {
62
+ color: "black",
63
+ failedColor: "red",
64
+ height: "2px",
65
+ throttle: 200,
66
+ duration: 5e3,
67
+ continuous: false,
68
+ rtl: false,
69
+ css: true
70
+ },
71
+ loadingIndicator: {
72
+ $resolve: async (val, get) => {
73
+ val = typeof val === "string" ? { name: val } : val;
74
+ return defu(val, {
75
+ name: "default",
76
+ color: await get("loading.color") || "#D3D3D3",
77
+ color2: "#F5F5F5",
78
+ background: await get("manifest") && await get("manifest.theme_color") || "white",
79
+ dev: await get("dev"),
80
+ loading: await get("messages.loading")
81
+ });
82
+ }
83
+ },
84
+ pageTransition: {
85
+ $resolve: async (val, get) => {
86
+ val = typeof val === "string" ? { name: val } : val;
87
+ return defu(val, {
88
+ name: "page",
89
+ mode: "out-in",
90
+ appear: await get("render.ssr") === false || Boolean(val),
91
+ appearClass: "appear",
92
+ appearActiveClass: "appear-active",
93
+ appearToClass: "appear-to"
94
+ });
95
+ }
96
+ },
97
+ layoutTransition: {
98
+ $resolve: (val) => {
99
+ val = typeof val === "string" ? { name: val } : val;
100
+ return defu(val, {
101
+ name: "layout",
102
+ mode: "out-in"
103
+ });
104
+ }
105
+ },
106
+ features: {
107
+ store: true,
108
+ layouts: true,
109
+ meta: true,
110
+ middleware: true,
111
+ transitions: true,
112
+ deprecations: true,
113
+ validate: true,
114
+ useAsyncData: true,
115
+ fetch: true,
116
+ clientOnline: true,
117
+ clientPrefetch: true,
118
+ componentAliases: true,
119
+ componentClientOnly: true
120
+ }
121
+ });
122
+
123
+ const build = defineUntypedSchema({
124
+ build: {
125
+ quiet: Boolean(isCI || isTest),
126
+ analyze: {
127
+ $resolve: async (val, get) => {
128
+ if (val !== true) {
129
+ return val ?? false;
130
+ }
131
+ const rootDir = await get("rootDir");
132
+ return {
133
+ template: "treemap",
134
+ projectRoot: rootDir,
135
+ filename: join(rootDir, ".nuxt/stats", "{name}.html")
136
+ };
137
+ }
138
+ },
139
+ profile: process.argv.includes("--profile"),
140
+ extractCSS: false,
141
+ cssSourceMap: {
142
+ $resolve: async (val, get) => val ?? (await get("sourcemap.client") || await get("sourcemap.server")) ?? await get("dev")
143
+ },
144
+ ssr: void 0,
145
+ parallel: {
146
+ $resolve: async (val, get) => await get("build.extractCSS") ? false : Boolean(val)
147
+ },
148
+ cache: false,
149
+ standalone: false,
150
+ publicPath: {
151
+ $resolve: async (val, get) => val ? withTrailingSlash(normalizeURL(val)) : await get("app").buildAssetsDir
152
+ },
153
+ serverURLPolyfill: "url",
154
+ filenames: {
155
+ app: ({ isDev, isModern }) => isDev ? `[name]${isModern ? ".modern" : ""}.js` : `[contenthash:7]${isModern ? ".modern" : ""}.js`,
156
+ chunk: ({ isDev, isModern }) => isDev ? `[name]${isModern ? ".modern" : ""}.js` : `[contenthash:7]${isModern ? ".modern" : ""}.js`,
157
+ css: ({ isDev }) => isDev ? "[name].css" : "css/[contenthash:7].css",
158
+ img: ({ isDev }) => isDev ? "[path][name].[ext]" : "img/[name].[contenthash:7].[ext]",
159
+ font: ({ isDev }) => isDev ? "[path][name].[ext]" : "fonts/[name].[contenthash:7].[ext]",
160
+ video: ({ isDev }) => isDev ? "[path][name].[ext]" : "videos/[name].[contenthash:7].[ext]"
161
+ },
162
+ loaders: {
163
+ $resolve: async (val, get) => {
164
+ const styleLoaders = [
165
+ "css",
166
+ "cssModules",
167
+ "less",
168
+ "sass",
169
+ "scss",
170
+ "stylus",
171
+ "vueStyle"
172
+ ];
173
+ for (const name of styleLoaders) {
174
+ const loader = val[name];
175
+ if (loader && loader.sourcemap === void 0) {
176
+ loader.sourcemap = Boolean(await get("build.cssSourceMap"));
177
+ }
178
+ }
179
+ return val;
180
+ },
181
+ file: { esModule: false },
182
+ fontUrl: { esModule: false, limit: 1e3 },
183
+ imgUrl: { esModule: false, limit: 1e3 },
184
+ pugPlain: {},
185
+ vue: {
186
+ productionMode: { $resolve: async (val, get) => val ?? !await get("dev") },
187
+ transformAssetUrls: {
188
+ video: "src",
189
+ source: "src",
190
+ object: "src",
191
+ embed: "src"
192
+ },
193
+ compilerOptions: { $resolve: async (val, get) => val ?? await get("vue.compilerOptions") }
194
+ },
195
+ css: {
196
+ importLoaders: 0,
197
+ esModule: false
198
+ },
199
+ cssModules: {
200
+ importLoaders: 0,
201
+ esModule: false,
202
+ modules: {
203
+ localIdentName: "[local]_[hash:base64:5]"
204
+ }
205
+ },
206
+ less: {},
207
+ sass: {
208
+ sassOptions: {
209
+ indentedSyntax: true
210
+ }
211
+ },
212
+ scss: {},
213
+ stylus: {},
214
+ vueStyle: {}
215
+ },
216
+ styleResources: {},
217
+ plugins: [],
218
+ terser: {},
219
+ hardSource: false,
220
+ aggressiveCodeRemoval: false,
221
+ optimizeCSS: {
222
+ $resolve: async (val, get) => val ?? (await get("build.extractCSS") ? {} : false)
223
+ },
224
+ optimization: {
225
+ runtimeChunk: "single",
226
+ minimize: {
227
+ $resolve: async (val, get) => val ?? !await get("dev")
228
+ },
229
+ minimizer: void 0,
230
+ splitChunks: {
231
+ chunks: "all",
232
+ automaticNameDelimiter: "/",
233
+ cacheGroups: {}
234
+ }
235
+ },
236
+ splitChunks: {
237
+ layouts: false,
238
+ pages: true,
239
+ commons: true
240
+ },
241
+ corejs: "auto",
242
+ babel: {
243
+ configFile: false,
244
+ babelrc: false,
245
+ plugins: [],
246
+ presets: {},
247
+ cacheDirectory: {
248
+ $resolve: async (val, get) => val ?? await get("dev")
249
+ }
250
+ },
251
+ postcss: {
252
+ execute: void 0,
253
+ postcssOptions: {
254
+ $resolve: async (val, get) => {
255
+ const postcssOptions = await get("postcss") || {};
256
+ Object.assign(postcssOptions, defu(postcssOptions, val));
257
+ return postcssOptions;
258
+ }
259
+ },
260
+ sourcemap: void 0,
261
+ implementation: void 0,
262
+ order: ""
263
+ },
264
+ html: {
265
+ minify: {
266
+ collapseBooleanAttributes: true,
267
+ decodeEntities: true,
268
+ minifyCSS: true,
269
+ minifyJS: true,
270
+ processConditionalComments: true,
271
+ removeEmptyAttributes: true,
272
+ removeRedundantAttributes: true,
273
+ trimCustomFragments: true,
274
+ useShortDoctype: true
275
+ }
276
+ },
277
+ template: void 0,
278
+ watch: [],
279
+ devMiddleware: {
280
+ stats: "none"
281
+ },
282
+ hotMiddleware: {},
283
+ vendor: {
284
+ $meta: {
285
+ deprecated: "vendor has been deprecated since nuxt 2"
286
+ }
287
+ },
288
+ stats: {
289
+ $resolve: async (val, get) => val === "none" || await get("build.quiet") ? false : val,
290
+ excludeAssets: [
291
+ /.map$/,
292
+ /index\..+\.html$/,
293
+ /vue-ssr-(client|modern)-manifest.json/
294
+ ]
295
+ },
296
+ friendlyErrors: true,
297
+ additionalExtensions: [],
298
+ warningIgnoreFilters: [],
299
+ followSymlinks: false
300
+ }
301
+ });
302
+
303
+ const cli = defineUntypedSchema({
304
+ cli: {
305
+ badgeMessages: [],
306
+ bannerColor: "green"
307
+ }
308
+ });
309
+
310
+ const common = defineUntypedSchema({
311
+ editor: void 0,
312
+ watch: {
313
+ $resolve: async (val, get) => {
314
+ const rootDir = await get("rootDir");
315
+ return Array.from(new Set(
316
+ [].concat(val, await get("_nuxtConfigFiles")).filter(Boolean).map((p) => resolve(rootDir, p))
317
+ ));
318
+ }
319
+ },
320
+ styleExtensions: [".css", ".pcss", ".postcss", ".styl", ".stylus", ".scss", ".sass", ".less"],
321
+ dir: {
322
+ assets: "assets",
323
+ app: "app",
324
+ globalName: {
325
+ $resolve: (val) => typeof val === "string" && /^[a-zA-Z]+$/.test(val) ? val.toLocaleLowerCase() : "nuxt"
326
+ },
327
+ modern: void 0,
328
+ mode: {
329
+ $resolve: async (val, get) => val || (await get("ssr") ? "spa" : "universal"),
330
+ $schema: { deprecated: "`mode` option is deprecated" }
331
+ },
332
+ env: {
333
+ $default: {},
334
+ $resolve: (val) => {
335
+ val = { ...val };
336
+ for (const key in process.env) {
337
+ if (key.startsWith("NUXT_ENV_")) {
338
+ val[key] = process.env[key];
339
+ }
340
+ }
341
+ return val;
342
+ }
343
+ },
344
+ createRequire: {
345
+ $resolve: (val) => {
346
+ val = process.env.NUXT_CREATE_REQUIRE || val || (typeof globalThis.jest !== "undefined" ? "native" : "jiti");
347
+ if (val === "jiti") {
348
+ return (p) => jiti(typeof p === "string" ? p : p.filename, { esmResolve: true });
349
+ }
350
+ if (val === "native") {
351
+ return (p) => createRequire(typeof p === "string" ? p : p.filename);
352
+ }
353
+ return val;
354
+ }
355
+ },
356
+ target: {
357
+ $resolve: (val) => ["server", "static"].includes(val) ? val : "server"
358
+ },
359
+ globals: {
360
+ id: (globalName) => `__${globalName}`,
361
+ nuxt: (globalName) => `$${globalName}`,
362
+ context: (globalName) => `__${globalName.toUpperCase()}__`,
363
+ pluginPrefix: (globalName) => globalName,
364
+ readyCallback: (globalName) => `on${pascalCase(globalName)}Ready`,
365
+ loadedCallback: (globalName) => `_on${pascalCase(globalName)}Loaded`
366
+ },
367
+ store: "store"
368
+ },
369
+ serverMiddleware: {
370
+ $resolve: (val) => {
371
+ if (!val) {
372
+ return [];
373
+ }
374
+ if (!Array.isArray(val)) {
375
+ return Object.entries(val).map(([path, handler]) => ({ path, handler }));
376
+ }
377
+ return val;
378
+ }
379
+ }
380
+ });
381
+
382
+ const generate = defineUntypedSchema({
383
+ generate: {
384
+ dir: {
385
+ $resolve: async (val = "dist", get) => resolve(await get("rootDir"), val)
386
+ },
387
+ concurrency: 500,
388
+ interval: 0,
389
+ subFolders: true,
390
+ fallback: { $resolve: (val) => val === true ? "400.html" : val || "200.html" },
391
+ crawler: true,
392
+ manifest: true,
393
+ nojekyll: true,
394
+ cache: {
395
+ ignore: [],
396
+ globbyOptions: {
397
+ gitignore: true
398
+ }
399
+ },
400
+ staticAssets: {
401
+ dir: "static",
402
+ base: {
403
+ $resolve: async (val, get) => val || joinURL((await get("app")).buildAssetsDir, await get("generate.dir"))
404
+ },
405
+ versionBase: {
406
+ $resolve: async (val, get) => val || joinURL(await get("generate.base"), await get("generate.version"))
407
+ },
408
+ version: {
409
+ $resolve: (val) => val || String(Math.round(Date.now() / 1e3))
410
+ }
411
+ }
412
+ }
413
+ });
414
+
415
+ const messages = defineUntypedSchema({
416
+ messages: {
417
+ loading: "Loading...",
418
+ error_404: "This page could not be found",
419
+ server_error: "Server error",
420
+ nuxtjs: "Nuxt",
421
+ back_to_home: "Back to the home page",
422
+ server_error_details: "An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.",
423
+ client_error: "Error",
424
+ client_error_details: "An error occurred while rendering the page. Check developer tools console for details."
425
+ }
426
+ });
427
+
428
+ const render = defineUntypedSchema({
429
+ render: {
430
+ bundleRenderer: {
431
+ shouldPrefetch: () => false,
432
+ shouldPreload: (_fileWithoutQuery, asType) => ["script", "style"].includes(asType),
433
+ runInNewContext: {
434
+ $resolve: async (val, get) => val ?? await get("dev")
435
+ }
436
+ },
437
+ crossorigin: void 0,
438
+ resourceHints: true,
439
+ ssr: void 0,
440
+ ssrLog: {
441
+ $resolve: async (val, get) => await get("dev") ? Boolean(val) : false
442
+ },
443
+ http2: {
444
+ push: false,
445
+ shouldPush: null,
446
+ pushAssets: null
447
+ },
448
+ static: {
449
+ prefix: true
450
+ },
451
+ compressor: {
452
+ threshold: 0
453
+ },
454
+ etag: {
455
+ hash: false,
456
+ weak: false
457
+ },
458
+ csp: {
459
+ $resolve: async (val, get) => {
460
+ if (!val) {
461
+ return false;
462
+ }
463
+ return {
464
+ hashAlgorithm: "sha256",
465
+ allowedSources: void 0,
466
+ policies: void 0,
467
+ addMeta: Boolean(await get("target") === "static"),
468
+ unsafeInlineCompatibility: false,
469
+ reportOnly: await get("debug"),
470
+ ...val
471
+ };
472
+ }
473
+ },
474
+ dist: {
475
+ index: false,
476
+ maxAge: "1y"
477
+ },
478
+ fallback: {
479
+ dist: {},
480
+ static: {
481
+ skipUnknown: true,
482
+ handlers: {
483
+ ".htm": false,
484
+ ".html": false
485
+ }
486
+ }
487
+ }
488
+ }
489
+ });
490
+
491
+ const router = defineUntypedSchema({
492
+ router: {
493
+ mode: "history",
494
+ base: {
495
+ $resolve: async (val, get) => val ? withTrailingSlash(normalizeURL(val)) : (await get("app")).baseURL
496
+ },
497
+ _routerBaseSpecified: {
498
+ $resolve: async (_val, get) => typeof await get("router.base") === "string"
499
+ },
500
+ routes: [],
501
+ routeNameSplitter: "-",
502
+ middleware: {
503
+ $resolve: (val) => Array.isArray(val) ? val : [val].filter(Boolean)
504
+ },
505
+ linkActiveClass: "nuxt-link-active",
506
+ linkExactActiveClass: "nuxt-link-exact-active",
507
+ linkPrefetchedClass: false,
508
+ extendRoutes: null,
509
+ scrollBehavior: {
510
+ $schema: {
511
+ deprecated: "router.scrollBehavior` property is deprecated in favor of using `~/app/router.scrollBehavior.js` file, learn more: https://nuxtjs.org/api/configuration-router#scrollbehavior"
512
+ }
513
+ },
514
+ parseQuery: false,
515
+ stringifyQuery: false,
516
+ fallback: false,
517
+ prefetchLinks: true,
518
+ prefetchPayloads: true,
519
+ trailingSlash: void 0
520
+ }
521
+ });
522
+
523
+ const server = defineUntypedSchema({
524
+ server: {
525
+ https: false,
526
+ port: process.env.NUXT_PORT || process.env.PORT || process.env.npm_package_config_nuxt_port || 3e3,
527
+ host: process.env.NUXT_HOST || process.env.HOST || process.env.npm_package_config_nuxt_host || "localhost",
528
+ socket: process.env.UNIX_SOCKET || process.env.npm_package_config_unix_socket,
529
+ timing: (val) => val ? { total: true, ...val } : false
530
+ }
531
+ });
532
+
533
+ const index = {
534
+ ...app,
535
+ ...build,
536
+ ...cli,
537
+ ...common,
538
+ ...generate,
539
+ ...messages,
540
+ ...render,
541
+ ...router,
542
+ ...server
543
+ };
544
+
545
+ export { index as NuxtConfigSchema };
package/package.json CHANGED
@@ -1,4 +1,44 @@
1
- {
2
- "name": "@nuxt/bridge-schema-edge",
3
- "version": "0.0.0"
1
+ {
2
+ "name": "@nuxt/bridge-schema-edge",
3
+ "version": "3.0.0-27833237.ddd8ecc",
4
+ "repository": "nuxt/bridge",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "schema"
12
+ ],
13
+ "devDependencies": {
14
+ "@types/lodash.template": "^4",
15
+ "@types/semver": "^7",
16
+ "@vitejs/plugin-vue": "^3.1.2",
17
+ "@vueuse/head": "^0.9.7",
18
+ "nitropack": "^1.0.0",
19
+ "unbuild": "latest",
20
+ "vite": "~3.2.4"
21
+ },
22
+ "dependencies": {
23
+ "c12": "^1.0.1",
24
+ "create-require": "^1.1.1",
25
+ "defu": "^6.1.0",
26
+ "jiti": "^1.16.0",
27
+ "pathe": "^1.0.0",
28
+ "pkg-types": "^1.0.1",
29
+ "postcss-import-resolver": "^2.0.0",
30
+ "scule": "^1.0.0",
31
+ "std-env": "^3.3.0",
32
+ "ufo": "^1.0.1",
33
+ "unbuild": "1.0.1",
34
+ "unimport": "^0.6.8",
35
+ "untyped": "^1.0.0"
36
+ },
37
+ "engines": {
38
+ "node": "^14.16.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
39
+ },
40
+ "_name": "@nuxt/bridge-schema",
41
+ "scripts": {
42
+ "build": "unbuild"
43
+ }
4
44
  }