@hypernym/bundler 0.9.3 → 0.10.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 +26 -4
- package/dist/bin/index.mjs +1 -1
- package/dist/index.mjs +8 -1
- package/dist/types/index.d.ts +24 -1
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ ESM & TS module bundler.
|
|
|
5
5
|
<sub><a href="https://github.com/hypernym-studio/bundler">Repository</a> | <a href="https://www.npmjs.com/package/@hypernym/bundler">Package</a> | <a href="https://github.com/hypernym-studio/bundler/releases">Releases</a> | <a href="https://github.com/hypernym-studio/bundler/discussions">Discussions</a></sub>
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
|
|
8
|
+
pnpm add -D @hypernym/bundler
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Features
|
|
@@ -294,6 +294,30 @@ import { module } from '@/utils'
|
|
|
294
294
|
import { module } from '~/utils'
|
|
295
295
|
```
|
|
296
296
|
|
|
297
|
+
## Utils
|
|
298
|
+
|
|
299
|
+
### replacePath
|
|
300
|
+
|
|
301
|
+
- Type: `(path: RegExp | string, replace: string): (id: string) => string`
|
|
302
|
+
|
|
303
|
+
Replaces the external module ID with a custom value.
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
import { defineConfig, replacePath } from '@hypernym/bundler'
|
|
307
|
+
|
|
308
|
+
export default defineConfig({
|
|
309
|
+
entries: [
|
|
310
|
+
{
|
|
311
|
+
input: './src/index.ts',
|
|
312
|
+
output: './dist/index.mjs',
|
|
313
|
+
externals: [/^@\/path/],
|
|
314
|
+
// replaces `@/path` with `./path/index.mjs`
|
|
315
|
+
paths: (id) => replacePath(/^@\/path/, './easing/index.mjs')(id),
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
})
|
|
319
|
+
```
|
|
320
|
+
|
|
297
321
|
## CLI
|
|
298
322
|
|
|
299
323
|
### Custom Config
|
|
@@ -312,8 +336,6 @@ Use the official [discussions](https://github.com/hypernym-studio/bundler/discus
|
|
|
312
336
|
|
|
313
337
|
## License
|
|
314
338
|
|
|
315
|
-
Developed in 🇭🇷 Croatia.
|
|
339
|
+
Developed in 🇭🇷 Croatia, © Hypernym Studio.
|
|
316
340
|
|
|
317
341
|
Released under the [MIT](LICENSE.txt) license.
|
|
318
|
-
|
|
319
|
-
© Hypernym Studio
|
package/dist/bin/index.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -9,4 +9,11 @@ function defineConfig(options) {
|
|
|
9
9
|
return options;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
function replacePath(path, replace) {
|
|
13
|
+
return (id) => {
|
|
14
|
+
if (id.match(path)) return replace;
|
|
15
|
+
return id;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { defineConfig, externals, replacePath };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -461,4 +461,27 @@ interface HooksOptions {
|
|
|
461
461
|
declare const externals: RegExp[];
|
|
462
462
|
declare function defineConfig(options: Options): Options;
|
|
463
463
|
|
|
464
|
-
|
|
464
|
+
/**
|
|
465
|
+
* Replaces the external module ID with a custom value.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
*
|
|
469
|
+
* ```ts
|
|
470
|
+
* import { defineConfig, replacePath } from '@hypernym/bundler'
|
|
471
|
+
*
|
|
472
|
+
* export default defineConfig({
|
|
473
|
+
* entries: [
|
|
474
|
+
* {
|
|
475
|
+
* input: './src/index.ts',
|
|
476
|
+
* output: './dist/index.mjs',
|
|
477
|
+
* externals: [/^@\/path/],
|
|
478
|
+
* // replaces `@/path` with `./path/index.mjs`
|
|
479
|
+
* paths: (id) => replacePath(/^@\/path/, './easing/index.mjs')(id),
|
|
480
|
+
* },
|
|
481
|
+
* ]
|
|
482
|
+
* })
|
|
483
|
+
* ```
|
|
484
|
+
*/
|
|
485
|
+
declare function replacePath(path: RegExp | string, replace: string): (id: string) => string;
|
|
486
|
+
|
|
487
|
+
export { type BuildLogs, type BuildStats, type EntryBase, type EntryInput, type EntryOptions, type EntryTemplate, type EntryTypes, type HooksOptions, type Options, type PluginsInput, type PluginsTypes, defineConfig, externals, replacePath };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypernym/bundler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"author": "Hypernym Studio",
|
|
5
5
|
"description": "ESM & TS module bundler.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,15 +37,17 @@
|
|
|
37
37
|
"hyperbundler": "./dist/bin/index.mjs"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "
|
|
40
|
+
"build": "bun -b run ./src/bin/index.ts",
|
|
41
41
|
"lint": "eslint -c .config/eslint.config.js .",
|
|
42
42
|
"lint:fix": "eslint -c .config/eslint.config.js --fix .",
|
|
43
43
|
"format": "prettier --config .config/prettier.config.js --write .",
|
|
44
44
|
"prepublishOnly": "npm run build"
|
|
45
45
|
},
|
|
46
46
|
"sideEffects": false,
|
|
47
|
+
"packageManager": "pnpm@9.9.0",
|
|
47
48
|
"engines": {
|
|
48
|
-
"node": ">=20.0.0"
|
|
49
|
+
"node": ">=20.0.0",
|
|
50
|
+
"pnpm": ">=9.0.0"
|
|
49
51
|
},
|
|
50
52
|
"peerDependencies": {
|
|
51
53
|
"@types/node": ">=20.0.0",
|
|
@@ -68,18 +70,18 @@
|
|
|
68
70
|
"@rollup/plugin-json": "^6.1.0",
|
|
69
71
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
70
72
|
"@rollup/plugin-replace": "^5.0.7",
|
|
73
|
+
"@rollup/pluginutils": "^5.1.0",
|
|
71
74
|
"esbuild": "^0.23.1",
|
|
72
|
-
"rollup": "^4.21.
|
|
75
|
+
"rollup": "^4.21.2",
|
|
73
76
|
"rollup-plugin-dts": "^6.1.1"
|
|
74
77
|
},
|
|
75
78
|
"devDependencies": {
|
|
76
|
-
"@hypernym/eslint-config": "^3.0
|
|
77
|
-
"@hypernym/prettier-config": "^3.0
|
|
78
|
-
"@hypernym/tsconfig": "^2.
|
|
79
|
-
"@types/node": "^22.5.
|
|
80
|
-
"eslint": "^9.
|
|
79
|
+
"@hypernym/eslint-config": "^3.5.0",
|
|
80
|
+
"@hypernym/prettier-config": "^3.2.0",
|
|
81
|
+
"@hypernym/tsconfig": "^2.2.0",
|
|
82
|
+
"@types/node": "^22.5.4",
|
|
83
|
+
"eslint": "^9.10.0",
|
|
81
84
|
"prettier": "^3.3.3",
|
|
82
|
-
"tsx": "^4.17.1",
|
|
83
85
|
"typescript": "^5.5.4"
|
|
84
86
|
}
|
|
85
87
|
}
|