@deot/dev-builder 2.0.0 → 2.0.1
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/package.json +3 -2
- package/shared.config.ts +55 -0
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deot/dev-builder",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"main": "dist/index.es.js",
|
|
5
5
|
"module": "dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
|
-
"api-extractor.shared.json"
|
|
10
|
+
"api-extractor.shared.json",
|
|
11
|
+
"shared.config.ts"
|
|
11
12
|
],
|
|
12
13
|
"license": "MIT",
|
|
13
14
|
"publishConfig": {
|
package/shared.config.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import atImport from "postcss-import";
|
|
4
|
+
import atUrl from "postcss-url";
|
|
5
|
+
import flexBugs from "postcss-flexbugs-fixes";
|
|
6
|
+
import cssnano from "cssnano";
|
|
7
|
+
import autoprefixer from "autoprefixer";
|
|
8
|
+
|
|
9
|
+
// options
|
|
10
|
+
const buildOptions = JSON.parse(decodeURIComponent(process.env.BUILD_OPTIONS || '{}'));
|
|
11
|
+
|
|
12
|
+
const { files = [], packageName, packageDir, packageOptions = {} } = buildOptions;
|
|
13
|
+
|
|
14
|
+
const external = Object
|
|
15
|
+
.keys({
|
|
16
|
+
...packageOptions.dependencies,
|
|
17
|
+
...packageOptions.peerDependencies
|
|
18
|
+
})
|
|
19
|
+
.map(i => new RegExp(`^${i}$`));
|
|
20
|
+
|
|
21
|
+
export default defineConfig({
|
|
22
|
+
plugins: [],
|
|
23
|
+
logLevel: 'silent',
|
|
24
|
+
css: {
|
|
25
|
+
postcss: {
|
|
26
|
+
plugins: [
|
|
27
|
+
atImport(),
|
|
28
|
+
atUrl(),
|
|
29
|
+
flexBugs(),
|
|
30
|
+
cssnano(),
|
|
31
|
+
autoprefixer({ remove: false })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
build: {
|
|
36
|
+
minify: false,
|
|
37
|
+
target: 'esnext',
|
|
38
|
+
outDir: path.resolve(packageDir, './dist'),
|
|
39
|
+
lib: {
|
|
40
|
+
entry: files.map((file: string) => path.resolve(packageDir, './src', file)),
|
|
41
|
+
formats: ['es', 'cjs'], // iife需要控制单独控制external,目前还做不到
|
|
42
|
+
name: packageName,
|
|
43
|
+
fileName: (format, entryName) => {
|
|
44
|
+
return `${entryName}.${format}.js`;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
rollupOptions: {
|
|
48
|
+
external: [
|
|
49
|
+
/^node:/,
|
|
50
|
+
/^[a-zA-Z@]/,
|
|
51
|
+
...external
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|