Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
revert <InputObject> (debugging schema regression)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 26, 2022
1 parent 51c72a2 commit 279a9c7
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 66 deletions.
2 changes: 1 addition & 1 deletion packages/schema/src/config/_adhoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
* @version 2
* @version 3
*/
components: <InputObject>{
components: {
$resolve: (val, get) => {
if (Array.isArray(val)) {
return { dirs: val }
Expand Down
26 changes: 13 additions & 13 deletions packages/schema/src/config/_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export default {
* @version 2
*/
config: {
silent: <InputObject>{
$resolve: (val, get) => val ?? !get('dev')
silent: {
$resolve: (val, get) => val ?? !get('dev')
},
performance: <InputObject>{
$resolve: (val, get) => val ?? get('dev')
performance: {
$resolve: (val, get) => val ?? get('dev')
},
},
/**
Expand Down Expand Up @@ -60,7 +60,7 @@ export default {
* @deprecated - use `buildAssetsDir` instead
* @version 2
*/
assetsPath: <InputObject>{
assetsPath: {
$resolve: (val, get) => val ?? get('buildAssetsDir')
},
/**
Expand All @@ -72,7 +72,7 @@ export default {
* NUXT_APP_CDN_URL=https://mycdn.org/ node .output/server/index.mjs
* ```
*/
cdnURL: <InputObject>{
cdnURL: {
$resolve: (val, get) => get('dev') ? '' : (process.env.NUXT_APP_CDN_URL ?? val) || ''
},
/**
Expand Down Expand Up @@ -109,7 +109,7 @@ export default {
* @type {typeof import('../src/types/config').NuxtAppConfig['head']}
* @version 3
*/
head: <InputObject>{
head: {
$resolve: (val, get) => {
const resolved: Required<MetaObject> = defu(val, get('meta'), {
meta: [],
Expand Down Expand Up @@ -179,7 +179,7 @@ export default {
* ```
* @version 2
*/
appTemplatePath: <InputObject>{
appTemplatePath: {
$resolve: (val, get) => {
if (val) {
return resolve(get('srcDir'), val)
Expand All @@ -197,7 +197,7 @@ export default {
* By default, it is enabled if there is a `store/` directory.
* @version 2
*/
store: <InputObject>{
store: {
$resolve: (val, get) => val !== false &&
existsSync(join(get('srcDir'), get('dir.store'))) &&
readdirSync(join(get('srcDir'), get('dir.store')))
Expand Down Expand Up @@ -311,7 +311,7 @@ export default {
* @version 2
* @version 3
*/
css: <InputObject>{
css: {
$resolve: val => (val ?? []).map((c: any) => c.src || c)
},

Expand Down Expand Up @@ -376,7 +376,7 @@ export default {
* other options will be passed to the template).
* @version 2
*/
loadingIndicator: <InputObject>{
loadingIndicator: {
$resolve: (val, get) => {
val = typeof val === 'string' ? { name: val } : val
return defu(val, {
Expand All @@ -400,7 +400,7 @@ export default {
* @see [vue@3 documentation](https://vuejs.org/guide/built-ins/transition-group.html#enter-leave-transitions)
* @version 2
*/
pageTransition: <InputObject>{
pageTransition: {
$resolve: (val, get) => {
val = typeof val === 'string' ? { name: val } : val
return defu(val, {
Expand All @@ -424,7 +424,7 @@ export default {
* @see [vue@3 documentation](https://vuejs.org/guide/built-ins/transition-group.html#enter-leave-transitions)
* @version 2
*/
layoutTransition: <InputObject>{
layoutTransition: {
$resolve: val => {
val = typeof val === 'string' ? { name: val } : val
return defu(val, {
Expand Down
30 changes: 15 additions & 15 deletions packages/schema/src/config/_common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
* @version 2
* @version 3
*/
rootDir: <InputObject>{
rootDir: {
$resolve: val => typeof val === 'string' ? resolve(val) : process.cwd()
},

Expand Down Expand Up @@ -66,7 +66,7 @@ export default {
* @version 2
* @version 3
*/
srcDir: <InputObject>{
srcDir: {
$resolve: (val, get) => resolve(get('rootDir'), val || '.')
},

Expand All @@ -85,7 +85,7 @@ export default {
* @version 2
* @version 3
*/
buildDir: <InputObject>{
buildDir: {
$resolve: (val, get) => resolve(get('rootDir'), val || '.nuxt')
},

Expand All @@ -110,7 +110,7 @@ export default {
* By default, it's only enabled in development mode.
* @version 2
*/
debug: <InputObject>{
debug: {
$resolve: (val, get) => val ?? get('dev')
},

Expand All @@ -129,7 +129,7 @@ export default {
*
* @version 2
*/
env: <InputObject>{
env: {
$default: {},
$resolve: (val) => {
val = { ...val }
Expand All @@ -150,7 +150,7 @@ export default {
* @type {'jiti' | 'native' | ((p: string | { filename: string }) => NodeRequire)}
* @version 2
*/
createRequire: <InputObject>{
createRequire: {
$resolve: (val: any) => {
val = process.env.NUXT_CREATE_REQUIRE || val ||
(typeof globalThis.jest !== 'undefined' ? 'native' : 'jiti')
Expand All @@ -172,7 +172,7 @@ export default {
* @type {'server' | 'static'}
* @version 2
*/
target: <InputObject>{
target: {
$resolve: val => ['server', 'static'].includes(val) ? val : 'server'
},

Expand All @@ -188,7 +188,7 @@ export default {
/**
* @deprecated use `ssr` option
*/
mode: <InputObject>{
mode: {
$resolve: (val, get) => val || (get('ssr') ? 'spa' : 'universal'),
$schema: { deprecated: '`mode` option is deprecated' }
},
Expand Down Expand Up @@ -303,7 +303,7 @@ export default {
* Vue instance name and other options.
* @version 2
*/
globalName: <InputObject>{
globalName: {
$resolve: val => (typeof val === 'string' && /^[a-zA-Z]+$/.test(val)) ? val.toLocaleLowerCase() : 'nuxt'
},

Expand Down Expand Up @@ -398,7 +398,7 @@ export default {
* @version 2
* @deprecated Use `serverHandlers` instead
*/
serverMiddleware: <InputObject>{
serverMiddleware: {
$resolve: (val: any) => {
if (!val) {
return []
Expand Down Expand Up @@ -426,7 +426,7 @@ export default {
* ```
* @version 2
*/
modulesDir: <InputObject>{
modulesDir: {
$default: ['node_modules'],
$resolve: (val, get) => [].concat(
val.map(dir => resolve(get('rootDir'), dir)),
Expand Down Expand Up @@ -495,7 +495,7 @@ export default {
* @version 2
* @version 3
*/
extensions: <InputObject>{
extensions: {
$resolve: val => ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.vue'].concat(val).filter(Boolean)
},

Expand Down Expand Up @@ -593,7 +593,7 @@ export default {
* @version 2
* @version 3
*/
ignore: <InputObject>{
ignore: {
$resolve: (val, get) => [
'**/*.stories.{js,ts,jsx,tsx}', // ignore storybook files
'**/*.{spec,test}.{js,ts,jsx,tsx}', // ignore tests
Expand All @@ -617,7 +617,7 @@ export default {
* @type {string[]}
* @version 2
*/
watch: <InputObject>{
watch: {
$resolve: (val, get) => {
const rootDir = get('rootDir')
return Array.from(new Set([].concat(val, get('_nuxtConfigFiles'))
Expand Down Expand Up @@ -721,7 +721,7 @@ export default {
* @type {typeof import('../src/types/config').RuntimeConfig}
* @version 3
*/
runtimeConfig: <InputObject>{
runtimeConfig: {
$resolve: (val: RuntimeConfig, get) => defu(val, {
...get('publicRuntimeConfig'),
...get('privateRuntimeConfig'),
Expand Down
20 changes: 10 additions & 10 deletions packages/schema/src/config/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
* @type {'vite' | 'webpack' | { bundle: (nuxt: typeof import('../src/types/nuxt').Nuxt) => Promise<void> }}
* @version 3
*/
builder: <InputObject>{
builder: {
$resolve: (val, get) => {
if (typeof val === 'object') {
return val
Expand Down Expand Up @@ -59,7 +59,7 @@ export default {
* ```
* @type {boolean | typeof import('webpack-bundle-analyzer').BundleAnalyzerPlugin.Options | typeof import('rollup-plugin-visualizer').PluginVisualizerOptions}
*/
analyze: <InputObject>{
analyze: {
$resolve: (val, get) => {
if(val !== true) {
return val ?? false
Expand Down Expand Up @@ -138,7 +138,7 @@ export default {
* Enables CSS source map support (defaults to true in development)
* @version 2
*/
cssSourceMap: <InputObject>{
cssSourceMap: {
$resolve: (val, get) => val ?? get('sourcemap') ?? get('dev')
},

Expand All @@ -154,7 +154,7 @@ export default {
* @warning This is an unstable feature.
* @version 2
*/
parallel: <InputObject>{
parallel: {
$resolve: (val, get) => get('build.extractCSS') ? false : Boolean(val)
},

Expand Down Expand Up @@ -198,7 +198,7 @@ export default {
* ```
* @version 2
*/
publicPath: <InputObject>{
publicPath: {
$resolve: (val, get) => val ? withTrailingSlash(normalizeURL(val)) : get('app').buildAssetsDir
},

Expand Down Expand Up @@ -241,7 +241,7 @@ export default {
* Customize the options of Nuxt's integrated webpack loaders.
* @version 2
*/
loaders: <InputObject>{
loaders: {
$resolve: (val, get) => {
const styleLoaders = [
'css', 'cssModules', 'less',
Expand Down Expand Up @@ -350,7 +350,7 @@ export default {
* @see [optimize-css-assets-webpack-plugin documentation](https://github.com/NMFR/optimize-css-assets-webpack-plugin).
* @version 2
*/
optimizeCSS: <InputObject>{
optimizeCSS: {
$resolve: (val, get) => val ?? (get('build.extractCSS') ? {} : false)
},

Expand All @@ -361,7 +361,7 @@ export default {
optimization: {
runtimeChunk: 'single',
/** Set minimize to false to disable all minimizers. (It is disabled in development by default) */
minimize: <InputObject>{
minimize: {
$resolve: (val, get) => val ?? !get('dev')
},
/** You can set minimizer to a customized array of plugins. */
Expand Down Expand Up @@ -493,7 +493,7 @@ export default {
*/
postcss: {
execute: undefined,
postcssOptions: <InputObject>{
postcssOptions: {
$resolve: (val, get) => {
// Ensure we return the same object in `build.postcss.postcssOptions as `postcss`
// so modules which modify the configuration continue to work.
Expand Down Expand Up @@ -612,7 +612,7 @@ export default {
* Set to `'none'` or `false` to disable stats printing out after a build.
* @version 2
*/
stats: <InputObject>{
stats: {
$resolve: (val, get) => (val === 'none' || get('build.quiet')) ? false : val,
excludeAssets: [
/.map$/,
Expand Down
4 changes: 2 additions & 2 deletions packages/schema/src/config/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
/**
* Set to true to generate an async entry point for the Vue bundle (for module federation support).
*/
asyncEntry: <InputObject>{
asyncEntry: {
$resolve: (val) => val ?? false
},

Expand All @@ -33,7 +33,7 @@ export default {
*
* @deprecated use `vite.devBundler: 'vite-node'`
*/
viteNode: <InputObject>{
viteNode: {
$resolve: (val) => {
val = process.env.EXPERIMENTAL_VITE_NODE ? true : val
if (val === true) {
Expand Down
14 changes: 7 additions & 7 deletions packages/schema/src/config/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
/**
* Directory name that holds all the assets and generated pages for a `static` build.
*/
dir: <InputObject>{
dir: {
$resolve: (val = 'dist', get) => resolve(get('rootDir'), val)
},

Expand Down Expand Up @@ -161,16 +161,16 @@ export default {
* The full path to the directory underneath `/_nuxt/` where static assets
* (payload, state and manifest files) will live.
*/
base: <InputObject>{
$resolve: (val, get) => val || joinURL(get('app').buildAssetsDir, get('generate.dir'))
base: {
$resolve: (val, get) => val || joinURL(get('app').buildAssetsDir, get('generate.dir'))
},
/** The full path to the versioned directory where static assets for the current build are located. */
versionBase: <InputObject>{
$resolve: (val, get) => val || joinURL(get('generate.base'), get('generate.version'))
versionBase: {
$resolve: (val, get) => val || joinURL(get('generate.base'), get('generate.version'))
},
/** A unique string to uniquely identify payload versions (defaults to the current timestamp). */
version: <InputObject>{
$resolve: val => val || (String(Math.round(Date.now() / 1000)))
version: {
$resolve: val => val || (String(Math.round(Date.now() / 1000)))
}
}
}
4 changes: 2 additions & 2 deletions packages/schema/src/config/postcss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
/**
* https://github.com/postcss/postcss-import
*/
'postcss-import': <InputObject>{
'postcss-import': {
$resolve: (val, get) => val !== false ? defu(val || {}, {
resolve: createResolver({
alias: { ...get('alias') },
Expand All @@ -41,7 +41,7 @@ export default {
*/
autoprefixer: {},

cssnano: <InputObject>{
cssnano: {
$resolve: (val, get) => val ?? (!get('dev') && {
preset: ['default', {
// Keep quotes in font values to prevent from HEX conversion
Expand Down
Loading

0 comments on commit 279a9c7

Please sign in to comment.