@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 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
- └── index.ts # Your TypeScript code
53
- ├── dist/ # Generated files
54
- └── tsconfig.json # Extends this package
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: './src/index.ts',
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: './src/index.ts',
33
+ input,
27
34
  external,
28
35
  output: {
29
- file: 'dist/index.cjs',
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: './src/index.ts',
13
+ input,
7
14
  external: [/node_modules/, /^node:/, /^[a-z@]/],
8
15
  output: {
9
16
  dir: 'dist',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jterrazz/typescript",
3
3
  "author": "Jean-Baptiste Terrazzoni <contact@jterrazz.com>",
4
- "version": "4.0.2",
4
+ "version": "4.1.0",
5
5
  "files": [
6
6
  "tsconfig",
7
7
  "bin",
@@ -3,8 +3,9 @@
3
3
  "include": ["../../../../src/"],
4
4
 
5
5
  "compilerOptions": {
6
- "moduleResolution": "bundler",
6
+ "moduleResolution": "Bundler",
7
7
  "module": "ESNext",
8
+ "target": "ESNext",
8
9
  "types": ["node"],
9
10
  "strict": true,
10
11
  "experimentalDecorators": true,