@workleap/tsup-configs 2.0.0 → 3.0.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 +15 -3
- package/README.md +8 -116
- package/dist/applyTransformers.d.ts +9 -0
- package/dist/applyTransformers.js +8 -0
- package/dist/applyTransformers.mjs +1 -0
- package/dist/build.d.ts +6 -13
- package/dist/build.js +23 -40
- package/dist/build.mjs +2 -2
- package/dist/chunk-3UBBOKDF.mjs +6 -0
- package/dist/chunk-DQ32U23F.mjs +26 -0
- package/dist/chunk-JENCWRR7.mjs +26 -0
- package/dist/dev.d.ts +6 -13
- package/dist/dev.js +23 -40
- package/dist/dev.mjs +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +43 -53
- package/dist/index.mjs +3 -3
- package/package.json +11 -9
- package/dist/chunk-AJHZ7CZ5.mjs +0 -18
- package/dist/chunk-OUAGRIOH.mjs +0 -30
- package/dist/chunk-TG5YPRC3.mjs +0 -18
- package/dist/defineConfig.d.ts +0 -6
- package/dist/defineConfig.js +0 -32
- package/dist/defineConfig.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
# @workleap/tsup-configs
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#98](https://github.com/gsoft-inc/wl-web-configs/pull/98) [`56ca32e`](https://github.com/gsoft-inc/wl-web-configs/commit/56ca32ee3194c51210aacc5189f3ebbec5a4a7b6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - New start, every package has a major version bump
|
|
8
|
+
|
|
9
|
+
## 2.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#92](https://github.com/gsoft-inc/wl-web-configs/pull/92) [`66e8f10`](https://github.com/gsoft-inc/wl-web-configs/commit/66e8f1033a987523c65fe9e61f53dac6d2e38777) Thanks [@ofrogon](https://github.com/ofrogon)! - Migrate project from GitHub organization
|
|
14
|
+
|
|
3
15
|
## 2.0.0
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
|
6
18
|
|
|
7
|
-
- [#85](https://github.com/
|
|
19
|
+
- [#85](https://github.com/gsoft-inc/wl-web-configs/pull/85) [`bad2df7`](https://github.com/gsoft-inc/wl-web-configs/commit/bad2df75593fb70d431d73bdced653b157c50caa) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated TSUP configuration and added a new SWC config package
|
|
8
20
|
|
|
9
21
|
## 1.0.1
|
|
10
22
|
|
|
11
23
|
### Patch Changes
|
|
12
24
|
|
|
13
|
-
- [#74](https://github.com/
|
|
25
|
+
- [#74](https://github.com/gsoft-inc/wl-web-configs/pull/74) [`43c9eb1`](https://github.com/gsoft-inc/wl-web-configs/commit/43c9eb11e61896855666c44beb0e711c82a560a3) Thanks [@alexasselin008](https://github.com/alexasselin008)! - Updated installation documentation
|
|
14
26
|
|
|
15
27
|
## 1.0.0
|
|
16
28
|
|
|
17
29
|
### Major Changes
|
|
18
30
|
|
|
19
|
-
- [#55](https://github.com/
|
|
31
|
+
- [#55](https://github.com/gsoft-inc/wl-web-configs/pull/55) [`228dc8c`](https://github.com/gsoft-inc/wl-web-configs/commit/228dc8cf3a0b3bc82e7c5380c876284583158599) Thanks [@alexasselin008](https://github.com/alexasselin008)! - Initial release
|
package/README.md
CHANGED
|
@@ -1,133 +1,25 @@
|
|
|
1
1
|
# @workleap/tsup-configs
|
|
2
2
|
|
|
3
|
-
Workleap's recommended [tsup](https://tsup.egoist.dev/) configs.
|
|
4
|
-
|
|
5
3
|
[](../../LICENSE)
|
|
6
4
|
[](https://www.npmjs.com/package/@workleap/tsup-configs)
|
|
7
5
|
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
Install the following packages:
|
|
11
|
-
|
|
12
|
-
**With pnpm**
|
|
13
|
-
|
|
14
|
-
```shell
|
|
15
|
-
pnpm add -D @workleap/tsup-configs tsup
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
**With yarn**
|
|
19
|
-
|
|
20
|
-
```shell
|
|
21
|
-
yarn add -D @workleap/tsup-configs tsup
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**With npm**
|
|
25
|
-
|
|
26
|
-
```shell
|
|
27
|
-
npm install -D @workleap/tsup-configs tsup
|
|
28
|
-
```
|
|
29
|
-
|
|
30
6
|
## Usage
|
|
31
7
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
1. Create two files at the top of your project: `tsup.dev.ts` and `tsup.build.ts`.
|
|
35
|
-
|
|
36
|
-
2. Open the `tsup.dev.ts` file and add the following code:
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
// tsup.dev.ts
|
|
40
|
-
import { defineDevConfig } from "@workleap/tsup-configs";
|
|
41
|
-
|
|
42
|
-
export default defineDevConfig();
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
You can override any existing options:
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
|
-
// tsup.dev.ts
|
|
49
|
-
import { defineDevConfig } from "@workleap/tsup-configs";
|
|
50
|
-
|
|
51
|
-
export default defineDevConfig({
|
|
52
|
-
clean: true
|
|
53
|
-
});
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
The provided options will be merged with the default options. Given that a provided option match a default option, it will override the default option. If you prefer to extend the default option, you can import the `DefaultDevOptions` object and handle the merging code in your configuration file:
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
// tsup.dev.ts
|
|
60
|
-
import { defineDevConfig, DefaultDevOptions } from "@workleap/tsup-configs";
|
|
8
|
+
View the [user's documentation](https://gsoft-inc.github.io/wl-web-configs/).
|
|
61
9
|
|
|
62
|
-
|
|
63
|
-
format: ["cjs", ...DefaultDevOptions.format]
|
|
64
|
-
});
|
|
65
|
-
```
|
|
10
|
+
## 🤝 Contributing
|
|
66
11
|
|
|
67
|
-
|
|
12
|
+
View the [contributor's documentation](../../CONTRIBUTING.md).
|
|
68
13
|
|
|
69
|
-
|
|
70
|
-
// tsup.build.ts
|
|
71
|
-
import { defineBuildConfig } from "@workleap/tsup-configs";
|
|
14
|
+
### Notes
|
|
72
15
|
|
|
73
|
-
|
|
74
|
-
```
|
|
16
|
+
#### CJS support
|
|
75
17
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
// tsup.build.ts
|
|
80
|
-
import { defineBuildConfig } from "@workleap/tsup-configs";
|
|
81
|
-
|
|
82
|
-
export default defineBuildConfig({
|
|
83
|
-
clean: true
|
|
84
|
-
});
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
The provided options will be merged with the default options. Given that a provided option matches a default option, it will override the default option. If you prefer to extend the default option, you can import the `DefaultBuildOptions` object and handle the merging code in your configuration file:
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
// tsup.build.ts
|
|
91
|
-
import { defineBuildConfig, DefaultBuildOptions } from "@workleap/tsup-configs";
|
|
92
|
-
|
|
93
|
-
export default defineBuildConfig({
|
|
94
|
-
format: ["cjs", ...DefaultBuildOptions.format]
|
|
95
|
-
});
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
4. In your package.json file, add the following scripts:
|
|
99
|
-
|
|
100
|
-
```json
|
|
101
|
-
"dev": "tsup --config ./tsup.dev.ts",
|
|
102
|
-
"build": "tsup --config ./tsup.build.ts"
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Now you can use the `dev` script to run tsup in watch mode and the `build` script to build your library.
|
|
106
|
-
|
|
107
|
-
## Customization
|
|
108
|
-
|
|
109
|
-
If you want to use additional tsup options or override the default ones, you can pass a custom tsup config to the functions exported by this packages:
|
|
110
|
-
|
|
111
|
-
```ts
|
|
112
|
-
// tsup.config.ts
|
|
113
|
-
import { defineBuildConfig } from "@workleap/tsup-configs";
|
|
114
|
-
|
|
115
|
-
export default defineBuildConfig({
|
|
116
|
-
entry: ["lib/index.ts"],
|
|
117
|
-
format: ["cjs"]
|
|
118
|
-
});
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
[Check out all available options here](https://paka.dev/npm/tsup#module-index-export-Options) or the documentation website at https://tsup.egoist.dev/
|
|
122
|
-
|
|
123
|
-
## Maintainers notes
|
|
124
|
-
|
|
125
|
-
### CJS support
|
|
126
|
-
|
|
127
|
-
To support CJS projects, the package is build for ESM and CJS formats. To support CJS, `type: "module"` has been temporary removed from the `package.json` file.
|
|
18
|
+
To support CJS projects, this package is build for ESM and CJS formats. To support CJS, `type: "module"` has been temporary removed from the `package.json` file.
|
|
128
19
|
|
|
129
20
|
Once all our projects use ESM, CJS support can be removed.
|
|
130
21
|
|
|
131
22
|
## License
|
|
132
23
|
|
|
133
|
-
Copyright © 2023,
|
|
24
|
+
Copyright © 2023, Workleap. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/gsoft-inc/workleap-license/blob/master/LICENSE.
|
|
25
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Options } from 'tsup';
|
|
2
|
+
|
|
3
|
+
interface TsupConfigTransformerContext {
|
|
4
|
+
environment: "dev" | "build";
|
|
5
|
+
}
|
|
6
|
+
type TsupConfigTransformer = (config: Options, context: TsupConfigTransformerContext) => Options;
|
|
7
|
+
declare function applyTransformers(config: Options, transformers: TsupConfigTransformer[], context: TsupConfigTransformerContext): Options;
|
|
8
|
+
|
|
9
|
+
export { TsupConfigTransformer, TsupConfigTransformerContext, applyTransformers };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { applyTransformers } from './chunk-3UBBOKDF.mjs';
|
package/dist/build.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { Options } from 'tsup';
|
|
2
|
-
import {
|
|
2
|
+
import { TsupConfigTransformer } from './applyTransformers.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
entry: string[];
|
|
9
|
-
outDir: string;
|
|
10
|
-
format: string;
|
|
11
|
-
target: "esnext";
|
|
12
|
-
platform: "browser";
|
|
13
|
-
};
|
|
14
|
-
declare function defineBuildConfig(options?: DefineConfigOptions): Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
|
4
|
+
interface DefineBuildConfigOptions extends Options {
|
|
5
|
+
transformers?: TsupConfigTransformer[];
|
|
6
|
+
}
|
|
7
|
+
declare function defineBuildConfig(options?: DefineBuildConfigOptions): Options;
|
|
15
8
|
|
|
16
|
-
export {
|
|
9
|
+
export { DefineBuildConfigOptions, defineBuildConfig };
|
package/dist/build.js
CHANGED
|
@@ -1,48 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function defineConfig(baseOptions, userOptions) {
|
|
7
|
-
if (!userOptions || Array.isArray(userOptions) && userOptions.length === 0) {
|
|
8
|
-
return tsup.defineConfig(baseOptions);
|
|
9
|
-
}
|
|
10
|
-
if (typeof userOptions === "function") {
|
|
11
|
-
return tsup.defineConfig((...args) => ({
|
|
12
|
-
...baseOptions,
|
|
13
|
-
...userOptions(...args)
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(userOptions)) {
|
|
17
|
-
return tsup.defineConfig(
|
|
18
|
-
userOptions.map((configItem) => {
|
|
19
|
-
return {
|
|
20
|
-
...baseOptions,
|
|
21
|
-
...configItem
|
|
22
|
-
};
|
|
23
|
-
})
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
return tsup.defineConfig({
|
|
27
|
-
...baseOptions,
|
|
28
|
-
...userOptions
|
|
29
|
-
});
|
|
3
|
+
// src/applyTransformers.ts
|
|
4
|
+
function applyTransformers(config, transformers, context) {
|
|
5
|
+
return transformers.reduce((acc, transformer) => transformer(acc, context), config);
|
|
30
6
|
}
|
|
31
7
|
|
|
32
8
|
// src/build.ts
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
9
|
+
function defineBuildConfig(options = {}) {
|
|
10
|
+
const {
|
|
11
|
+
transformers = [],
|
|
12
|
+
...rest
|
|
13
|
+
} = options;
|
|
14
|
+
const config = {
|
|
15
|
+
clean: true,
|
|
16
|
+
dts: true,
|
|
17
|
+
treeshake: true,
|
|
18
|
+
entry: ["./src"],
|
|
19
|
+
outDir: "./dist",
|
|
20
|
+
format: "esm",
|
|
21
|
+
target: "esnext",
|
|
22
|
+
platform: "browser",
|
|
23
|
+
...rest
|
|
24
|
+
};
|
|
25
|
+
const transformedConfig = applyTransformers(config, transformers, {
|
|
26
|
+
environment: "build"
|
|
27
|
+
});
|
|
28
|
+
return transformedConfig;
|
|
45
29
|
}
|
|
46
30
|
|
|
47
|
-
exports.DefaultBuildOptions = DefaultBuildOptions;
|
|
48
31
|
exports.defineBuildConfig = defineBuildConfig;
|
package/dist/build.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { defineBuildConfig } from './chunk-JENCWRR7.mjs';
|
|
2
|
+
import './chunk-3UBBOKDF.mjs';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { applyTransformers } from './chunk-3UBBOKDF.mjs';
|
|
2
|
+
|
|
3
|
+
// src/dev.ts
|
|
4
|
+
function defineDevConfig(options = {}) {
|
|
5
|
+
const {
|
|
6
|
+
transformers = [],
|
|
7
|
+
...rest
|
|
8
|
+
} = options;
|
|
9
|
+
const config = {
|
|
10
|
+
dts: true,
|
|
11
|
+
watch: true,
|
|
12
|
+
entry: ["./src"],
|
|
13
|
+
outDir: "./dist",
|
|
14
|
+
format: "esm",
|
|
15
|
+
target: "esnext",
|
|
16
|
+
platform: "browser",
|
|
17
|
+
sourcemap: "inline",
|
|
18
|
+
...rest
|
|
19
|
+
};
|
|
20
|
+
const transformedConfig = applyTransformers(config, transformers, {
|
|
21
|
+
environment: "dev"
|
|
22
|
+
});
|
|
23
|
+
return transformedConfig;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { defineDevConfig };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { applyTransformers } from './chunk-3UBBOKDF.mjs';
|
|
2
|
+
|
|
3
|
+
// src/build.ts
|
|
4
|
+
function defineBuildConfig(options = {}) {
|
|
5
|
+
const {
|
|
6
|
+
transformers = [],
|
|
7
|
+
...rest
|
|
8
|
+
} = options;
|
|
9
|
+
const config = {
|
|
10
|
+
clean: true,
|
|
11
|
+
dts: true,
|
|
12
|
+
treeshake: true,
|
|
13
|
+
entry: ["./src"],
|
|
14
|
+
outDir: "./dist",
|
|
15
|
+
format: "esm",
|
|
16
|
+
target: "esnext",
|
|
17
|
+
platform: "browser",
|
|
18
|
+
...rest
|
|
19
|
+
};
|
|
20
|
+
const transformedConfig = applyTransformers(config, transformers, {
|
|
21
|
+
environment: "build"
|
|
22
|
+
});
|
|
23
|
+
return transformedConfig;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { defineBuildConfig };
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { Options } from 'tsup';
|
|
2
|
-
import {
|
|
2
|
+
import { TsupConfigTransformer } from './applyTransformers.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
outDir: string;
|
|
9
|
-
format: string;
|
|
10
|
-
target: "esnext";
|
|
11
|
-
platform: "browser";
|
|
12
|
-
sourcemap: "inline";
|
|
13
|
-
};
|
|
14
|
-
declare function defineDevConfig(options?: DefineConfigOptions): Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
|
4
|
+
interface DefineDevConfigOptions extends Options {
|
|
5
|
+
transformers?: TsupConfigTransformer[];
|
|
6
|
+
}
|
|
7
|
+
declare function defineDevConfig(options?: DefineDevConfigOptions): Options;
|
|
15
8
|
|
|
16
|
-
export {
|
|
9
|
+
export { DefineDevConfigOptions, defineDevConfig };
|
package/dist/dev.js
CHANGED
|
@@ -1,48 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function defineConfig(baseOptions, userOptions) {
|
|
7
|
-
if (!userOptions || Array.isArray(userOptions) && userOptions.length === 0) {
|
|
8
|
-
return tsup.defineConfig(baseOptions);
|
|
9
|
-
}
|
|
10
|
-
if (typeof userOptions === "function") {
|
|
11
|
-
return tsup.defineConfig((...args) => ({
|
|
12
|
-
...baseOptions,
|
|
13
|
-
...userOptions(...args)
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(userOptions)) {
|
|
17
|
-
return tsup.defineConfig(
|
|
18
|
-
userOptions.map((configItem) => {
|
|
19
|
-
return {
|
|
20
|
-
...baseOptions,
|
|
21
|
-
...configItem
|
|
22
|
-
};
|
|
23
|
-
})
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
return tsup.defineConfig({
|
|
27
|
-
...baseOptions,
|
|
28
|
-
...userOptions
|
|
29
|
-
});
|
|
3
|
+
// src/applyTransformers.ts
|
|
4
|
+
function applyTransformers(config, transformers, context) {
|
|
5
|
+
return transformers.reduce((acc, transformer) => transformer(acc, context), config);
|
|
30
6
|
}
|
|
31
7
|
|
|
32
8
|
// src/dev.ts
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
9
|
+
function defineDevConfig(options = {}) {
|
|
10
|
+
const {
|
|
11
|
+
transformers = [],
|
|
12
|
+
...rest
|
|
13
|
+
} = options;
|
|
14
|
+
const config = {
|
|
15
|
+
dts: true,
|
|
16
|
+
watch: true,
|
|
17
|
+
entry: ["./src"],
|
|
18
|
+
outDir: "./dist",
|
|
19
|
+
format: "esm",
|
|
20
|
+
target: "esnext",
|
|
21
|
+
platform: "browser",
|
|
22
|
+
sourcemap: "inline",
|
|
23
|
+
...rest
|
|
24
|
+
};
|
|
25
|
+
const transformedConfig = applyTransformers(config, transformers, {
|
|
26
|
+
environment: "dev"
|
|
27
|
+
});
|
|
28
|
+
return transformedConfig;
|
|
45
29
|
}
|
|
46
30
|
|
|
47
|
-
exports.DefaultDevOptions = DefaultDevOptions;
|
|
48
31
|
exports.defineDevConfig = defineDevConfig;
|
package/dist/dev.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { defineDevConfig } from './chunk-DQ32U23F.mjs';
|
|
2
|
+
import './chunk-3UBBOKDF.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
|
|
1
|
+
export { Options as TsupConfig } from 'tsup';
|
|
2
|
+
export { TsupConfigTransformer, TsupConfigTransformerContext } from './applyTransformers.js';
|
|
3
|
+
export { DefineBuildConfigOptions, defineBuildConfig } from './build.js';
|
|
4
|
+
export { DefineDevConfigOptions, defineDevConfig } from './dev.js';
|
package/dist/index.js
CHANGED
|
@@ -1,65 +1,55 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function defineConfig(baseOptions, userOptions) {
|
|
7
|
-
if (!userOptions || Array.isArray(userOptions) && userOptions.length === 0) {
|
|
8
|
-
return tsup.defineConfig(baseOptions);
|
|
9
|
-
}
|
|
10
|
-
if (typeof userOptions === "function") {
|
|
11
|
-
return tsup.defineConfig((...args) => ({
|
|
12
|
-
...baseOptions,
|
|
13
|
-
...userOptions(...args)
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(userOptions)) {
|
|
17
|
-
return tsup.defineConfig(
|
|
18
|
-
userOptions.map((configItem) => {
|
|
19
|
-
return {
|
|
20
|
-
...baseOptions,
|
|
21
|
-
...configItem
|
|
22
|
-
};
|
|
23
|
-
})
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
return tsup.defineConfig({
|
|
27
|
-
...baseOptions,
|
|
28
|
-
...userOptions
|
|
29
|
-
});
|
|
3
|
+
// src/applyTransformers.ts
|
|
4
|
+
function applyTransformers(config, transformers, context) {
|
|
5
|
+
return transformers.reduce((acc, transformer) => transformer(acc, context), config);
|
|
30
6
|
}
|
|
31
7
|
|
|
32
8
|
// src/build.ts
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
9
|
+
function defineBuildConfig(options = {}) {
|
|
10
|
+
const {
|
|
11
|
+
transformers = [],
|
|
12
|
+
...rest
|
|
13
|
+
} = options;
|
|
14
|
+
const config = {
|
|
15
|
+
clean: true,
|
|
16
|
+
dts: true,
|
|
17
|
+
treeshake: true,
|
|
18
|
+
entry: ["./src"],
|
|
19
|
+
outDir: "./dist",
|
|
20
|
+
format: "esm",
|
|
21
|
+
target: "esnext",
|
|
22
|
+
platform: "browser",
|
|
23
|
+
...rest
|
|
24
|
+
};
|
|
25
|
+
const transformedConfig = applyTransformers(config, transformers, {
|
|
26
|
+
environment: "build"
|
|
27
|
+
});
|
|
28
|
+
return transformedConfig;
|
|
45
29
|
}
|
|
46
30
|
|
|
47
31
|
// src/dev.ts
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
function defineDevConfig(options = {}) {
|
|
33
|
+
const {
|
|
34
|
+
transformers = [],
|
|
35
|
+
...rest
|
|
36
|
+
} = options;
|
|
37
|
+
const config = {
|
|
38
|
+
dts: true,
|
|
39
|
+
watch: true,
|
|
40
|
+
entry: ["./src"],
|
|
41
|
+
outDir: "./dist",
|
|
42
|
+
format: "esm",
|
|
43
|
+
target: "esnext",
|
|
44
|
+
platform: "browser",
|
|
45
|
+
sourcemap: "inline",
|
|
46
|
+
...rest
|
|
47
|
+
};
|
|
48
|
+
const transformedConfig = applyTransformers(config, transformers, {
|
|
49
|
+
environment: "dev"
|
|
50
|
+
});
|
|
51
|
+
return transformedConfig;
|
|
60
52
|
}
|
|
61
53
|
|
|
62
|
-
exports.DefaultBuildOptions = DefaultBuildOptions;
|
|
63
|
-
exports.DefaultDevOptions = DefaultDevOptions;
|
|
64
54
|
exports.defineBuildConfig = defineBuildConfig;
|
|
65
55
|
exports.defineDevConfig = defineDevConfig;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { defineBuildConfig } from './chunk-JENCWRR7.mjs';
|
|
2
|
+
export { defineDevConfig } from './chunk-DQ32U23F.mjs';
|
|
3
|
+
import './chunk-3UBBOKDF.mjs';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@workleap/tsup-configs",
|
|
3
3
|
"author": "Workleap",
|
|
4
4
|
"description": "Workleap's recommended tsup configs.",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "3.0.0",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"workleap",
|
|
@@ -11,14 +11,15 @@
|
|
|
11
11
|
],
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/
|
|
14
|
+
"url": "git+https://github.com/gsoft-inc/wl-web-configs.git",
|
|
15
15
|
"directory": "packages/tsup-configs"
|
|
16
16
|
},
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
19
|
"require": "./dist/index.js",
|
|
20
20
|
"import": "./dist/index.mjs",
|
|
21
|
-
"types": "./dist/index.d.ts"
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.mjs"
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
25
|
"files": [
|
|
@@ -26,6 +27,10 @@
|
|
|
26
27
|
"CHANGELOG.md",
|
|
27
28
|
"README.md"
|
|
28
29
|
],
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"tsup": "*",
|
|
32
|
+
"typescript": "*"
|
|
33
|
+
},
|
|
29
34
|
"devDependencies": {
|
|
30
35
|
"@swc/core": "1.3.62",
|
|
31
36
|
"@swc/helpers": "0.5.1",
|
|
@@ -35,12 +40,9 @@
|
|
|
35
40
|
"ts-node": "10.9.1",
|
|
36
41
|
"tsup": "6.7.0",
|
|
37
42
|
"typescript": "5.0.4",
|
|
38
|
-
"@workleap/eslint-plugin": "
|
|
39
|
-
"@workleap/swc-configs": "
|
|
40
|
-
"@workleap/typescript-configs": "
|
|
41
|
-
},
|
|
42
|
-
"peerDependencies": {
|
|
43
|
-
"tsup": "*"
|
|
43
|
+
"@workleap/eslint-plugin": "2.0.0",
|
|
44
|
+
"@workleap/swc-configs": "2.0.0",
|
|
45
|
+
"@workleap/typescript-configs": "3.0.0"
|
|
44
46
|
},
|
|
45
47
|
"publishConfig": {
|
|
46
48
|
"access": "public",
|
package/dist/chunk-AJHZ7CZ5.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from './chunk-OUAGRIOH.mjs';
|
|
2
|
-
|
|
3
|
-
// src/build.ts
|
|
4
|
-
var DefaultBuildOptions = {
|
|
5
|
-
clean: true,
|
|
6
|
-
dts: true,
|
|
7
|
-
treeshake: true,
|
|
8
|
-
entry: ["./src"],
|
|
9
|
-
outDir: "./dist",
|
|
10
|
-
format: "esm",
|
|
11
|
-
target: "esnext",
|
|
12
|
-
platform: "browser"
|
|
13
|
-
};
|
|
14
|
-
function defineBuildConfig(options) {
|
|
15
|
-
return defineConfig(DefaultBuildOptions, options);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { DefaultBuildOptions, defineBuildConfig };
|
package/dist/chunk-OUAGRIOH.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { defineConfig as defineConfig$1 } from 'tsup';
|
|
2
|
-
|
|
3
|
-
// src/defineConfig.ts
|
|
4
|
-
function defineConfig(baseOptions, userOptions) {
|
|
5
|
-
if (!userOptions || Array.isArray(userOptions) && userOptions.length === 0) {
|
|
6
|
-
return defineConfig$1(baseOptions);
|
|
7
|
-
}
|
|
8
|
-
if (typeof userOptions === "function") {
|
|
9
|
-
return defineConfig$1((...args) => ({
|
|
10
|
-
...baseOptions,
|
|
11
|
-
...userOptions(...args)
|
|
12
|
-
}));
|
|
13
|
-
}
|
|
14
|
-
if (Array.isArray(userOptions)) {
|
|
15
|
-
return defineConfig$1(
|
|
16
|
-
userOptions.map((configItem) => {
|
|
17
|
-
return {
|
|
18
|
-
...baseOptions,
|
|
19
|
-
...configItem
|
|
20
|
-
};
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
return defineConfig$1({
|
|
25
|
-
...baseOptions,
|
|
26
|
-
...userOptions
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { defineConfig };
|
package/dist/chunk-TG5YPRC3.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from './chunk-OUAGRIOH.mjs';
|
|
2
|
-
|
|
3
|
-
// src/dev.ts
|
|
4
|
-
var DefaultDevOptions = {
|
|
5
|
-
dts: true,
|
|
6
|
-
watch: true,
|
|
7
|
-
entry: ["./src"],
|
|
8
|
-
outDir: "./dist",
|
|
9
|
-
format: "esm",
|
|
10
|
-
target: "esnext",
|
|
11
|
-
platform: "browser",
|
|
12
|
-
sourcemap: "inline"
|
|
13
|
-
};
|
|
14
|
-
function defineDevConfig(options) {
|
|
15
|
-
return defineConfig(DefaultDevOptions, options);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { DefaultDevOptions, defineDevConfig };
|
package/dist/defineConfig.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { defineConfig as defineConfig$1, Options } from 'tsup';
|
|
2
|
-
|
|
3
|
-
type DefineConfigOptions = Parameters<typeof defineConfig$1>[0];
|
|
4
|
-
declare function defineConfig(baseOptions: Options, userOptions?: DefineConfigOptions): ReturnType<typeof defineConfig$1>;
|
|
5
|
-
|
|
6
|
-
export { DefineConfigOptions, defineConfig };
|
package/dist/defineConfig.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tsup = require('tsup');
|
|
4
|
-
|
|
5
|
-
// src/defineConfig.ts
|
|
6
|
-
function defineConfig(baseOptions, userOptions) {
|
|
7
|
-
if (!userOptions || Array.isArray(userOptions) && userOptions.length === 0) {
|
|
8
|
-
return tsup.defineConfig(baseOptions);
|
|
9
|
-
}
|
|
10
|
-
if (typeof userOptions === "function") {
|
|
11
|
-
return tsup.defineConfig((...args) => ({
|
|
12
|
-
...baseOptions,
|
|
13
|
-
...userOptions(...args)
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(userOptions)) {
|
|
17
|
-
return tsup.defineConfig(
|
|
18
|
-
userOptions.map((configItem) => {
|
|
19
|
-
return {
|
|
20
|
-
...baseOptions,
|
|
21
|
-
...configItem
|
|
22
|
-
};
|
|
23
|
-
})
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
return tsup.defineConfig({
|
|
27
|
-
...baseOptions,
|
|
28
|
-
...userOptions
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
exports.defineConfig = defineConfig;
|
package/dist/defineConfig.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { defineConfig } from './chunk-OUAGRIOH.mjs';
|