mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
chore: 更改构建器名称 build > builder
This commit is contained in:
parent
70a69fb7c3
commit
dea44fd938
@ -4,8 +4,8 @@ module.exports = {
|
|||||||
'fes',
|
'fes',
|
||||||
'fes-compiler',
|
'fes-compiler',
|
||||||
'fes-preset-built-in',
|
'fes-preset-built-in',
|
||||||
'fes-build-vite',
|
'fes-builder-vite',
|
||||||
'fes-build-webpack',
|
'fes-builder-webpack',
|
||||||
'fes-runtime',
|
'fes-runtime',
|
||||||
'fes-utils',
|
'fes-utils',
|
||||||
'fes-plugin-access',
|
'fes-plugin-access',
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
"@fesjs/fes": "^2.0.0",
|
"@fesjs/fes": "^2.0.0",
|
||||||
"@fesjs/plugin-icon": "^2.0.0",
|
"@fesjs/plugin-icon": "^2.0.0",
|
||||||
"@fesjs/plugin-request": "^2.0.0",
|
"@fesjs/plugin-request": "^2.0.0",
|
||||||
"@fesjs/build-webpack": "^1.0.0",
|
"@fesjs/builder-webpack": "^1.0.0",
|
||||||
"vue": "^3.2.6",
|
"vue": "^3.2.6",
|
||||||
"core-js": "^3.8.3"
|
"core-js": "^3.8.3"
|
||||||
},
|
},
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
"@fesjs/plugin-model": "^2.0.0",
|
"@fesjs/plugin-model": "^2.0.0",
|
||||||
"@fesjs/plugin-enums": "^2.0.0",
|
"@fesjs/plugin-enums": "^2.0.0",
|
||||||
"@fesjs/fes-design": "^0.4.0",
|
"@fesjs/fes-design": "^0.4.0",
|
||||||
"@fesjs/build-webpack": "^1.0.0",
|
"@fesjs/builder-webpack": "^1.0.0",
|
||||||
"vue": "^3.2.6",
|
"vue": "^3.2.6",
|
||||||
"core-js": "^3.8.3"
|
"core-js": "^3.8.3"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
import { winPath } from '@fesjs/utils';
|
|
||||||
import { dirname } from 'path';
|
|
||||||
|
|
||||||
export const runtimePath = winPath(
|
|
||||||
dirname(require.resolve('@fesjs/runtime/package.json'))
|
|
||||||
);
|
|
@ -1,60 +0,0 @@
|
|||||||
import { lodash, winPath } from '@fesjs/utils';
|
|
||||||
import assert from 'assert';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
const reserveLibrarys = ['fes']; // reserve library
|
|
||||||
// todo 插件导出内容冲突问题待解决
|
|
||||||
const reserveExportsNames = [
|
|
||||||
'Link',
|
|
||||||
'NavLink',
|
|
||||||
'Redirect',
|
|
||||||
'dynamic',
|
|
||||||
'withRouter',
|
|
||||||
'Route'
|
|
||||||
];
|
|
||||||
|
|
||||||
export default function generateExports(basePath, { item, fesExportsHook }) {
|
|
||||||
assert(item.source, 'source should be supplied.');
|
|
||||||
const source = path.relative(path.basename(basePath), item.source);
|
|
||||||
assert(
|
|
||||||
item.exportAll || item.specifiers,
|
|
||||||
'exportAll or specifiers should be supplied.'
|
|
||||||
);
|
|
||||||
assert(
|
|
||||||
!reserveLibrarys.includes(source),
|
|
||||||
`${source} is reserve library, Please don't use it.`
|
|
||||||
);
|
|
||||||
if (item.exportAll) {
|
|
||||||
return `export * from '${winPath(source)}';`;
|
|
||||||
}
|
|
||||||
assert(
|
|
||||||
Array.isArray(item.specifiers),
|
|
||||||
`specifiers should be Array, but got ${item.specifiers.toString()}.`
|
|
||||||
);
|
|
||||||
const specifiersStrArr = item.specifiers.map((specifier) => {
|
|
||||||
if (typeof specifier === 'string') {
|
|
||||||
assert(
|
|
||||||
!reserveExportsNames.includes(specifier),
|
|
||||||
`${specifier} is reserve name, you can use 'exported' to set alias.`
|
|
||||||
);
|
|
||||||
assert(
|
|
||||||
!fesExportsHook[specifier],
|
|
||||||
`${specifier} is Defined, you can use 'exported' to set alias.`
|
|
||||||
);
|
|
||||||
fesExportsHook[specifier] = true;
|
|
||||||
return specifier;
|
|
||||||
}
|
|
||||||
assert(
|
|
||||||
lodash.isPlainObject(specifier),
|
|
||||||
`Configure item context should be Plain Object, but got ${specifier}.`
|
|
||||||
);
|
|
||||||
assert(
|
|
||||||
specifier.local && specifier.exported,
|
|
||||||
'local and exported should be supplied.'
|
|
||||||
);
|
|
||||||
return `${specifier.local} as ${specifier.exported}`;
|
|
||||||
});
|
|
||||||
return `export { ${specifiersStrArr.join(', ')} } from '${winPath(
|
|
||||||
source
|
|
||||||
)}';`;
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/build-vite",
|
"name": "@fesjs/builder-vite",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "@fesjs/build-vite",
|
"description": "@fesjs/builder-vite",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
@ -9,7 +9,7 @@
|
|||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
|
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
|
||||||
"directory": "packages/fes-build-vite"
|
"directory": "packages/fes-builder-vite"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"fes"
|
"fes"
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/build-webpack",
|
"name": "@fesjs/builder-webpack",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "@fesjs/build-webpack",
|
"description": "@fesjs/builder-webpack",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
@ -10,7 +10,7 @@
|
|||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
|
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
|
||||||
"directory": "packages/fes-build-webpack"
|
"directory": "packages/fes-builder-webpack"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"fes"
|
"fes"
|
@ -7,7 +7,7 @@ import { relative } from 'path';
|
|||||||
import { existsSync } from 'fs';
|
import { existsSync } from 'fs';
|
||||||
import { Logger } from '@fesjs/compiler';
|
import { Logger } from '@fesjs/compiler';
|
||||||
|
|
||||||
const logger = new Logger('fes:build-webpack');
|
const logger = new Logger('fes:builder-webpack');
|
||||||
|
|
||||||
export default function (api) {
|
export default function (api) {
|
||||||
const {
|
const {
|
@ -1,6 +1,6 @@
|
|||||||
import { Logger } from '@fesjs/compiler';
|
import { Logger } from '@fesjs/compiler';
|
||||||
|
|
||||||
const logger = new Logger('fes:build-webpack');
|
const logger = new Logger('fes:builder-webpack');
|
||||||
|
|
||||||
export default (api) => {
|
export default (api) => {
|
||||||
const {
|
const {
|
4
packages/fes-builder-webpack/src/utils/constants.js
Normal file
4
packages/fes-builder-webpack/src/utils/constants.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import { winPath } from '@fesjs/utils';
|
||||||
|
import { dirname } from 'path';
|
||||||
|
|
||||||
|
export const runtimePath = winPath(dirname(require.resolve('@fesjs/runtime/package.json')));
|
30
packages/fes-builder-webpack/src/utils/generateExports.js
Normal file
30
packages/fes-builder-webpack/src/utils/generateExports.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { lodash, winPath } from '@fesjs/utils';
|
||||||
|
import assert from 'assert';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
const reserveLibrarys = ['fes']; // reserve library
|
||||||
|
// todo 插件导出内容冲突问题待解决
|
||||||
|
const reserveExportsNames = ['Link', 'NavLink', 'Redirect', 'dynamic', 'withRouter', 'Route'];
|
||||||
|
|
||||||
|
export default function generateExports(basePath, { item, fesExportsHook }) {
|
||||||
|
assert(item.source, 'source should be supplied.');
|
||||||
|
const source = path.relative(path.basename(basePath), item.source);
|
||||||
|
assert(item.exportAll || item.specifiers, 'exportAll or specifiers should be supplied.');
|
||||||
|
assert(!reserveLibrarys.includes(source), `${source} is reserve library, Please don't use it.`);
|
||||||
|
if (item.exportAll) {
|
||||||
|
return `export * from '${winPath(source)}';`;
|
||||||
|
}
|
||||||
|
assert(Array.isArray(item.specifiers), `specifiers should be Array, but got ${item.specifiers.toString()}.`);
|
||||||
|
const specifiersStrArr = item.specifiers.map((specifier) => {
|
||||||
|
if (typeof specifier === 'string') {
|
||||||
|
assert(!reserveExportsNames.includes(specifier), `${specifier} is reserve name, you can use 'exported' to set alias.`);
|
||||||
|
assert(!fesExportsHook[specifier], `${specifier} is Defined, you can use 'exported' to set alias.`);
|
||||||
|
fesExportsHook[specifier] = true;
|
||||||
|
return specifier;
|
||||||
|
}
|
||||||
|
assert(lodash.isPlainObject(specifier), `Configure item context should be Plain Object, but got ${specifier}.`);
|
||||||
|
assert(specifier.local && specifier.exported, 'local and exported should be supplied.');
|
||||||
|
return `${specifier.local} as ${specifier.exported}`;
|
||||||
|
});
|
||||||
|
return `export { ${specifiersStrArr.join(', ')} } from '${winPath(source)}';`;
|
||||||
|
}
|
@ -5,7 +5,7 @@ import { PluginType } from '../enums';
|
|||||||
|
|
||||||
const RE = {
|
const RE = {
|
||||||
[PluginType.plugin]: /^(@fesjs\/|@webank\/fes-|fes-)plugin-/,
|
[PluginType.plugin]: /^(@fesjs\/|@webank\/fes-|fes-)plugin-/,
|
||||||
[PluginType.preset]: /^(@fesjs\/|@webank\/fes-|fes-)(preset|build)-/,
|
[PluginType.preset]: /^(@fesjs\/|@webank\/fes-|fes-)(preset|builder)-/,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function isPluginOrPreset(type, name) {
|
export function isPluginOrPreset(type, name) {
|
||||||
@ -120,10 +120,10 @@ export function resolvePresets(opts) {
|
|||||||
if (b.id === '@fesjs/preset-built-in') {
|
if (b.id === '@fesjs/preset-built-in') {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (/^(@fesjs\/|@webank\/fes-|fes-)build-/.test(a.id)) {
|
if (/^(@fesjs\/|@webank\/fes-|fes-)builder-/.test(a.id)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (/^(@fesjs\/|@webank\/fes-|fes-)build-/.test(b.id)) {
|
if (/^(@fesjs\/|@webank\/fes-|fes-)builder-/.test(b.id)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fesjs/fes": "^2.0.0",
|
"@fesjs/fes": "^2.0.0",
|
||||||
"@fesjs/build-webpack": "^1.0.0",
|
"@fesjs/builder-webpack": "^1.0.0",
|
||||||
"vue": "^3.0.5",
|
"vue": "^3.0.5",
|
||||||
"@fesjs/fes-design": "^0.1.10"
|
"@fesjs/fes-design": "^0.1.10"
|
||||||
},
|
},
|
||||||
|
@ -41,6 +41,6 @@ export default {
|
|||||||
require.resolve('../../../fes-plugin-qiankun/lib'),
|
require.resolve('../../../fes-plugin-qiankun/lib'),
|
||||||
],
|
],
|
||||||
presets: [
|
presets: [
|
||||||
require.resolve('../../../fes-build-vite/lib'),
|
require.resolve('../../../fes-builder-vite/lib'),
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
@ -39,6 +39,6 @@ export default {
|
|||||||
require.resolve('../../../fes-plugin-qiankun/lib'),
|
require.resolve('../../../fes-plugin-qiankun/lib'),
|
||||||
],
|
],
|
||||||
presets: [
|
presets: [
|
||||||
require.resolve('../../../fes-build-webpack/lib'),
|
require.resolve('../../../fes-builder-webpack/lib'),
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
"@fesjs/fes": "^2.0.0",
|
"@fesjs/fes": "^2.0.0",
|
||||||
"@fesjs/plugin-icon": "^2.0.0",
|
"@fesjs/plugin-icon": "^2.0.0",
|
||||||
"@fesjs/plugin-request": "^2.0.0",
|
"@fesjs/plugin-request": "^2.0.0",
|
||||||
"@fesjs/build-webpack": "^1.0.0",
|
"@fesjs/builder-webpack": "^1.0.0",
|
||||||
"vue": "^3.2.2"
|
"vue": "^3.2.2"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
"@fesjs/plugin-windicss": "^2.0.0",
|
"@fesjs/plugin-windicss": "^2.0.0",
|
||||||
"@fesjs/plugin-pinia": "^2.0.0",
|
"@fesjs/plugin-pinia": "^2.0.0",
|
||||||
"@fesjs/fes-design": "^0.3.3",
|
"@fesjs/fes-design": "^0.3.3",
|
||||||
"@fesjs/build-vite": "^1.0.0",
|
"@fesjs/builder-vite": "^1.0.0",
|
||||||
"vue": "^3.0.5",
|
"vue": "^3.0.5",
|
||||||
"vuex": "^4.0.0",
|
"vuex": "^4.0.0",
|
||||||
"pinia": "^2.0.11"
|
"pinia": "^2.0.11"
|
||||||
|
@ -93,6 +93,6 @@ export default {
|
|||||||
languages: ['javascript', 'typescript', 'html', 'json']
|
languages: ['javascript', 'typescript', 'html', 'json']
|
||||||
},
|
},
|
||||||
presets: [
|
presets: [
|
||||||
require.resolve('../fes-build-webpack/lib'),
|
require.resolve('../fes-builder-webpack/lib'),
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user