@modern-js/module-tools 2.0.2 → 2.1.1-beta.0
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/CHANGELOG.md +26 -0
- package/dist/builder/build.js +3 -1
- package/dist/builder/build.js.map +1 -1
- package/dist/cli.js +4 -2
- package/dist/cli.js.map +1 -1
- package/dist/command.js +2 -2
- package/dist/command.js.map +1 -1
- package/dist/config/defineConfig.d.ts +8 -2
- package/dist/config/defineConfig.js +24 -2
- package/dist/config/defineConfig.js.map +1 -1
- package/dist/config/legacy-schema.d.ts +649 -0
- package/dist/config/legacy-schema.js +220 -0
- package/dist/config/legacy-schema.js.map +1 -0
- package/dist/config/normalize.js +6 -1
- package/dist/config/normalize.js.map +1 -1
- package/dist/config/schema.d.ts +13 -1
- package/dist/config/schema.js +12 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/config/transform-legacy-config.d.ts +27 -0
- package/dist/config/transform-legacy-config.js +424 -0
- package/dist/config/transform-legacy-config.js.map +1 -0
- package/dist/constants/build-presets.d.ts +5 -0
- package/dist/constants/build-presets.js +6 -1
- package/dist/constants/build-presets.js.map +1 -1
- package/dist/constants/build.js +1 -0
- package/dist/constants/build.js.map +1 -1
- package/dist/constants/legacy-build-presets.d.ts +5 -0
- package/dist/constants/legacy-build-presets.js +5 -0
- package/dist/constants/legacy-build-presets.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/locale/en.d.ts +1 -0
- package/dist/locale/en.js +2 -1
- package/dist/locale/en.js.map +1 -1
- package/dist/locale/index.d.ts +2 -0
- package/dist/locale/zh.d.ts +1 -0
- package/dist/locale/zh.js +2 -1
- package/dist/locale/zh.js.map +1 -1
- package/dist/plugins.js.map +1 -1
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/config/index.js.map +1 -1
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/legacyConfig/index.d.ts +20 -0
- package/dist/types/legacyConfig/index.js +17 -0
- package/dist/types/legacyConfig/index.js.map +1 -0
- package/dist/types/legacyConfig/output.d.ts +65 -0
- package/dist/types/legacyConfig/output.js +17 -0
- package/dist/types/legacyConfig/output.js.map +1 -0
- package/dist/types/legacyConfig/source.d.ts +14 -0
- package/dist/types/legacyConfig/source.js +17 -0
- package/dist/types/legacyConfig/source.js.map +1 -0
- package/dist/types/legacyConfig/tools.d.ts +57 -0
- package/dist/types/legacyConfig/tools.js +17 -0
- package/dist/types/legacyConfig/tools.js.map +1 -0
- package/dist/utils/config.d.ts +5 -2
- package/dist/utils/config.js +23 -18
- package/dist/utils/config.js.map +1 -1
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var src_exports = {};
|
|
|
20
20
|
__export(src_exports, {
|
|
21
21
|
default: () => src_default,
|
|
22
22
|
defineConfig: () => import_defineConfig.defineConfig,
|
|
23
|
+
defineLegacyConfig: () => import_defineConfig.defineLegacyConfig,
|
|
23
24
|
legacyPresets: () => import_legacy_build_presets.legacyPresets
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -31,6 +32,7 @@ var src_default = import_cli.cli;
|
|
|
31
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
33
|
0 && (module.exports = {
|
|
33
34
|
defineConfig,
|
|
35
|
+
defineLegacyConfig,
|
|
34
36
|
legacyPresets
|
|
35
37
|
});
|
|
36
38
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoB;AAEpB,
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoB;AAEpB,0BAAiD;AACjD,kCAA8B;AAC9B,wBAAc,oBAJd;AAKA,IAAO,cAAQ;;;;;;;","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { cli } from './cli';\n\nexport { defineConfig, defineLegacyConfig } from './config/defineConfig';\nexport { legacyPresets } from './constants/legacy-build-presets';\nexport * from './types';\nexport default cli;\n"]}
|
package/dist/locale/en.d.ts
CHANGED
package/dist/locale/en.js
CHANGED
|
@@ -42,7 +42,8 @@ const EN_LOCALE = {
|
|
|
42
42
|
debug: "using debug mode to log something",
|
|
43
43
|
config: "set default generator config(json string)",
|
|
44
44
|
distTag: `use specified tag version for it's generator`,
|
|
45
|
-
registry: "set npm registry url to run npm command"
|
|
45
|
+
registry: "set npm registry url to run npm command",
|
|
46
|
+
lang: "set new command language(en or zh)"
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
};
|
package/dist/locale/en.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,YAAY;AAAA,EACvB,SAAS;AAAA,IACP,OAAO;AAAA,MACL,UAAU;AAAA,MACV,OAAO;AAAA,MACP,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,UACE;AAAA,MACF,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,UAAU;AAAA,MACV,QAAQ;AAAA,IACV;AAAA,IACA,KAAK;AAAA,MACH,UAAU;AAAA,MACV,UAAU;AAAA,IACZ;AAAA,IACA,KAAK;AAAA,MACH,UAAU;AAAA,MACV,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,YAAY;AAAA,EACvB,SAAS;AAAA,IACP,OAAO;AAAA,MACL,UAAU;AAAA,MACV,OAAO;AAAA,MACP,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,UACE;AAAA,MACF,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,UAAU;AAAA,MACV,QAAQ;AAAA,IACV;AAAA,IACA,KAAK;AAAA,MACH,UAAU;AAAA,MACV,UAAU;AAAA,IACZ;AAAA,IACA,KAAK;AAAA,MACH,UAAU;AAAA,MACV,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,MAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[],"sources":["../../src/locale/en.ts"],"sourcesContent":["export const EN_LOCALE = {\n command: {\n build: {\n describe: 'command for building module',\n watch: 'building module in watch mode',\n tsconfig: 'Specify a path to the tsconfig.json file',\n style_only: 'only build style',\n platform:\n 'build the specified task or all tasks, If exist. (tasks: \"storybook\", \"docs\")',\n no_tsc: 'close tsc compiler to emit d.ts (Deprecated)',\n dts: 'Turn on dts generation and type checking',\n no_clear: 'disable auto clear dist dir',\n config: 'specify config file',\n },\n dev: {\n describe: 'start dev server',\n tsconfig: 'Specify a path to the tsconfig.json file',\n },\n new: {\n describe: 'generator runner for modern project',\n debug: 'using debug mode to log something',\n config: 'set default generator config(json string)',\n distTag: `use specified tag version for it's generator`,\n registry: 'set npm registry url to run npm command',\n lang: 'set new command language(en or zh)',\n },\n },\n};\n"]}
|
package/dist/locale/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ declare const localeKeys: {
|
|
|
22
22
|
config: string;
|
|
23
23
|
distTag: string;
|
|
24
24
|
registry: string;
|
|
25
|
+
lang: string;
|
|
25
26
|
};
|
|
26
27
|
};
|
|
27
28
|
} | {
|
|
@@ -47,6 +48,7 @@ declare const localeKeys: {
|
|
|
47
48
|
config: string;
|
|
48
49
|
distTag: string;
|
|
49
50
|
registry: string;
|
|
51
|
+
lang: string;
|
|
50
52
|
};
|
|
51
53
|
};
|
|
52
54
|
};
|
package/dist/locale/zh.d.ts
CHANGED
package/dist/locale/zh.js
CHANGED
package/dist/locale/zh.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,YAAY;AAAA,EACvB,SAAS;AAAA,IACP,OAAO;AAAA,MACL,UAAU;AAAA,MACV,OAAO;AAAA,MACP,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,UACE;AAAA,MACF,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,UAAU;AAAA,MACV,QAAQ;AAAA,IACV;AAAA,IACA,KAAK;AAAA,MACH,UAAU;AAAA,MACV,UAAU;AAAA,IACZ;AAAA,IACA,KAAK;AAAA,MACH,UAAU;AAAA,MACV,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,YAAY;AAAA,EACvB,SAAS;AAAA,IACP,OAAO;AAAA,MACL,UAAU;AAAA,MACV,OAAO;AAAA,MACP,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,UACE;AAAA,MACF,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,UAAU;AAAA,MACV,QAAQ;AAAA,IACV;AAAA,IACA,KAAK;AAAA,MACH,UAAU;AAAA,MACV,UAAU;AAAA,IACZ;AAAA,IACA,KAAK;AAAA,MACH,UAAU;AAAA,MACV,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,MAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[],"sources":["../../src/locale/zh.ts"],"sourcesContent":["export const ZH_LOCALE = {\n command: {\n build: {\n describe: '构建模块命令',\n watch: '使用 Watch 模式构建模块',\n tsconfig: '指定 tsconfig.json 文件的路径',\n style_only: '只构建样式文件',\n platform:\n '如果存在的话,执行指定的构建任务或者全部构建任务. (构建任务包括: \"storybook\", \"文档\")',\n no_tsc: '关闭 tsc 编译(废弃)',\n dts: '开启 dts 文件的生成以及类型检查',\n no_clear: '不清理产物目录',\n config: '指定配置文件路径,可以为相对路径或绝对路径',\n },\n dev: {\n describe: '本地开发命令',\n tsconfig: '指定 tsconfig.json 文件的路径',\n },\n new: {\n describe: '模块化工程方案中执行生成器',\n debug: '开启 Debug 模式,打印调试日志信息',\n config: '生成器运行默认配置(JSON 字符串)',\n distTag: '生成器使用特殊的 npm Tag 版本',\n registry: '生成器运行过程中定制 npm Registry',\n lang: '设置 new 命令执行语言(zh 或者 en)',\n },\n },\n};\n"]}
|
package/dist/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAA4B;AAC5B,yBAAuB;AAEhB,MAAM,aAAa,CAAC,eAAuB;AAChD,MAAI,UAAuB,CAAC;AAE5B,UAAQ;AAAA,SACD;AACH,gBAAU,CAAC;AACX;AAAA,SACG;AACH,gBAAU,KAAC,4BAAW,CAAC;AACvB;AAAA,SACG;AAAA,SACA;AAAA,SACA;AACH,gBAAU,KAAC,iCAAgB,CAAC;AAC5B;AAAA;AAEA,gBAAU,CAAC;AAAA;AAGf,SAAO;AACT;;;;;","names":[],"sources":["../src/plugins.ts"],"sourcesContent":["import type { CliPlugin } from '@modern-js/core';\nimport
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAA4B;AAC5B,yBAAuB;AAEhB,MAAM,aAAa,CAAC,eAAuB;AAChD,MAAI,UAAuB,CAAC;AAE5B,UAAQ;AAAA,SACD;AACH,gBAAU,CAAC;AACX;AAAA,SACG;AACH,gBAAU,KAAC,4BAAW,CAAC;AACvB;AAAA,SACG;AAAA,SACA;AAAA,SACA;AACH,gBAAU,KAAC,iCAAgB,CAAC;AAC5B;AAAA;AAEA,gBAAU,CAAC;AAAA;AAGf,SAAO;AACT;;;;;","names":[],"sources":["../src/plugins.ts"],"sourcesContent":["import type { CliPlugin } from '@modern-js/core';\nimport changesetPlugin from '@modern-js/plugin-changeset';\nimport lintPlugin from '@modern-js/plugin-lint';\n\nexport const getPlugins = (runningCmd: string) => {\n let plugins: CliPlugin[] = [];\n\n switch (runningCmd) {\n case 'build':\n plugins = [];\n break;\n case 'lint':\n plugins = [lintPlugin()];\n break;\n case 'change':\n case 'release':\n case 'bump':\n plugins = [changesetPlugin()];\n break;\n default:\n plugins = [];\n }\n\n return plugins;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAgBA,2BAAc,oBAhBd;","names":[],"sources":["../../../src/types/config/index.ts"],"sourcesContent":["import type {\n UserConfig as LibuildUserConfig,\n Asset as LibuildAsset,\n Style as LibuildStyle,\n} from '@modern-js/libuild';\nimport type { Options } from '@modern-js/libuild-plugin-svgr';\nimport type { ToolsConfig as WebpackBuilderToolsConfig } from '@modern-js/builder-webpack-provider';\nimport { BuildInPreset, presetList } from '../../constants/build-presets';\nimport type { CopyConfig } from '../copy';\nimport type {\n LessConfig,\n SassConfig,\n PostCSSConfig,\n TailwindCSSConfig,\n} from './style';\n\nexport * from './style';\n\nexport type BuildType = 'bundleless' | 'bundle';\n\nexport type Format = 'esm' | 'cjs' | 'umd' | 'iife';\n\nexport type Target =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n // The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.\n | 'esnext';\n\nexport type Input = Required<LibuildUserConfig>['input'];\n\nexport type DTSOptions = {\n distPath: string;\n tsconfigPath: string;\n only: boolean;\n};\nexport type DTS = false | Partial<DTSOptions>;\n\nexport interface Asset {\n path?: LibuildAsset['outdir'];\n limit?: LibuildAsset['limit'];\n publicPath?: LibuildAsset['publicPath'];\n svgr?: boolean | Options;\n}\nexport type SourceMap = Required<LibuildUserConfig>['sourceMap'];\nexport type AutoExternal =\n | boolean\n | {\n dependencies?: boolean;\n peerDependencies?: boolean;\n };\nexport type JSX = 'automatic' | 'transform';\n\nexport type AliasOption =\n | Record<string, string>\n | ((aliases: Record<string, string>) => Record<string, string> | void);\n\nexport type BaseBuildConfig = Omit<\n Required<PartialBaseBuildConfig>,\n 'dts' | 'style' | 'alias'\n> & {\n dts: false | DTSOptions;\n style: Omit<Required<LibuildStyle>, 'cleanCss'> & {\n tailwindCss: TailwindCSSConfig;\n };\n alias: Record<string, string>;\n};\n\nexport type PartialBaseBuildConfig = {\n buildType?: 'bundleless' | 'bundle';\n format?: Format;\n target?: Target;\n dts?: DTS;\n sourceMap?: SourceMap;\n sourceDir?: string;\n copy?: CopyConfig;\n asset?: Asset;\n jsx?: JSX;\n outDir?: string;\n alias?: AliasOption;\n input?: Input;\n platform?: LibuildUserConfig['platform'];\n splitting?: LibuildUserConfig['splitting'];\n minify?: LibuildUserConfig['minify'];\n externals?: LibuildUserConfig['external'];\n autoExternal?: AutoExternal;\n umdGlobals?: LibuildUserConfig['globals'];\n umdModuleName?: ((chunkName: string) => string) | string | undefined;\n define?: LibuildUserConfig['define'];\n style?: StyleConfig;\n};\n\nexport type BuildConfig = BaseBuildConfig | BaseBuildConfig[];\nexport type PartialBuildConfig =\n | PartialBaseBuildConfig\n | PartialBaseBuildConfig[];\n\nexport type BuildPreset =\n | keyof typeof presetList\n | ((options: {\n preset: typeof BuildInPreset;\n }) => PartialBuildConfig | Promise<PartialBuildConfig>);\n\nexport interface StyleConfig {\n less?: LessConfig;\n sass?: SassConfig;\n postcss?: PostCSSConfig;\n autoModules?: LibuildStyle['autoModules'];\n modules?: LibuildStyle['modules'];\n inject?: LibuildStyle['inject'];\n /**\n * The configuration of `tools.tailwindcss` is provided by `tailwindcss` plugin.\n * Please use `yarn new` or `pnpm new` to enable the corresponding capability.\n * @requires `tailwindcss` plugin\n */\n tailwindcss?: TailwindCSSConfig;\n}\n\nexport interface StorybookBuildConfig {\n webpack?: WebpackBuilderToolsConfig['webpack'];\n webpackChain?: WebpackBuilderToolsConfig['webpackChain'];\n}\nexport interface Dev {\n storybook?: StorybookBuildConfig;\n}\n\nexport interface RuntimeUserConfig {\n [name: string]: any;\n}\n\nexport interface ModuleExtraConfig {\n designSystem?: Record<string, any>;\n\n buildConfig?: PartialBuildConfig;\n\n buildPreset?: BuildPreset;\n\n dev?: Dev;\n\n runtime?: RuntimeUserConfig;\n}\n"]}
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAgBA,2BAAc,oBAhBd;","names":[],"sources":["../../../src/types/config/index.ts"],"sourcesContent":["import type {\n UserConfig as LibuildUserConfig,\n Asset as LibuildAsset,\n Style as LibuildStyle,\n} from '@modern-js/libuild';\nimport type { Options } from '@modern-js/libuild-plugin-svgr';\nimport type { ToolsConfig as WebpackBuilderToolsConfig } from '@modern-js/builder-webpack-provider';\nimport { BuildInPreset, presetList } from '../../constants/build-presets';\nimport type { CopyConfig } from '../copy';\nimport type {\n LessConfig,\n SassConfig,\n PostCSSConfig,\n TailwindCSSConfig,\n} from './style';\n\nexport * from './style';\n\nexport type BuildType = 'bundleless' | 'bundle';\n\nexport type Format = 'esm' | 'cjs' | 'umd' | 'iife';\n\nexport type Target =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n // The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.\n | 'esnext';\n\nexport type Input = Required<LibuildUserConfig>['input'];\n\nexport type DTSOptions = {\n distPath: string;\n tsconfigPath: string;\n only: boolean;\n};\nexport type DTS = false | Partial<DTSOptions>;\n\nexport interface Asset {\n path?: LibuildAsset['outdir'];\n limit?: LibuildAsset['limit'];\n publicPath?: LibuildAsset['publicPath'];\n svgr?: boolean | Options;\n}\nexport type SourceMap = Required<LibuildUserConfig>['sourceMap'];\nexport type AutoExternal =\n | boolean\n | {\n dependencies?: boolean;\n peerDependencies?: boolean;\n };\nexport type JSX = 'automatic' | 'transform';\n\nexport type AliasOption =\n | Record<string, string>\n | ((aliases: Record<string, string>) => Record<string, string> | void);\n\nexport type BaseBuildConfig = Omit<\n Required<PartialBaseBuildConfig>,\n 'dts' | 'style' | 'alias'\n> & {\n dts: false | DTSOptions;\n style: Omit<Required<LibuildStyle>, 'cleanCss'> & {\n tailwindCss: TailwindCSSConfig;\n };\n alias: Record<string, string>;\n};\n\nexport type PartialBaseBuildConfig = {\n buildType?: 'bundleless' | 'bundle';\n format?: Format;\n target?: Target;\n dts?: DTS;\n sourceMap?: SourceMap;\n sourceDir?: string;\n copy?: CopyConfig;\n asset?: Asset;\n jsx?: JSX;\n outDir?: string;\n alias?: AliasOption;\n input?: Input;\n metafile?: boolean;\n platform?: LibuildUserConfig['platform'];\n splitting?: LibuildUserConfig['splitting'];\n minify?: LibuildUserConfig['minify'];\n externals?: LibuildUserConfig['external'];\n autoExternal?: AutoExternal;\n umdGlobals?: LibuildUserConfig['globals'];\n umdModuleName?: ((chunkName: string) => string) | string | undefined;\n define?: LibuildUserConfig['define'];\n style?: StyleConfig;\n};\n\nexport type BuildConfig = BaseBuildConfig | BaseBuildConfig[];\nexport type PartialBuildConfig =\n | PartialBaseBuildConfig\n | PartialBaseBuildConfig[];\n\nexport type BuildPreset =\n | keyof typeof presetList\n | ((options: {\n preset: typeof BuildInPreset;\n }) => PartialBuildConfig | Promise<PartialBuildConfig>);\n\nexport interface StyleConfig {\n less?: LessConfig;\n sass?: SassConfig;\n postcss?: PostCSSConfig;\n autoModules?: LibuildStyle['autoModules'];\n modules?: LibuildStyle['modules'];\n inject?: LibuildStyle['inject'];\n /**\n * The configuration of `tools.tailwindcss` is provided by `tailwindcss` plugin.\n * Please use `yarn new` or `pnpm new` to enable the corresponding capability.\n * @requires `tailwindcss` plugin\n */\n tailwindcss?: TailwindCSSConfig;\n}\n\nexport interface StorybookBuildConfig {\n webpack?: WebpackBuilderToolsConfig['webpack'];\n webpackChain?: WebpackBuilderToolsConfig['webpackChain'];\n}\nexport interface Dev {\n storybook?: StorybookBuildConfig;\n}\n\nexport interface RuntimeUserConfig {\n [name: string]: any;\n}\n\nexport interface ModuleExtraConfig {\n designSystem?: Record<string, any>;\n\n buildConfig?: PartialBuildConfig;\n\n buildPreset?: BuildPreset;\n\n dev?: Dev;\n\n runtime?: RuntimeUserConfig;\n}\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { NormalizedConfig, UserConfig } from '@modern-js/core';
|
|
2
2
|
import { ModuleToolsHooks } from './hooks';
|
|
3
3
|
import { ModuleExtraConfig } from './config';
|
|
4
|
+
import type { ModuleToolsLegacyUserConfig, ModuleToolsLegacyNormalizedConfig } from './legacyConfig';
|
|
4
5
|
export * from './hooks';
|
|
5
6
|
export * from './command';
|
|
6
7
|
export * from './config';
|
|
8
|
+
export * from './legacyConfig';
|
|
7
9
|
export * from './dts';
|
|
8
10
|
export * from './context';
|
|
9
11
|
export type { CliPlugin, IAppContext, PluginAPI } from '@modern-js/core';
|
|
@@ -12,6 +14,13 @@ export type ModuleTools = {
|
|
|
12
14
|
userConfig: ModuleExtraConfig;
|
|
13
15
|
normalizedConfig: Required<ModuleExtraConfig>;
|
|
14
16
|
};
|
|
17
|
+
export type LegacyModuleTools = {
|
|
18
|
+
hooks: ModuleToolsHooks;
|
|
19
|
+
userConfig: ModuleToolsLegacyUserConfig;
|
|
20
|
+
normalizedConfig: ModuleToolsLegacyNormalizedConfig;
|
|
21
|
+
};
|
|
15
22
|
export type ModuleUserConfig = UserConfig<ModuleTools>;
|
|
23
|
+
export type ModuleLegacyUserConfig = UserConfig<LegacyModuleTools>;
|
|
16
24
|
export type ModuleNormalizedConfig = NormalizedConfig<ModuleTools>;
|
|
25
|
+
export type ModuleLegacyNormalizedConfig = NormalizedConfig<LegacyModuleTools>;
|
|
17
26
|
export type ModuleConfigParams = ModuleUserConfig | Promise<ModuleUserConfig> | ((env: any) => ModuleUserConfig | Promise<ModuleUserConfig>);
|
package/dist/types/index.js
CHANGED
|
@@ -17,6 +17,7 @@ module.exports = __toCommonJS(types_exports);
|
|
|
17
17
|
__reExport(types_exports, require("./hooks"), module.exports);
|
|
18
18
|
__reExport(types_exports, require("./command"), module.exports);
|
|
19
19
|
__reExport(types_exports, require("./config"), module.exports);
|
|
20
|
+
__reExport(types_exports, require("./legacyConfig"), module.exports);
|
|
20
21
|
__reExport(types_exports, require("./dts"), module.exports);
|
|
21
22
|
__reExport(types_exports, require("./context"), module.exports);
|
|
22
23
|
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;AAAA;AAAA;
|
|
1
|
+
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAQA,0BAAc,oBARd;AASA,0BAAc,sBATd;AAUA,0BAAc,qBAVd;AAWA,0BAAc,2BAXd;AAYA,0BAAc,kBAZd;AAaA,0BAAc,sBAbd;","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["import { NormalizedConfig, UserConfig } from '@modern-js/core';\nimport { ModuleToolsHooks } from './hooks';\nimport { ModuleExtraConfig } from './config';\nimport type {\n ModuleToolsLegacyUserConfig,\n ModuleToolsLegacyNormalizedConfig,\n} from './legacyConfig';\n\nexport * from './hooks';\nexport * from './command';\nexport * from './config';\nexport * from './legacyConfig';\nexport * from './dts';\nexport * from './context';\nexport type { CliPlugin, IAppContext, PluginAPI } from '@modern-js/core';\n\nexport type ModuleTools = {\n hooks: ModuleToolsHooks;\n userConfig: ModuleExtraConfig;\n normalizedConfig: Required<ModuleExtraConfig>;\n};\nexport type LegacyModuleTools = {\n hooks: ModuleToolsHooks;\n userConfig: ModuleToolsLegacyUserConfig;\n normalizedConfig: ModuleToolsLegacyNormalizedConfig;\n};\n\nexport type ModuleUserConfig = UserConfig<ModuleTools>;\nexport type ModuleLegacyUserConfig = UserConfig<LegacyModuleTools>;\n\nexport type ModuleNormalizedConfig = NormalizedConfig<ModuleTools>;\nexport type ModuleLegacyNormalizedConfig = NormalizedConfig<LegacyModuleTools>;\n\n// params type for defineConfig\nexport type ModuleConfigParams =\n | ModuleUserConfig\n | Promise<ModuleUserConfig>\n | ((env: any) => ModuleUserConfig | Promise<ModuleUserConfig>);\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OutputLegacyUserConfig } from './output';
|
|
2
|
+
import type { SourceLegacyUserConfig } from './source';
|
|
3
|
+
import type { ToolsLegacyUserConfig } from './tools';
|
|
4
|
+
export type { OutputLegacyUserConfig } from './output';
|
|
5
|
+
export type { SourceLegacyUserConfig } from './source';
|
|
6
|
+
export type { ToolsLegacyUserConfig } from './tools';
|
|
7
|
+
export interface RuntimeLegacyConfig {
|
|
8
|
+
[name: string]: any;
|
|
9
|
+
}
|
|
10
|
+
export interface RuntimeByEntriesLegacyConfig {
|
|
11
|
+
[name: string]: RuntimeLegacyConfig;
|
|
12
|
+
}
|
|
13
|
+
export type ModuleToolsLegacyUserConfig = {
|
|
14
|
+
source?: SourceLegacyUserConfig;
|
|
15
|
+
output?: OutputLegacyUserConfig;
|
|
16
|
+
tools?: ToolsLegacyUserConfig;
|
|
17
|
+
runtime?: RuntimeLegacyConfig;
|
|
18
|
+
legacy?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type ModuleToolsLegacyNormalizedConfig = Required<ModuleToolsLegacyUserConfig>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var legacyConfig_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(legacyConfig_exports);
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;AAAA;AAAA;","names":[],"sources":["../../../src/types/legacyConfig/index.ts"],"sourcesContent":["import type { OutputLegacyUserConfig } from './output';\nimport type { SourceLegacyUserConfig } from './source';\n\nimport type { ToolsLegacyUserConfig } from './tools';\n\nexport type { OutputLegacyUserConfig } from './output';\n\nexport type { SourceLegacyUserConfig } from './source';\nexport type { ToolsLegacyUserConfig } from './tools';\n\nexport interface RuntimeLegacyConfig {\n [name: string]: any;\n}\n\nexport interface RuntimeByEntriesLegacyConfig {\n [name: string]: RuntimeLegacyConfig;\n}\n\nexport type ModuleToolsLegacyUserConfig = {\n source?: SourceLegacyUserConfig;\n output?: OutputLegacyUserConfig;\n tools?: ToolsLegacyUserConfig;\n runtime?: RuntimeLegacyConfig;\n legacy?: boolean;\n};\n\nexport type ModuleToolsLegacyNormalizedConfig =\n Required<ModuleToolsLegacyUserConfig>;\n"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { UserConfig as LibuildUserConfig } from '@modern-js/libuild';
|
|
2
|
+
export type LegacyBuildPreset = 'npm-library' | 'npm-library-with-umd' | 'npm-component' | 'npm-component-with-umd';
|
|
3
|
+
export type LegacyFormat = 'esm' | 'cjs' | 'umd';
|
|
4
|
+
export type LegacyTarget = 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'esnext';
|
|
5
|
+
export type LegacyBuildType = 'bundle' | 'bundleless';
|
|
6
|
+
export type LegacySourceMap = boolean | 'inline' | 'external';
|
|
7
|
+
export type LegacyBundleOptions = {
|
|
8
|
+
entry?: Record<string, string>;
|
|
9
|
+
platform?: LibuildUserConfig['platform'];
|
|
10
|
+
splitting?: boolean;
|
|
11
|
+
minify?: LibuildUserConfig['minify'];
|
|
12
|
+
externals?: LibuildUserConfig['external'];
|
|
13
|
+
skipDeps?: boolean;
|
|
14
|
+
getModuleId?: (moduleName: string) => string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type LegacyBundlelessOptions = {
|
|
17
|
+
sourceDir?: string;
|
|
18
|
+
style?: {
|
|
19
|
+
compileMode?: 'all' | 'only-compiled-code' |
|
|
20
|
+
/* may be will be deprecated */
|
|
21
|
+
'only-source-code' | false;
|
|
22
|
+
path?: string;
|
|
23
|
+
};
|
|
24
|
+
static?: {
|
|
25
|
+
path?: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type LegacyBaseBuildConfig = {
|
|
29
|
+
format?: LegacyFormat;
|
|
30
|
+
target?: LegacyTarget;
|
|
31
|
+
sourceMap?: LegacySourceMap;
|
|
32
|
+
buildType?: LegacyBuildType;
|
|
33
|
+
bundleOptions?: LegacyBundleOptions;
|
|
34
|
+
bundlelessOptions?: LegacyBundlelessOptions;
|
|
35
|
+
tsconfig?: string;
|
|
36
|
+
enableDts?: boolean;
|
|
37
|
+
dtsOnly?: boolean;
|
|
38
|
+
outputPath?: string;
|
|
39
|
+
};
|
|
40
|
+
export type LegacyBuildConfig = LegacyBaseBuildConfig | LegacyBaseBuildConfig[];
|
|
41
|
+
export type JsSyntaxType = 'CJS+ES6' | 'ESM+ES5' | 'ESM+ES6';
|
|
42
|
+
export interface PackageFields {
|
|
43
|
+
main?: JsSyntaxType;
|
|
44
|
+
'jsnext:modern'?: JsSyntaxType;
|
|
45
|
+
module?: JsSyntaxType;
|
|
46
|
+
}
|
|
47
|
+
export type OutputLegacyUserConfig = {
|
|
48
|
+
jsPath?: string;
|
|
49
|
+
path?: string;
|
|
50
|
+
copy?: Array<Record<string, unknown> & {
|
|
51
|
+
from: string;
|
|
52
|
+
}>;
|
|
53
|
+
disableTsChecker?: boolean;
|
|
54
|
+
/** @deprecated Use the `buildConfig.bundlelessOptions.static.path` instead . */
|
|
55
|
+
|
|
56
|
+
assetsPath?: string;
|
|
57
|
+
/** @deprecated Use the `buildConfig.sourceMap` instead */
|
|
58
|
+
|
|
59
|
+
disableSourceMap?: boolean;
|
|
60
|
+
buildPreset?: LegacyBuildPreset;
|
|
61
|
+
buildConfig?: LegacyBuildConfig;
|
|
62
|
+
importStyle?: 'source-code' | 'compiled-code';
|
|
63
|
+
packageMode?: 'universal-js' | 'universal-js-lite' | 'browser-js' | 'browser-js-lite' | 'node-js';
|
|
64
|
+
packageFields?: PackageFields;
|
|
65
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var output_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(output_exports);
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;AAAA;AAAA;","names":[],"sources":["../../../src/types/legacyConfig/output.ts"],"sourcesContent":["import type { UserConfig as LibuildUserConfig } from '@modern-js/libuild';\n\nexport type LegacyBuildPreset =\n | 'npm-library'\n | 'npm-library-with-umd'\n | 'npm-component'\n | 'npm-component-with-umd';\n\nexport type LegacyFormat = 'esm' | 'cjs' | 'umd';\nexport type LegacyTarget =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n // The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.\n | 'esnext';\nexport type LegacyBuildType = 'bundle' | 'bundleless';\nexport type LegacySourceMap = boolean | 'inline' | 'external';\n\nexport type LegacyBundleOptions = {\n entry?: Record<string, string>;\n platform?: LibuildUserConfig['platform'];\n splitting?: boolean;\n minify?: LibuildUserConfig['minify'];\n externals?: LibuildUserConfig['external'];\n skipDeps?: boolean;\n getModuleId?: (moduleName: string) => string | undefined;\n};\n\nexport type LegacyBundlelessOptions = {\n sourceDir?: string;\n style?: {\n compileMode?:\n | 'all'\n | 'only-compiled-code'\n | /* may be will be deprecated */ 'only-source-code'\n | false;\n path?: string;\n };\n static?: {\n path?: string;\n };\n};\n\nexport type LegacyBaseBuildConfig = {\n format?: LegacyFormat;\n target?: LegacyTarget;\n sourceMap?: LegacySourceMap;\n buildType?: LegacyBuildType;\n bundleOptions?: LegacyBundleOptions;\n bundlelessOptions?: LegacyBundlelessOptions;\n tsconfig?: string;\n enableDts?: boolean;\n dtsOnly?: boolean;\n outputPath?: string;\n};\n\nexport type LegacyBuildConfig = LegacyBaseBuildConfig | LegacyBaseBuildConfig[];\n\nexport type JsSyntaxType = 'CJS+ES6' | 'ESM+ES5' | 'ESM+ES6';\nexport interface PackageFields {\n main?: JsSyntaxType;\n 'jsnext:modern'?: JsSyntaxType;\n module?: JsSyntaxType;\n}\n\nexport type OutputLegacyUserConfig = {\n jsPath?: string;\n path?: string;\n copy?: Array<Record<string, unknown> & { from: string }>;\n disableTsChecker?: boolean;\n /** @deprecated Use the `buildConfig.bundlelessOptions.static.path` instead . */\n assetsPath?: string;\n /** @deprecated Use the `buildConfig.sourceMap` instead */\n disableSourceMap?: boolean;\n buildPreset?: LegacyBuildPreset;\n buildConfig?: LegacyBuildConfig;\n importStyle?: 'source-code' | 'compiled-code';\n packageMode?:\n | 'universal-js'\n | 'universal-js-lite'\n | 'browser-js'\n | 'browser-js-lite'\n | 'node-js';\n packageFields?: PackageFields;\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AliasOption } from '../config';
|
|
2
|
+
export type SourceLegacyUserConfig = {
|
|
3
|
+
alias?: AliasOption;
|
|
4
|
+
envVars?: Array<string>;
|
|
5
|
+
globalVars?: Record<string, string>;
|
|
6
|
+
jsxTransformRuntime?: 'automatic' | 'classic';
|
|
7
|
+
/**
|
|
8
|
+
* The configuration of `source.designSystem` is provided by `tailwindcss` plugin.
|
|
9
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
10
|
+
* @requires `tailwindcss` plugin
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
designSystem?: Record<string, any>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var source_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(source_exports);
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;AAAA;AAAA;","names":[],"sources":["../../../src/types/legacyConfig/source.ts"],"sourcesContent":["import type { AliasOption } from '../config';\n\nexport type SourceLegacyUserConfig = {\n alias?: AliasOption;\n envVars?: Array<string>;\n globalVars?: Record<string, string>;\n jsxTransformRuntime?: 'automatic' | 'classic';\n /**\n * The configuration of `source.designSystem` is provided by `tailwindcss` plugin.\n * Please use `yarn new` or `pnpm new` to enable the corresponding capability.\n * @requires `tailwindcss` plugin\n */\n designSystem?: Record<string, any>;\n};\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { JestConfig } from '@modern-js/core';
|
|
2
|
+
import type { AcceptedPlugin as PostCSSPlugin } from 'postcss';
|
|
3
|
+
import type { LessConfig, SassConfig } from '../config';
|
|
4
|
+
export type PostCSSOptions = {
|
|
5
|
+
to?: string;
|
|
6
|
+
from?: string;
|
|
7
|
+
map?: any;
|
|
8
|
+
syntax?: any;
|
|
9
|
+
parser?: any;
|
|
10
|
+
plugins?: PostCSSPlugin[];
|
|
11
|
+
stringifier?: any;
|
|
12
|
+
};
|
|
13
|
+
export type PostCSSLoaderOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* Enable PostCSS Parser support in CSS-in-JS. If you use JS styles the postcss-js parser, add the execute option.
|
|
16
|
+
*/
|
|
17
|
+
execute?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* By default generation of source maps depends on the devtool option. All values enable source map generation except eval and false value.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
sourceMap?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The special implementation option determines which implementation of PostCSS to use.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
implementation?: unknown;
|
|
28
|
+
/**
|
|
29
|
+
* Allows to set PostCSS options and plugins.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
postcssOptions?: PostCSSOptions;
|
|
33
|
+
};
|
|
34
|
+
export type PostCSSConfigUtils = {
|
|
35
|
+
addPlugins: (plugins: PostCSSPlugin | PostCSSPlugin[]) => void;
|
|
36
|
+
};
|
|
37
|
+
interface ToolsConfig {
|
|
38
|
+
speedy?: any | ((config: any) => any);
|
|
39
|
+
}
|
|
40
|
+
export type PostCSSFunction = (options: PostCSSLoaderOptions, utils: PostCSSConfigUtils) => PostCSSLoaderOptions | void;
|
|
41
|
+
export type ToolsLegacyUserConfig = {
|
|
42
|
+
babel: any;
|
|
43
|
+
less: LessConfig;
|
|
44
|
+
lodash: any;
|
|
45
|
+
postcss: PostCSSLoaderOptions | PostCSSFunction;
|
|
46
|
+
sass: SassConfig;
|
|
47
|
+
speedy: ToolsConfig['speedy'] | Array<NonNullable<ToolsConfig['speedy']>>;
|
|
48
|
+
/**
|
|
49
|
+
* The configuration of `tools.tailwindcss` is provided by `tailwindcss` plugin.
|
|
50
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
51
|
+
* @requires `tailwindcss` plugin
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
tailwindcss?: Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
|
|
55
|
+
jest?: JestConfig | ((jestConfig: JestConfig) => JestConfig);
|
|
56
|
+
};
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var tools_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(tools_exports);
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;;;;;;;;AAAA;AAAA;","names":[],"sources":["../../../src/types/legacyConfig/tools.ts"],"sourcesContent":["import type { JestConfig } from '@modern-js/core';\nimport type { AcceptedPlugin as PostCSSPlugin } from 'postcss';\nimport type { LessConfig, SassConfig } from '../config';\n\nexport type PostCSSOptions = {\n to?: string;\n from?: string;\n map?: any;\n syntax?: any;\n parser?: any;\n plugins?: PostCSSPlugin[];\n stringifier?: any;\n};\n\nexport type PostCSSLoaderOptions = {\n /**\n * Enable PostCSS Parser support in CSS-in-JS. If you use JS styles the postcss-js parser, add the execute option.\n */\n execute?: boolean;\n /**\n * By default generation of source maps depends on the devtool option. All values enable source map generation except eval and false value.\n */\n sourceMap?: boolean;\n /**\n * The special implementation option determines which implementation of PostCSS to use.\n */\n implementation?: unknown;\n /**\n * Allows to set PostCSS options and plugins.\n */\n postcssOptions?: PostCSSOptions;\n};\n\nexport type PostCSSConfigUtils = {\n addPlugins: (plugins: PostCSSPlugin | PostCSSPlugin[]) => void;\n};\n\ninterface ToolsConfig {\n speedy?: any | ((config: any) => any);\n}\n\nexport type PostCSSFunction = (\n options: PostCSSLoaderOptions,\n utils: PostCSSConfigUtils,\n) => PostCSSLoaderOptions | void;\n\nexport type ToolsLegacyUserConfig = {\n babel: any;\n less: LessConfig;\n lodash: any;\n postcss: PostCSSLoaderOptions | PostCSSFunction;\n sass: SassConfig;\n speedy: ToolsConfig['speedy'] | Array<NonNullable<ToolsConfig['speedy']>>;\n /**\n * The configuration of `tools.tailwindcss` is provided by `tailwindcss` plugin.\n * Please use `yarn new` or `pnpm new` to enable the corresponding capability.\n * @requires `tailwindcss` plugin\n */\n tailwindcss?:\n | Record<string, any>\n | ((options: Record<string, any>) => Record<string, any> | void);\n jest?: JestConfig | ((jestConfig: JestConfig) => JestConfig);\n};\n"]}
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ModuleContext } from '../types';
|
|
2
|
-
import type { BaseBuildConfig, PartialBuildConfig, PartialBaseBuildConfig, DTSOptions } from '../types
|
|
2
|
+
import type { BaseBuildConfig, PartialBuildConfig, PartialBaseBuildConfig, DTSOptions, ModuleLegacyUserConfig } from '../types';
|
|
3
3
|
export declare const validPartialBuildConfig: (config: PartialBuildConfig) => void;
|
|
4
4
|
export declare const validBuildTypeAndFormat: (config: PartialBaseBuildConfig) => void;
|
|
5
5
|
export declare const mergeDefaultBaseConfig: (pConfig: PartialBaseBuildConfig, context: ModuleContext) => Promise<BaseBuildConfig>;
|
|
6
|
-
export declare const getDtsConfig: (userDTS: PartialBaseBuildConfig['dts'], defaultDTS: Required<DTSOptions>) => Promise<false | Required<DTSOptions>>;
|
|
6
|
+
export declare const getDtsConfig: (userDTS: PartialBaseBuildConfig['dts'], defaultDTS: Required<DTSOptions>) => Promise<false | Required<DTSOptions>>;
|
|
7
|
+
export declare const isLegacyUserConfig: (config: {
|
|
8
|
+
legacy?: boolean;
|
|
9
|
+
}) => config is ModuleLegacyUserConfig;
|
package/dist/utils/config.js
CHANGED
|
@@ -61,6 +61,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
61
61
|
var config_exports = {};
|
|
62
62
|
__export(config_exports, {
|
|
63
63
|
getDtsConfig: () => getDtsConfig,
|
|
64
|
+
isLegacyUserConfig: () => isLegacyUserConfig,
|
|
64
65
|
mergeDefaultBaseConfig: () => mergeDefaultBaseConfig,
|
|
65
66
|
validBuildTypeAndFormat: () => validBuildTypeAndFormat,
|
|
66
67
|
validPartialBuildConfig: () => validPartialBuildConfig
|
|
@@ -84,7 +85,7 @@ const validBuildTypeAndFormat = (config) => {
|
|
|
84
85
|
}
|
|
85
86
|
};
|
|
86
87
|
const mergeDefaultBaseConfig = (pConfig, context) => __async(void 0, null, function* () {
|
|
87
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
88
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
88
89
|
const { defaultBuildConfig: defaultConfig } = yield Promise.resolve().then(() => __toESM(require("../constants/build")));
|
|
89
90
|
const { cloneDeep } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils/lodash")));
|
|
90
91
|
const { applyOptionsChain, ensureAbsolutePath, slash } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
@@ -111,8 +112,9 @@ const mergeDefaultBaseConfig = (pConfig, context) => __async(void 0, null, funct
|
|
|
111
112
|
const styleConfig = yield getStyleConfig(pConfig);
|
|
112
113
|
const buildType = (_a = pConfig.buildType) != null ? _a : defaultConfig.buildType;
|
|
113
114
|
const sourceDir = (_b = pConfig.sourceDir) != null ? _b : defaultConfig.sourceDir;
|
|
115
|
+
const metafile = (_c = pConfig.metafile) != null ? _c : defaultConfig.metafile;
|
|
114
116
|
const input = buildType === "bundle" ? yield getDefaultIndexEntry(context) : [sourceDir];
|
|
115
|
-
const userDefine = (
|
|
117
|
+
const userDefine = (_d = pConfig.define) != null ? _d : {};
|
|
116
118
|
const define = __spreadValues(__spreadValues({}, defaultConfig.define), Object.keys(userDefine).reduce((memo, name) => {
|
|
117
119
|
memo[name] = JSON.stringify(userDefine[name]);
|
|
118
120
|
return memo;
|
|
@@ -120,28 +122,29 @@ const mergeDefaultBaseConfig = (pConfig, context) => __async(void 0, null, funct
|
|
|
120
122
|
return {
|
|
121
123
|
asset: __spreadValues(__spreadValues({}, defaultConfig.asset), pConfig.asset),
|
|
122
124
|
buildType,
|
|
123
|
-
format: (
|
|
124
|
-
target: (
|
|
125
|
-
sourceMap: (
|
|
126
|
-
copy: (
|
|
127
|
-
outDir: (
|
|
125
|
+
format: (_e = pConfig.format) != null ? _e : defaultConfig.format,
|
|
126
|
+
target: (_f = pConfig.target) != null ? _f : defaultConfig.target,
|
|
127
|
+
sourceMap: (_g = pConfig.sourceMap) != null ? _g : defaultConfig.sourceMap,
|
|
128
|
+
copy: (_h = pConfig.copy) != null ? _h : cloneDeep(defaultConfig.copy),
|
|
129
|
+
outDir: (_i = pConfig.outDir) != null ? _i : defaultConfig.outDir,
|
|
128
130
|
dts: yield getDtsConfig(pConfig.dts, defaultConfig.dts),
|
|
129
|
-
jsx: (
|
|
130
|
-
input: (
|
|
131
|
-
platform: (
|
|
132
|
-
splitting: (
|
|
133
|
-
minify: (
|
|
134
|
-
autoExternal: (
|
|
131
|
+
jsx: (_j = pConfig.jsx) != null ? _j : defaultConfig.jsx,
|
|
132
|
+
input: (_k = pConfig.input) != null ? _k : cloneDeep(input),
|
|
133
|
+
platform: (_l = pConfig.platform) != null ? _l : defaultConfig.platform,
|
|
134
|
+
splitting: (_m = pConfig.splitting) != null ? _m : defaultConfig.splitting,
|
|
135
|
+
minify: (_n = pConfig.minify) != null ? _n : defaultConfig.minify,
|
|
136
|
+
autoExternal: (_o = pConfig.autoExternal) != null ? _o : defaultConfig.autoExternal,
|
|
135
137
|
umdGlobals: __spreadValues(__spreadValues({}, defaultConfig.umdGlobals), pConfig.umdGlobals),
|
|
136
|
-
umdModuleName: (
|
|
137
|
-
externals: (
|
|
138
|
+
umdModuleName: (_p = pConfig.umdModuleName) != null ? _p : defaultConfig.umdModuleName,
|
|
139
|
+
externals: (_q = pConfig.externals) != null ? _q : defaultConfig.externals,
|
|
138
140
|
sourceDir,
|
|
139
141
|
alias,
|
|
140
142
|
define,
|
|
143
|
+
metafile,
|
|
141
144
|
style: __spreadProps(__spreadValues({}, styleConfig), {
|
|
142
|
-
inject: (
|
|
143
|
-
modules: (
|
|
144
|
-
autoModules: (
|
|
145
|
+
inject: (_s = (_r = pConfig.style) == null ? void 0 : _r.inject) != null ? _s : defaultConfig.style.inject,
|
|
146
|
+
modules: (_u = (_t = pConfig.style) == null ? void 0 : _t.modules) != null ? _u : defaultConfig.style.modules,
|
|
147
|
+
autoModules: (_w = (_v = pConfig.style) == null ? void 0 : _v.autoModules) != null ? _w : defaultConfig.style.autoModules,
|
|
145
148
|
tailwindCss: defaultConfig.style.tailwindCss
|
|
146
149
|
})
|
|
147
150
|
};
|
|
@@ -156,9 +159,11 @@ const getDtsConfig = (userDTS, defaultDTS) => __async(void 0, null, function* ()
|
|
|
156
159
|
}
|
|
157
160
|
return userDTS;
|
|
158
161
|
});
|
|
162
|
+
const isLegacyUserConfig = (config) => Boolean(config.legacy);
|
|
159
163
|
// Annotate the CommonJS export names for ESM import in node:
|
|
160
164
|
0 && (module.exports = {
|
|
161
165
|
getDtsConfig,
|
|
166
|
+
isLegacyUserConfig,
|
|
162
167
|
mergeDefaultBaseConfig,
|
|
163
168
|
validBuildTypeAndFormat,
|
|
164
169
|
validPartialBuildConfig
|
package/dist/utils/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"file":null,"mappings":"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","names":["value"],"sources":["../../src/utils/config.ts"],"sourcesContent":["import { ModuleContext } from '../types';\nimport type {\n BaseBuildConfig,\n PartialBuildConfig,\n PartialBaseBuildConfig,\n DTSOptions,\n ModuleLegacyUserConfig,\n} from '../types';\n\nexport const validPartialBuildConfig = (config: PartialBuildConfig) => {\n if (Array.isArray(config)) {\n for (const c of config) {\n validBuildTypeAndFormat(c);\n }\n } else {\n validBuildTypeAndFormat(config);\n }\n};\n\nexport const validBuildTypeAndFormat = (config: PartialBaseBuildConfig) => {\n if (\n config.buildType === 'bundleless' &&\n ['iife', 'umd'].includes(config.format ?? '')\n ) {\n throw new Error(\n `when buildType is bundleless, the format must be equal to one of the allowed values: (cjs, esm)`,\n );\n }\n};\n\nexport const mergeDefaultBaseConfig = async (\n pConfig: PartialBaseBuildConfig,\n context: ModuleContext,\n): Promise<BaseBuildConfig> => {\n const { defaultBuildConfig: defaultConfig } = await import(\n '../constants/build'\n );\n const { cloneDeep } = await import('@modern-js/utils/lodash');\n const { applyOptionsChain, ensureAbsolutePath, slash } = await import(\n '@modern-js/utils'\n );\n const { getDefaultIndexEntry } = await import('./input');\n const { getStyleConfig } = await import('./style');\n const defaultAlias = {\n '@': context.srcDirectory,\n };\n const mergedAlias = applyOptionsChain(defaultAlias, pConfig.alias);\n\n /**\n * Format alias value:\n * - Relative paths need to be turned into absolute paths.\n * - Absolute paths or a package name are not processed.\n */\n const alias = Object.keys(mergedAlias).reduce<Record<string, string>>(\n (prev, name) => {\n const formattedValue = (value: string) => {\n if (typeof value === 'string' && value.startsWith('.')) {\n return slash(ensureAbsolutePath(context.appDirectory, value));\n }\n return value;\n };\n const value = formattedValue(mergedAlias[name]);\n\n prev[name] = value;\n return prev;\n },\n {},\n );\n\n const styleConfig = await getStyleConfig(pConfig);\n const buildType = pConfig.buildType ?? defaultConfig.buildType;\n const sourceDir = pConfig.sourceDir ?? defaultConfig.sourceDir;\n const metafile = pConfig.metafile ?? defaultConfig.metafile;\n const input =\n buildType === 'bundle' ? await getDefaultIndexEntry(context) : [sourceDir];\n const userDefine = pConfig.define ?? {};\n const define = {\n ...defaultConfig.define,\n ...Object.keys(userDefine).reduce<Record<string, string>>((memo, name) => {\n memo[name] = JSON.stringify(userDefine[name]!);\n return memo;\n }, {}),\n };\n return {\n asset: {\n ...defaultConfig.asset,\n ...pConfig.asset,\n },\n buildType,\n format: pConfig.format ?? defaultConfig.format,\n target: pConfig.target ?? defaultConfig.target,\n sourceMap: pConfig.sourceMap ?? defaultConfig.sourceMap,\n copy: pConfig.copy ?? cloneDeep(defaultConfig.copy),\n outDir: pConfig.outDir ?? defaultConfig.outDir,\n dts: await getDtsConfig(pConfig.dts, defaultConfig.dts as DTSOptions),\n jsx: pConfig.jsx ?? defaultConfig.jsx,\n input: pConfig.input ?? cloneDeep(input),\n platform: pConfig.platform ?? defaultConfig.platform,\n splitting: pConfig.splitting ?? defaultConfig.splitting,\n minify: pConfig.minify ?? defaultConfig.minify,\n autoExternal: pConfig.autoExternal ?? defaultConfig.autoExternal,\n umdGlobals: {\n ...defaultConfig.umdGlobals,\n ...pConfig.umdGlobals,\n },\n umdModuleName: pConfig.umdModuleName ?? defaultConfig.umdModuleName,\n externals: pConfig.externals ?? defaultConfig.externals,\n sourceDir,\n alias,\n define,\n metafile,\n style: {\n ...styleConfig,\n inject: pConfig.style?.inject ?? defaultConfig.style.inject,\n modules: pConfig.style?.modules ?? defaultConfig.style.modules,\n autoModules:\n pConfig.style?.autoModules ?? defaultConfig.style.autoModules,\n tailwindCss: defaultConfig.style.tailwindCss,\n },\n };\n};\n\nexport const getDtsConfig = async (\n userDTS: PartialBaseBuildConfig['dts'],\n defaultDTS: Required<DTSOptions>,\n) => {\n const { cloneDeep, isUndefined, isObject } = await import(\n '@modern-js/utils/lodash'\n );\n\n if (isUndefined(userDTS)) {\n return cloneDeep(defaultDTS);\n }\n\n if (isObject(userDTS)) {\n return {\n ...defaultDTS,\n ...userDTS,\n };\n }\n\n return userDTS;\n};\n\nexport const isLegacyUserConfig = (config: {\n legacy?: boolean;\n}): config is ModuleLegacyUserConfig => Boolean(config.legacy);\n"]}
|