提交 67fda1e5 编写于 作者: fxy060608's avatar fxy060608

chore: scripts/build

上级 799b9dd0
......@@ -2,9 +2,6 @@
"private": true,
"name": "@dcloudio/size-check",
"version": "3.0.0-alpha-3000020210611006",
"buildOptions": {
"bundler": "vite"
},
"dependencies": {
"vue-router": "^4.0.8"
}
......
import { ComponentInternalInstance } from 'vue';
import { ref } from 'vue';
import { shallowRef } from 'vue';
export declare function getSsrGlobalData(): any;
export declare const onAddToFavorites: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onBackPress: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onError: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onHide: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onLaunch: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarButtonTap: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputChanged: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputClicked: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputConfirmed: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputFocusChanged: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onPageNotFound: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onPageScroll: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onPullDownRefresh: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onReachBottom: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onReady: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onResize: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onShareAppMessage: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onShareTimeline: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onShow: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onTabItemTap: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onThemeChange: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onUnhandledRejection: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onUnload: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare function resolveEasycom(component: unknown, easycom: unknown): unknown;
export declare const shallowSsrRef: SSRRef;
declare type SSRRef = (value: unknown, key?: string, shallow?: boolean) => ReturnType<typeof ref> | ReturnType<typeof shallowRef>;
export declare const ssrRef: SSRRef;
export { }
......@@ -9,9 +9,6 @@
"dist/**/*.d.ts",
"lib"
],
"buildOptions": {
"bundler": "tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
......
......@@ -8,9 +8,6 @@
"dist/**/*.js",
"dist/**/*.d.ts"
],
"buildOptions": {
"bundler": "tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
......
......@@ -10,9 +10,6 @@
"style"
],
"sideEffects": false,
"buildOptions": {
"bundler": "vite"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
......
export declare type BuiltInLocale = typeof LOCALE_ZH_HANS | typeof LOCALE_ZH_HANT | typeof LOCALE_EN | typeof LOCALE_FR | typeof LOCALE_ES;
export declare interface Formatter {
interpolate: (message: string, values?: Record<string, unknown> | Array<unknown>) => Array<unknown>;
}
export declare class I18n {
private locale;
private fallbackLocale;
private message;
private messages;
private watchers;
private formater;
constructor({ locale, fallbackLocale, messages, watcher, formater, }: I18nOptions);
setLocale(locale: string): void;
getLocale(): BuiltInLocale;
watchLocale(fn: LocaleWatcher): () => void;
add(locale: BuiltInLocale, message: Record<string, string>): void;
t(key: string, values?: Record<string, unknown> | Array<unknown> | BuiltInLocale): string;
t(key: string, locale?: BuiltInLocale, values?: Record<string, unknown> | Array<unknown>): string;
}
export declare interface I18nOptions {
locale: BuiltInLocale;
fallbackLocale?: BuiltInLocale;
messages?: LocaleMessages;
formater?: Formatter;
watcher?: LocaleWatcher;
}
export declare function initVueI18n(locale?: BuiltInLocale, messages?: LocaleMessages, fallbackLocale?: BuiltInLocale): {
i18n: I18n;
t(key: string, values?: Record<string, unknown> | unknown[] | undefined): string;
add(locale: BuiltInLocale, message: Record<string, string>): void;
getLocale(): BuiltInLocale;
setLocale(newLocale: BuiltInLocale): void;
};
export declare const LOCALE_EN = "en";
export declare const LOCALE_ES = "es";
export declare const LOCALE_FR = "fr";
export declare const LOCALE_ZH_HANS = "zh-Hans";
export declare const LOCALE_ZH_HANT = "zh-Hant";
export declare type LocaleMessages = {
[name in BuiltInLocale]?: Record<string, string>;
};
export declare type LocaleWatcher = (newLocale: BuiltInLocale, oldLocale: BuiltInLocale) => void;
export { }
......@@ -7,12 +7,6 @@
"files": [
"dist"
],
"buildOptions": {
"name": "Vue",
"formats": [
"esm-bundler-vue"
]
},
"sideEffects": false,
"repository": {
"type": "git",
......
......@@ -12,9 +12,6 @@
"dist/**/*.d.ts",
"lib"
],
"buildOptions": {
"bundler": "tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
......
......@@ -9,7 +9,7 @@ const { targets: allTargets, fuzzyMatchTarget } = require('./utils')
const args = require('minimist')(process.argv.slice(2))
const targets = args._
const formats = args.formats || args.f
// const formats = args.formats || args.f
const devOnly = args.devOnly || args.d
const isRelease = args.release
const buildTypes = args.t || args.types || isRelease
......@@ -40,22 +40,29 @@ async function build(target) {
if (isRelease && pkg.private) {
return
}
const tsconfigJsonPath = path.resolve(pkgDir, 'tsconfig.json')
let hasTscBundler = false
const hasViteBundler = fs.existsSync(path.resolve(pkgDir, 'vite.config.ts'))
if (fs.existsSync(tsconfigJsonPath)) {
const tsconfigJson = require(tsconfigJsonPath)
if (
tsconfigJson.extends &&
tsconfigJson.extends.includes('tsconfig.node.json')
) {
hasTscBundler = true
}
}
const hasRollupBundler = fs.existsSync(path.resolve(pkgDir, 'build.json'))
const bundler = pkg.buildOptions && pkg.buildOptions.bundler
const types =
target === 'uni-shared' ||
target === 'uni-i18n' ||
target === 'uni-app' ||
target === 'uni-cli-shared' ||
(buildTypes && pkg.types)
const types = target.endsWith('-shared') || (buildTypes && pkg.types)
// if building a specific format, do not remove dist.
if (!formats && bundler !== 'vite') {
await fs.remove(`${pkgDir}/dist`)
}
// if (!formats && bundler !== 'vite') {
await fs.remove(`${pkgDir}/dist`)
// }
const env = devOnly ? 'development' : 'production'
if (bundler === 'vite') {
if (hasViteBundler) {
await execa(
'vite',
['build', '--config', path.resolve(pkgDir, 'vite.config.ts')],
......@@ -64,18 +71,18 @@ async function build(target) {
env: Object.assign({ FORMAT: 'es' }, process.env),
}
)
if (target === 'size-check') {
return
if (target === 'uni-h5') {
await execa(
'vite',
['build', '--config', path.resolve(pkgDir, 'vite.config.ts')],
{
stdio: 'inherit',
env: Object.assign({ FORMAT: 'cjs' }, process.env),
}
)
}
return await execa(
'vite',
['build', '--config', path.resolve(pkgDir, 'vite.config.ts')],
{
stdio: 'inherit',
env: Object.assign({ FORMAT: 'cjs' }, process.env),
}
)
} else if (bundler === 'tsc') {
}
if (hasTscBundler) {
const args = [
'--listEmittedFiles',
'-p',
......@@ -84,23 +91,24 @@ async function build(target) {
if (types) {
args.push('--declaration')
}
return await execa('tsc', args, {
await execa('tsc', args, {
stdio: 'inherit',
})
}
await execa(
'rollup',
[
'-c',
'--environment',
[`NODE_ENV:${env}`, types ? `TYPES:true` : ``, `TARGET:${target}`]
.filter(Boolean)
.join(','),
],
{ stdio: 'inherit' }
)
if (types) {
await extract(target)
if (hasRollupBundler) {
await execa(
'rollup',
[
'-c',
'--environment',
[`NODE_ENV:${env}`, types ? `TYPES:true` : ``, `TARGET:${target}`]
.filter(Boolean)
.join(','),
],
{ stdio: 'inherit' }
)
if (types) {
await extract(target)
}
}
}
......@@ -15,8 +15,8 @@ const priority = {
'uni-quickapp-webview': 70,
'uni-cli-shared': 60,
'uni-h5': 50,
'uni-h5-vue': 40,
'uni-h5-vite': 40,
'uni-app-vue': 35,
'uni-app-plus': 30,
'uni-app-vite': 30,
'vite-plugin-uni': 20,
......@@ -30,9 +30,10 @@ const targets = (exports.targets = fs.readdirSync('packages').filter((f) => {
try {
return (
fs.existsSync(path.resolve(__dirname, `../packages/${f}/build.json`)) ||
fs.existsSync(path.resolve(__dirname, `../packages/${f}/build.js`)) ||
!!require(path.resolve(__dirname, `../packages/${f}/package.json`))
.buildOptions
fs.existsSync(
path.resolve(__dirname, `../packages/${f}/vite.config.ts`)
) ||
fs.existsSync(path.resolve(__dirname, `../packages/${f}/tsconfig.json`))
)
} catch (e) {}
return false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册