@jterrazz/typescript 4.0.2 → 4.1.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/README.md +6 -3
- package/config/rolldown.build.config.js +11 -3
- package/config/rolldown.dev.config.js +8 -1
- package/package.json +1 -1
- package/tsconfig/node.json +2 -1
package/README.md
CHANGED
|
@@ -44,14 +44,17 @@ npx ts-build # Production build
|
|
|
44
44
|
| | `dist/index.cjs` | CommonJS bundle |
|
|
45
45
|
| | `dist/index.d.ts` | TypeScript declarations |
|
|
46
46
|
|
|
47
|
+
If `src/instrumentation.ts` exists, it will also generate `dist/instrumentation.js`, `dist/instrumentation.cjs`, and `dist/instrumentation.d.ts`.
|
|
48
|
+
|
|
47
49
|
## Project structure
|
|
48
50
|
|
|
49
51
|
```
|
|
50
52
|
your-project/
|
|
51
53
|
├── src/
|
|
52
|
-
│
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
│ ├── index.ts # Main entry point
|
|
55
|
+
│ └── instrumentation.ts # Optional instrumentation entry point
|
|
56
|
+
├── dist/ # Generated files
|
|
57
|
+
└── tsconfig.json # Extends this package
|
|
55
58
|
```
|
|
56
59
|
|
|
57
60
|
## How it works
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
1
2
|
import { defineConfig } from 'rolldown';
|
|
2
3
|
import { dts } from 'rolldown-plugin-dts';
|
|
3
4
|
|
|
4
5
|
// Externalize all dependencies (node built-ins + node_modules)
|
|
5
6
|
const external = [/node_modules/, /^node:/, /^[a-z@]/];
|
|
6
7
|
|
|
8
|
+
// Build input with optional instrumentation entry point
|
|
9
|
+
const input = {
|
|
10
|
+
index: 'src/index.ts',
|
|
11
|
+
...(existsSync('src/instrumentation.ts') && { instrumentation: 'src/instrumentation.ts' }),
|
|
12
|
+
};
|
|
13
|
+
|
|
7
14
|
// ESM build with .d.ts generation
|
|
8
15
|
const esmBuild = defineConfig({
|
|
9
|
-
input
|
|
16
|
+
input,
|
|
10
17
|
external,
|
|
11
18
|
plugins: [
|
|
12
19
|
dts({
|
|
@@ -23,10 +30,11 @@ const esmBuild = defineConfig({
|
|
|
23
30
|
|
|
24
31
|
// CJS build (no dts - already generated by ESM build)
|
|
25
32
|
const cjsBuild = defineConfig({
|
|
26
|
-
input
|
|
33
|
+
input,
|
|
27
34
|
external,
|
|
28
35
|
output: {
|
|
29
|
-
|
|
36
|
+
dir: 'dist',
|
|
37
|
+
entryFileNames: '[name].cjs',
|
|
30
38
|
format: 'cjs',
|
|
31
39
|
sourcemap: true,
|
|
32
40
|
},
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
1
2
|
import { defineConfig } from 'rolldown';
|
|
2
3
|
|
|
4
|
+
// Build input with optional instrumentation entry point
|
|
5
|
+
const input = {
|
|
6
|
+
index: 'src/index.ts',
|
|
7
|
+
...(existsSync('src/instrumentation.ts') && { instrumentation: 'src/instrumentation.ts' }),
|
|
8
|
+
};
|
|
9
|
+
|
|
3
10
|
// Dev build - ESM only, no .d.ts (faster rebuilds)
|
|
4
11
|
// Externalize all dependencies for Node.js apps
|
|
5
12
|
export default defineConfig({
|
|
6
|
-
input
|
|
13
|
+
input,
|
|
7
14
|
external: [/node_modules/, /^node:/, /^[a-z@]/],
|
|
8
15
|
output: {
|
|
9
16
|
dir: 'dist',
|
package/package.json
CHANGED
package/tsconfig/node.json
CHANGED