@visulima/packem 1.19.0 → 1.19.2

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.
Files changed (199) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +116 -107
  3. package/dist/builder/typedoc/index.cjs +3 -3
  4. package/dist/builder/typedoc/index.mjs +3 -3
  5. package/dist/cli/commands/build.d.mts +1 -4
  6. package/dist/cli/index.mjs +106 -103
  7. package/dist/config/index.d.cts +2 -8
  8. package/dist/config/index.d.mts +2 -8
  9. package/dist/config/index.d.ts +2 -8
  10. package/dist/config/preset/utils/infer-entries.d.mts +4 -5
  11. package/dist/config/utils/load-packem-config.d.mts +1 -1
  12. package/dist/constants.d.cts +5 -19
  13. package/dist/constants.d.mts +5 -19
  14. package/dist/constants.d.ts +5 -19
  15. package/dist/index.cjs +84 -81
  16. package/dist/index.d.cts +4 -10
  17. package/dist/index.d.mts +4 -10
  18. package/dist/index.d.ts +4 -10
  19. package/dist/index.mjs +85 -82
  20. package/dist/packem/build.d.cts +2 -5
  21. package/dist/packem/build.d.mts +2 -5
  22. package/dist/packem/build.d.ts +2 -5
  23. package/dist/packem/index.d.cts +5 -8
  24. package/dist/packem/index.d.mts +5 -8
  25. package/dist/packem/index.d.ts +5 -8
  26. package/dist/packem/utils/group-by-keys.d.cts +1 -1
  27. package/dist/packem/utils/group-by-keys.d.mts +1 -1
  28. package/dist/packem/utils/group-by-keys.d.ts +1 -1
  29. package/dist/packem_shared/Mime-BEcV1ESr.mjs +3 -0
  30. package/dist/packem_shared/Mime-UGY_zUAS.cjs +1 -0
  31. package/dist/packem_shared/{constants-CR0qfKZx.cjs → constants-DIrGIX0w.cjs} +1 -1
  32. package/dist/packem_shared/{constants-CwJdgxph.mjs → constants-Eq2rMfX-.mjs} +1 -1
  33. package/dist/packem_shared/{create-or-update-key-storage-Bm-Xu0uJ.mjs → create-or-update-key-storage-BATQud1F.mjs} +1 -1
  34. package/dist/packem_shared/create-or-update-key-storage-DKcZnYd5.cjs +3 -0
  35. package/dist/packem_shared/{url-I6Jx3crl.mjs → url-BJXna-1T.mjs} +1 -1
  36. package/dist/packem_shared/{url-DFE8cAA0.cjs → url-C84CQz1g.cjs} +1 -1
  37. package/dist/rollup/plugins/chunk-splitter/parse/types.d.cts +12 -12
  38. package/dist/rollup/plugins/chunk-splitter/parse/types.d.mts +12 -12
  39. package/dist/rollup/plugins/chunk-splitter/parse/types.d.ts +12 -12
  40. package/dist/rollup/plugins/cjs-interop.d.cts +2 -2
  41. package/dist/rollup/plugins/cjs-interop.d.mts +2 -2
  42. package/dist/rollup/plugins/cjs-interop.d.ts +2 -2
  43. package/dist/rollup/plugins/copy.d.cts +6 -8
  44. package/dist/rollup/plugins/copy.d.mts +6 -8
  45. package/dist/rollup/plugins/copy.d.ts +6 -8
  46. package/dist/rollup/plugins/css/loaders/less/index.cjs +1 -1
  47. package/dist/rollup/plugins/css/loaders/less/index.mjs +1 -1
  48. package/dist/rollup/plugins/css/loaders/less/types.d.cts +1 -1
  49. package/dist/rollup/plugins/css/loaders/less/types.d.mts +1 -1
  50. package/dist/rollup/plugins/css/loaders/less/types.d.ts +1 -1
  51. package/dist/rollup/plugins/css/loaders/lightningcss.cjs +2 -2
  52. package/dist/rollup/plugins/css/loaders/lightningcss.mjs +2 -2
  53. package/dist/rollup/plugins/css/loaders/postcss/import/apply-styles.d.cts +1 -1
  54. package/dist/rollup/plugins/css/loaders/postcss/import/apply-styles.d.mts +1 -1
  55. package/dist/rollup/plugins/css/loaders/postcss/import/apply-styles.d.ts +1 -1
  56. package/dist/rollup/plugins/css/loaders/postcss/import/import-resolve.d.cts +1 -1
  57. package/dist/rollup/plugins/css/loaders/postcss/import/import-resolve.d.mts +1 -1
  58. package/dist/rollup/plugins/css/loaders/postcss/import/import-resolve.d.ts +1 -1
  59. package/dist/rollup/plugins/css/loaders/postcss/import/index.d.cts +2 -2
  60. package/dist/rollup/plugins/css/loaders/postcss/import/index.d.mts +2 -2
  61. package/dist/rollup/plugins/css/loaders/postcss/import/index.d.ts +2 -2
  62. package/dist/rollup/plugins/css/loaders/postcss/import/parser/parse-styles.d.cts +2 -2
  63. package/dist/rollup/plugins/css/loaders/postcss/import/parser/parse-styles.d.mts +2 -2
  64. package/dist/rollup/plugins/css/loaders/postcss/import/parser/parse-styles.d.ts +2 -2
  65. package/dist/rollup/plugins/css/loaders/postcss/import/parser/parse-stylesheet.d.cts +1 -1
  66. package/dist/rollup/plugins/css/loaders/postcss/import/parser/parse-stylesheet.d.mts +1 -1
  67. package/dist/rollup/plugins/css/loaders/postcss/import/parser/parse-stylesheet.d.ts +1 -1
  68. package/dist/rollup/plugins/css/loaders/postcss/import/types.d.cts +33 -36
  69. package/dist/rollup/plugins/css/loaders/postcss/import/types.d.mts +33 -36
  70. package/dist/rollup/plugins/css/loaders/postcss/import/types.d.ts +33 -36
  71. package/dist/rollup/plugins/css/loaders/postcss/index.cjs +3 -3
  72. package/dist/rollup/plugins/css/loaders/postcss/index.mjs +3 -3
  73. package/dist/rollup/plugins/css/loaders/postcss/modules/index.d.cts +1 -1
  74. package/dist/rollup/plugins/css/loaders/postcss/modules/index.d.mts +1 -1
  75. package/dist/rollup/plugins/css/loaders/postcss/modules/index.d.ts +1 -1
  76. package/dist/rollup/plugins/css/loaders/postcss/url/index.d.cts +1 -1
  77. package/dist/rollup/plugins/css/loaders/postcss/url/index.d.mts +1 -1
  78. package/dist/rollup/plugins/css/loaders/postcss/url/index.d.ts +1 -1
  79. package/dist/rollup/plugins/css/loaders/sass/index.cjs +6 -6
  80. package/dist/rollup/plugins/css/loaders/sass/index.mjs +7 -7
  81. package/dist/rollup/plugins/css/loaders/sass/types.d.cts +4 -4
  82. package/dist/rollup/plugins/css/loaders/sass/types.d.mts +4 -4
  83. package/dist/rollup/plugins/css/loaders/sass/types.d.ts +4 -4
  84. package/dist/rollup/plugins/css/loaders/sass/utils/get-compile-function.d.cts +3 -3
  85. package/dist/rollup/plugins/css/loaders/sass/utils/get-compile-function.d.mts +3 -3
  86. package/dist/rollup/plugins/css/loaders/sass/utils/get-compile-function.d.ts +3 -3
  87. package/dist/rollup/plugins/css/loaders/sass/utils/get-sass-implementation.d.cts +2 -2
  88. package/dist/rollup/plugins/css/loaders/sass/utils/get-sass-implementation.d.mts +2 -2
  89. package/dist/rollup/plugins/css/loaders/sass/utils/get-sass-implementation.d.ts +2 -2
  90. package/dist/rollup/plugins/css/loaders/sass/utils/resolve-syntax.d.cts +1 -1
  91. package/dist/rollup/plugins/css/loaders/sass/utils/resolve-syntax.d.mts +1 -1
  92. package/dist/rollup/plugins/css/loaders/sass/utils/resolve-syntax.d.ts +1 -1
  93. package/dist/rollup/plugins/css/loaders/sass/utils/sass-error-factory.d.cts +4 -4
  94. package/dist/rollup/plugins/css/loaders/sass/utils/sass-error-factory.d.mts +4 -4
  95. package/dist/rollup/plugins/css/loaders/sass/utils/sass-error-factory.d.ts +4 -4
  96. package/dist/rollup/plugins/css/loaders/types.d.cts +15 -15
  97. package/dist/rollup/plugins/css/loaders/types.d.mts +15 -15
  98. package/dist/rollup/plugins/css/loaders/types.d.ts +15 -15
  99. package/dist/rollup/plugins/css/minifiers/lightningcss.cjs +2 -2
  100. package/dist/rollup/plugins/css/minifiers/lightningcss.mjs +2 -2
  101. package/dist/rollup/plugins/css/minifiers/types.d.cts +4 -4
  102. package/dist/rollup/plugins/css/minifiers/types.d.mts +4 -4
  103. package/dist/rollup/plugins/css/minifiers/types.d.ts +4 -4
  104. package/dist/rollup/plugins/css/runtime/inject-css.cjs +1 -1
  105. package/dist/rollup/plugins/css/runtime/inject-css.d.cts +1 -1
  106. package/dist/rollup/plugins/css/runtime/inject-css.d.mts +1 -1
  107. package/dist/rollup/plugins/css/runtime/inject-css.d.ts +1 -1
  108. package/dist/rollup/plugins/css/runtime/inject-css.mjs +1 -1
  109. package/dist/rollup/plugins/css/types.d.cts +75 -75
  110. package/dist/rollup/plugins/css/types.d.mts +75 -75
  111. package/dist/rollup/plugins/css/types.d.ts +75 -75
  112. package/dist/rollup/plugins/css/utils/load-module.d.cts +2 -2
  113. package/dist/rollup/plugins/css/utils/load-module.d.mts +2 -2
  114. package/dist/rollup/plugins/css/utils/load-module.d.ts +2 -2
  115. package/dist/rollup/plugins/css/utils/url.d.cts +2 -3
  116. package/dist/rollup/plugins/css/utils/url.d.mts +2 -3
  117. package/dist/rollup/plugins/css/utils/url.d.ts +2 -3
  118. package/dist/rollup/plugins/esbuild/get-render-chunk.d.cts +2 -2
  119. package/dist/rollup/plugins/esbuild/get-render-chunk.d.mts +2 -2
  120. package/dist/rollup/plugins/esbuild/get-render-chunk.d.ts +2 -2
  121. package/dist/rollup/plugins/esbuild/index.cjs +1 -1
  122. package/dist/rollup/plugins/esbuild/index.mjs +2 -2
  123. package/dist/rollup/plugins/esbuild/types.d.cts +18 -18
  124. package/dist/rollup/plugins/esbuild/types.d.mts +18 -18
  125. package/dist/rollup/plugins/esbuild/types.d.ts +18 -18
  126. package/dist/rollup/plugins/jsx-remove-attributes.d.cts +2 -2
  127. package/dist/rollup/plugins/jsx-remove-attributes.d.mts +2 -2
  128. package/dist/rollup/plugins/jsx-remove-attributes.d.ts +2 -2
  129. package/dist/rollup/plugins/oxc/oxc-resolve.d.cts +2 -2
  130. package/dist/rollup/plugins/oxc/oxc-resolve.d.mts +2 -2
  131. package/dist/rollup/plugins/oxc/oxc-resolve.d.ts +2 -2
  132. package/dist/rollup/plugins/oxc/oxc-transformer.cjs +1 -1
  133. package/dist/rollup/plugins/oxc/oxc-transformer.mjs +1 -1
  134. package/dist/rollup/plugins/oxc/types.d.cts +5 -5
  135. package/dist/rollup/plugins/oxc/types.d.mts +5 -5
  136. package/dist/rollup/plugins/oxc/types.d.ts +5 -5
  137. package/dist/rollup/plugins/plugin-cache.d.cts +4 -5
  138. package/dist/rollup/plugins/plugin-cache.d.mts +4 -5
  139. package/dist/rollup/plugins/plugin-cache.d.ts +4 -5
  140. package/dist/rollup/plugins/resolve-externals-plugin.d.cts +3 -5
  141. package/dist/rollup/plugins/resolve-externals-plugin.d.mts +3 -5
  142. package/dist/rollup/plugins/resolve-externals-plugin.d.ts +3 -5
  143. package/dist/rollup/plugins/sucrase/index.cjs +1 -1
  144. package/dist/rollup/plugins/sucrase/index.mjs +1 -1
  145. package/dist/rollup/plugins/swc/swc-plugin.cjs +1 -1
  146. package/dist/rollup/plugins/swc/swc-plugin.mjs +1 -1
  147. package/dist/rollup/plugins/swc/types.d.cts +2 -2
  148. package/dist/rollup/plugins/swc/types.d.mts +2 -2
  149. package/dist/rollup/plugins/swc/types.d.ts +2 -2
  150. package/dist/rollup/plugins/typescript/resolve-tsconfig-root-dirs.d.cts +0 -1
  151. package/dist/rollup/plugins/typescript/resolve-tsconfig-root-dirs.d.mts +0 -1
  152. package/dist/rollup/plugins/typescript/resolve-tsconfig-root-dirs.d.ts +0 -1
  153. package/dist/rollup/plugins/typescript/resolve-typescript-mjs-cjs.d.cts +1 -1
  154. package/dist/rollup/plugins/typescript/resolve-typescript-mjs-cjs.d.mts +1 -1
  155. package/dist/rollup/plugins/typescript/resolve-typescript-mjs-cjs.d.ts +1 -1
  156. package/dist/rollup/plugins/typescript/utils/patch-cjs-default-export.d.cts +2 -2
  157. package/dist/rollup/plugins/typescript/utils/patch-cjs-default-export.d.mts +2 -2
  158. package/dist/rollup/plugins/typescript/utils/patch-cjs-default-export.d.ts +2 -2
  159. package/dist/rollup/plugins/url.d.cts +4 -13
  160. package/dist/rollup/plugins/url.d.mts +4 -13
  161. package/dist/rollup/plugins/url.d.ts +4 -13
  162. package/dist/rollup/utils/chunks/create-split-chunks.d.cts +1 -1
  163. package/dist/rollup/utils/chunks/create-split-chunks.d.mts +1 -1
  164. package/dist/rollup/utils/chunks/create-split-chunks.d.ts +1 -1
  165. package/dist/rollup/utils/get-hash.d.cts +1 -1
  166. package/dist/rollup/utils/get-hash.d.mts +1 -1
  167. package/dist/rollup/utils/get-hash.d.ts +1 -1
  168. package/dist/rollup/utils/svg-encoder.d.cts +4 -0
  169. package/dist/rollup/utils/svg-encoder.d.mts +2 -0
  170. package/dist/rollup/utils/svg-encoder.d.ts +4 -0
  171. package/dist/types.d.cts +213 -215
  172. package/dist/types.d.mts +213 -215
  173. package/dist/types.d.ts +213 -215
  174. package/dist/utils/extract-export-filenames.d.cts +2 -2
  175. package/dist/utils/extract-export-filenames.d.mts +2 -2
  176. package/dist/utils/extract-export-filenames.d.ts +2 -2
  177. package/dist/utils/file-cache.d.cts +2 -1
  178. package/dist/utils/file-cache.d.mts +2 -1
  179. package/dist/utils/file-cache.d.ts +2 -1
  180. package/dist/utils/get-package-side-effect.d.cts +1 -1
  181. package/dist/utils/get-package-side-effect.d.mts +1 -1
  182. package/dist/utils/get-package-side-effect.d.ts +1 -1
  183. package/dist/utils/kill-process.d.cts +4 -5
  184. package/dist/utils/kill-process.d.mts +4 -5
  185. package/dist/utils/kill-process.d.ts +4 -5
  186. package/dist/utils/replace-content-within-marker.d.cts +2 -2
  187. package/dist/utils/replace-content-within-marker.d.mts +2 -2
  188. package/dist/utils/replace-content-within-marker.d.ts +2 -2
  189. package/files.d.ts +40 -0
  190. package/package.json +28 -28
  191. package/dist/packem_shared/Mime-DDqfACcK.cjs +0 -1
  192. package/dist/packem_shared/Mime-DfuxWtpt.mjs +0 -3
  193. package/dist/packem_shared/create-or-update-key-storage-mzqiq3Nk.cjs +0 -3
  194. /package/dist/utils/{levenstein.d.cts → find-alternatives.d.cts} +0 -0
  195. /package/dist/utils/{levenstein.d.mts → find-alternatives.d.mts} +0 -0
  196. /package/dist/utils/{levenstein.d.ts → find-alternatives.d.ts} +0 -0
  197. /package/dist/utils/{memoize.d.cts → memoize-by-key.d.cts} +0 -0
  198. /package/dist/utils/{memoize.d.mts → memoize-by-key.d.mts} +0 -0
  199. /package/dist/utils/{memoize.d.ts → memoize-by-key.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,40 @@
1
+ ## @visulima/packem [1.19.2](https://github.com/visulima/packem/compare/@visulima/packem@1.19.1...@visulima/packem@1.19.2) (2025-05-28)
2
+
3
+ ### Bug Fixes
4
+
5
+ * added a new test file for the fixDynamicImportExtension plugin to ensure correct functionality. ([ef9e2da](https://github.com/visulima/packem/commit/ef9e2da28a96d035041604d8b959e2f01a811430))
6
+ * fixed dynamic imports ([1fc3676](https://github.com/visulima/packem/commit/1fc3676039da0d116419e3babd3abd7a687fcf53))
7
+ * **packem:** update rollup to v4.41 ([d5ddfe1](https://github.com/visulima/packem/commit/d5ddfe1a4bb464e5b7de618fd32a1b038c63f4b2))
8
+ * **svg-encoder:** implement SVG encoding utility and update URL plugin ([407bc3e](https://github.com/visulima/packem/commit/407bc3e8f03d1f26c7e9ef1e6f6bd25eda38b3d7))
9
+ * **tests:** enhance assertions in fixDynamicImportExtension test ([1d122ac](https://github.com/visulima/packem/commit/1d122acd288d752ab3f7ca9c4508cb6c43ba3fce))
10
+ * **tests:** improve integration tests for file URL resolution and TypeScript error handling ([cb19cc3](https://github.com/visulima/packem/commit/cb19cc344acdbe6132b716c0290a625b9ad322c6))
11
+ * **tests:** update SVG data URIs to Base64 format in snapshots ([11a84c0](https://github.com/visulima/packem/commit/11a84c002fd07cc5976b2a2ad917900db194bad8))
12
+ * update dependencies and improve compatibility ([1c3b34a](https://github.com/visulima/packem/commit/1c3b34ab8d1aa3d6eff631cba468daefaf9df312))
13
+
14
+ ### Styles
15
+
16
+ * cs fixes ([b67ff06](https://github.com/visulima/packem/commit/b67ff065b1d4012333ed860afe7c628e413f9e29))
17
+ * cs fixes ([d604e41](https://github.com/visulima/packem/commit/d604e413d5c8da285e8a0ddb82924483bf35cfbc))
18
+
19
+ ### Miscellaneous Chores
20
+
21
+ * upgraded eslint to v9, removed prettier ([#147](https://github.com/visulima/packem/issues/147)) ([6b5b991](https://github.com/visulima/packem/commit/6b5b991589797b861eee370550bae73e8471cbf2))
22
+
23
+ ### Code Refactoring
24
+
25
+ * **tests:** improve test assertions and add svg encoder utility ([0123f5c](https://github.com/visulima/packem/commit/0123f5c20b42e4aed2434fe7d32001f20d113e07))
26
+ * **tests:** rename execPackemSync to execPackem in test files ([ed33237](https://github.com/visulima/packem/commit/ed3323722d3141e11c4c4594ebb00a78e08c7ee0))
27
+
28
+ ### Continuous Integration
29
+
30
+ * update configuration and test setup ([#146](https://github.com/visulima/packem/issues/146)) ([2c07594](https://github.com/visulima/packem/commit/2c07594b70b2a2db992d31c895b5a32feaccb0fa))
31
+
32
+ ## @visulima/packem [1.19.1](https://github.com/visulima/packem/compare/@visulima/packem@1.19.0...@visulima/packem@1.19.1) (2025-03-05)
33
+
34
+ ### Bug Fixes
35
+
36
+ * fixed dts only out generation, fixed compatibility mode if the value is true ([a22c132](https://github.com/visulima/packem/commit/a22c1325bfffb6b3d17d745a1cc53c4d9559f04c))
37
+
1
38
  ## @visulima/packem [1.19.0](https://github.com/visulima/packem/compare/@visulima/packem@1.18.6...@visulima/packem@1.19.0) (2025-03-04)
2
39
 
3
40
  ### Features
package/README.md CHANGED
@@ -37,28 +37,28 @@ It uses the `exports` configuration in `package.json` and recognizes entry file
37
37
 
38
38
  ## Features
39
39
 
40
- - ✅ package.json#exports, package.json#main, package.json#module to define entry-points
41
- - ✅ package.json#bin to define executables
42
- - ✅ package.json#types to define types
43
- - ✅ Generates package.json#typeVersions to support node 10
44
- - ✅ Dependency externalization
45
- - ✅ Minification
46
- - ✅ TypeScript support + .d.ts bundling
47
- - ✅ Watch mode
48
- - ✅ CLI outputs (auto hashbang insertion)
49
- - ✅ Validator
40
+ - ✅ package.json#exports, package.json#main, package.json#module to define entry-points
41
+ - ✅ package.json#bin to define executables
42
+ - ✅ package.json#types to define types
43
+ - ✅ Generates package.json#typeVersions to support node 10
44
+ - ✅ Dependency externalization
45
+ - ✅ Minification
46
+ - ✅ TypeScript support + .d.ts bundling
47
+ - ✅ Watch mode
48
+ - ✅ CLI outputs (auto hashbang insertion)
49
+ - ✅ Validator
50
50
  - Validates package.json and checks if all fields that are needed to publish your package are configured correctly
51
51
  - Bundle size validation
52
- - ✅ Supports multiple runtimes (default, react-server, edge-light, browser and node)
53
- - ✅ Supports react server and client components
54
- - ✅ Supports shared modules
55
- - ✅ Supports dynamic import
56
- - ✅ Supports `tsconfig.json` paths and `package.json` imports resolution
57
- - ✅ ESM ⇄ CJS interoperability
58
- - ✅ Supports isolated declaration types (experimental) (Typescript version 5.5 or higher)
59
- - ✅ Supports wasm [WebAssembly modules](http://webassembly.org)
60
- - ✅ Supports css, [sass](https://github.com/sass/sass), [less](https://github.com/less/less.js), [stylus](https://github.com/stylus/stylus) and Up-to-date [CSS Modules](https://github.com/css-modules/css-modules) (experimental)
61
- - ✅ [TypeDoc](https://github.com/TypeStrong/TypeDoc) documentation generation
52
+ - ✅ Supports multiple runtimes (default, react-server, edge-light, browser and node)
53
+ - ✅ Supports react server and client components
54
+ - ✅ Supports shared modules
55
+ - ✅ Supports dynamic import
56
+ - ✅ Supports `tsconfig.json` paths and `package.json` imports resolution
57
+ - ✅ ESM ⇄ CJS interoperability
58
+ - ✅ Supports isolated declaration types (experimental) (Typescript version 5.5 or higher)
59
+ - ✅ Supports wasm [WebAssembly modules](http://webassembly.org)
60
+ - ✅ Supports css, [sass](https://github.com/sass/sass), [less](https://github.com/less/less.js), [stylus](https://github.com/stylus/stylus) and Up-to-date [CSS Modules](https://github.com/css-modules/css-modules) (experimental)
61
+ - ✅ [TypeDoc](https://github.com/TypeStrong/TypeDoc) documentation generation
62
62
 
63
63
  And more...
64
64
 
@@ -181,7 +181,7 @@ You can validate your package.json exports configuration with [are the types wro
181
181
 
182
182
  Links:
183
183
 
184
- - https://github.com/frehner/modern-guide-to-packaging-js-library#set-the-main-field
184
+ - https://github.com/frehner/modern-guide-to-packaging-js-library#set-the-main-field
185
185
 
186
186
  ## Usage
187
187
 
@@ -213,8 +213,8 @@ For example: `src/index.ts` will match the exports name `"."` or the only main e
213
213
  Now just run `npm run build` or `pnpm build` / `yarn build` if you're using these package managers, `packem` will find the entry files and build them.
214
214
  The output format will be based on the exports condition and also the file extension. Given an example:
215
215
 
216
- - It's CommonJS for `require` and ESM for `import` based on the exports condition.
217
- - It's CommonJS for `.cjs` and ESM for `.mjs` based on the extension regardless the exports condition. Then for export condition like "node" you could choose the format with your extension.
216
+ - It's CommonJS for `require` and ESM for `import` based on the exports condition.
217
+ - It's CommonJS for `.cjs` and ESM for `.mjs` based on the extension regardless the exports condition. Then for export condition like "node" you could choose the format with your extension.
218
218
 
219
219
  > [!NOTE]
220
220
  > All the `dependencies` and `peerDependencies` will be marked as external automatically and not included in the bundle. If you want to include them in the bundle, you can use the `--no-external` option.
@@ -248,8 +248,8 @@ For instance:
248
248
 
249
249
  If you need to separate the `production` and `development` exports condition, `packem` provides `process.env.NODE_ENV` injected by default if present that you don't need to manually inject yourself.
250
250
 
251
- - When the `production` exports condition is defined and the file ends with `*.production.*` in the package.json, the bundle will be minified.
252
- - When the `development` exports condition is defined and the file ends with `*.development.*` in the package.json, the bundle will not be minified.
251
+ - When the `production` exports condition is defined and the file ends with `*.production.*` in the package.json, the bundle will be minified.
252
+ - When the `development` exports condition is defined and the file ends with `*.development.*` in the package.json, the bundle will not be minified.
253
253
 
254
254
  ```json
255
255
  {
@@ -328,6 +328,9 @@ There are always cases that you need to share code among bundles, but they don't
328
328
 
329
329
  ```js
330
330
  // src/util.shared-runtime.js
331
+ /**
332
+ *
333
+ */
331
334
  export function sharedUtil() {
332
335
  /* ... */
333
336
  }
@@ -337,12 +340,12 @@ Then you can use them in different entry files:
337
340
 
338
341
  ```js
339
342
  // src/index.js
340
- import { sharedUtil } from "./util.shared-runtime";
343
+ import { sharedUtil as sharedUtility } from "./util.shared-runtime";
341
344
  ```
342
345
 
343
346
  ```js
344
347
  // src/lite.js
345
- import { sharedUtil } from "./util.shared-runtime";
348
+ import { sharedUtil as sharedUtility } from "./util.shared-runtime";
346
349
  ```
347
350
 
348
351
  `packem` will bundle the shared module into a separate **layer** which matches the file name convention, in the above case it's "shared", and that bundle will be referenced by the different entry bundles.
@@ -356,6 +359,7 @@ With multiple runtime bundles, such as having `default` and `react-server` toget
356
359
 
357
360
  ```js
358
361
  "use client";
362
+
359
363
  // src/app-context.shared-runtime.js
360
364
  export const AppContext = React.createContext(null);
361
365
  ```
@@ -396,7 +400,7 @@ Use the `--visualize` flag to generate a `packem-bundle-analyze.html` file at bu
396
400
  `packem` supports building module workers with the `--workers` flag, which are a special type of bundle that can be used to run code in a web worker.
397
401
 
398
402
  ```js
399
- worker = new Worker(new URL("./worker.js", import.meta.url), { type: "module" });
403
+ worker = new Worker(new URL("worker.js", import.meta.url), { type: "module" });
400
404
  // or simply:
401
405
  worker = new Worker("./worker.js", { type: "module" });
402
406
  ```
@@ -411,17 +415,17 @@ The value of `type` can be either `"build"` or `"dts"`, where `"build"` is the d
411
415
 
412
416
  The resolved plugins will be in the following order:
413
417
 
414
- - Alias
415
- - User plugins with enforce: 'pre'
416
- - Rollup core plugins
417
- - User plugins without enforce value
418
- - Rollup build plugins
419
- - User plugins with enforce: 'post'
420
- - Rollup post build plugins (minify, manifest, copy, reporting)
418
+ - Alias
419
+ - User plugins with enforce: 'pre'
420
+ - Rollup core plugins
421
+ - User plugins without enforce value
422
+ - Rollup build plugins
423
+ - User plugins with enforce: 'post'
424
+ - Rollup post build plugins (minify, manifest, copy, reporting)
421
425
 
422
426
  ```typescript
423
- import { defineConfig } from "@visulima/packem/config";
424
427
  import { optimizeLodashImports } from "@optimize-lodash/rollup-plugin";
428
+ import { defineConfig } from "@visulima/packem/config";
425
429
 
426
430
  export default defineConfig({
427
431
  // ...
@@ -450,13 +454,13 @@ Native Node.js import mapping supports conditional imports (eg. resolving differ
450
454
  {
451
455
  // ...
452
456
 
453
- imports: {
457
+ "imports": {
454
458
  // Mapping '~utils' to './src/utils.js'
455
459
  "~utils": "./src/utils.js",
456
460
 
457
461
  // Native Node.js import mapping (can't reference ./src)
458
- "#internal-package": "./vendors/package/index.js",
459
- },
462
+ "#internal-package": "./vendors/package/index.js"
463
+ }
460
464
  }
461
465
  ```
462
466
 
@@ -500,43 +504,45 @@ packem build --env.NODE_ENV=production
500
504
  You can use Packem programmatically in your Node.js applications without the CLI:
501
505
 
502
506
  ```typescript
503
- import { packem } from '@visulima/packem';
507
+ import { packem } from "@visulima/packem";
504
508
 
505
509
  // Basic usage
506
- await packem('./src', {
507
- mode: 'build',
508
- environment: 'production'
510
+ await packem("./src", {
511
+ environment: "production",
512
+ mode: "build",
509
513
  });
510
514
 
511
515
  // With custom options
512
- await packem('./src', {
513
- mode: 'build',
514
- environment: 'development',
516
+ await packem("./src", {
515
517
  declaration: true,
516
- minify: true,
517
- sourcemap: true,
518
+ environment: "development",
518
519
  logger: {
519
520
  // Custom logger options
520
- level: 'debug'
521
- }
521
+ level: "debug",
522
+ },
523
+ minify: true,
524
+ mode: "build",
525
+ sourcemap: true,
522
526
  });
523
527
  ```
524
528
 
525
529
  The `packem` function accepts the following parameters:
530
+
526
531
  - `rootDirectory` (string): The root directory of your project to bundle
527
532
  - `options` (PackemOptions): Configuration options that extend the BuildConfig interface
528
- - `mode`: The build mode ('build' | 'watch')
529
- - `environment`: The target environment ('development' | 'production')
530
- - `declaration`: Enable/disable TypeScript declaration file generation
531
- - `minify`: Enable/disable code minification
532
- - `sourcemap`: Enable/disable source map generation
533
- - `logger`: Logger configuration options
533
+ - `mode`: The build mode ('build' | 'watch')
534
+ - `environment`: The target environment ('development' | 'production')
535
+ - `declaration`: Enable/disable TypeScript declaration file generation
536
+ - `minify`: Enable/disable code minification
537
+ - `sourcemap`: Enable/disable source map generation
538
+ - `logger`: Logger configuration options
534
539
 
535
540
  For more detailed configuration options, refer to the [Configuration](#configuration) section.
536
541
 
537
542
  ## Validators
538
543
 
539
544
  ### Package.json Validation
545
+
540
546
  `Packem` validates your `package.json` file and checks if all fields are configured correctly, that are needed to publish your package.
541
547
 
542
548
  > [!NOTE]
@@ -556,10 +562,10 @@ export default defineConfig({
556
562
  limit: 1024 * 1024, // 1MB
557
563
  // or / and limits per file
558
564
  limits: {
559
- "index.cjs": 1024 * 1024, // 1MB
560
- "test.mjs": "1MB",
561
565
  // Glob pattern
562
566
  "**/*.mjs": "1MB",
567
+ "index.cjs": 1024 * 1024, // 1MB
568
+ "test.mjs": "1MB",
563
569
  },
564
570
  },
565
571
  },
@@ -634,21 +640,20 @@ export default defineConfig({
634
640
 
635
641
  You need to choose of the supported transformer to use isolated declaration types.
636
642
 
637
- - [oxc](https://github.com/oxc-project/oxc)
638
- - [@swc/core](https://github.com/swc-project/swc)
639
- - [typescript](https://github.com/microsoft/TypeScript)
643
+ - [oxc](https://github.com/oxc-project/oxc)
644
+ - [@swc/core](https://github.com/swc-project/swc)
645
+ - [typescript](https://github.com/microsoft/TypeScript)
640
646
 
641
647
  Default is `typescript`.
642
648
 
643
649
  ```ts
644
650
  import { defineConfig } from "@visulima/packem/config";
645
- import transformer from "@visulima/packem/transformer/esbuild";
646
651
  import isolatedDeclarationTransformer from "@visulima/packem/dts/isolated/transformer/typescript";
652
+ import transformer from "@visulima/packem/transformer/esbuild";
647
653
 
648
- // eslint-disable-next-line import/no-unused-modules
649
654
  export default defineConfig({
650
- transformer,
651
655
  isolatedDeclarationTransformer,
656
+ transformer,
652
657
  });
653
658
  ```
654
659
 
@@ -658,22 +663,22 @@ export default defineConfig({
658
663
 
659
664
  `packem` supports:
660
665
 
661
- - [PostCSS](https://github.com/postcss/postcss)
662
- - [Sass](https://github.com/sass/sass)
663
- - [Less](https://github.com/less/less.js)
664
- - [Stylus](https://github.com/stylus/stylus)
665
- - Up-to-date [CSS Modules](https://github.com/css-modules/css-modules) implementation
666
- - URL resolving/rewriting with asset handling
667
- - Ability to use `@import` statements inside regular CSS
668
- - Built-in assets handler
669
- - Ability to emit pure CSS for other plugins
670
- - Complete code splitting support, with respect for multiple entries, `preserveModules` and `manualChunks`
671
- - Multiple instances support, with check for already processed files
672
- - Proper sourcemaps, with included sources content by default
673
- - Respects `assetFileNames` for CSS file names
674
- - Respects sourcemaps from loaded files
675
- - Support for implementation forcing for Sass
676
- - Support for partials and `~` in Less import statements
666
+ - [PostCSS](https://github.com/postcss/postcss)
667
+ - [Sass](https://github.com/sass/sass)
668
+ - [Less](https://github.com/less/less.js)
669
+ - [Stylus](https://github.com/stylus/stylus)
670
+ - Up-to-date [CSS Modules](https://github.com/css-modules/css-modules) implementation
671
+ - URL resolving/rewriting with asset handling
672
+ - Ability to use `@import` statements inside regular CSS
673
+ - Built-in assets handler
674
+ - Ability to emit pure CSS for other plugins
675
+ - Complete code splitting support, with respect for multiple entries, `preserveModules` and `manualChunks`
676
+ - Multiple instances support, with check for already processed files
677
+ - Proper sourcemaps, with included sources content by default
678
+ - Respects `assetFileNames` for CSS file names
679
+ - Respects sourcemaps from loaded files
680
+ - Support for implementation forcing for Sass
681
+ - Support for partials and `~` in Less import statements
677
682
 
678
683
  ### PostCSS
679
684
 
@@ -698,17 +703,17 @@ Add the loader to your `packem.config.ts`:
698
703
 
699
704
  ```typescript
700
705
  import { defineConfig } from "@visulima/packem/config";
701
- import transformer from "@visulima/packem/transformer/esbuild";
702
706
  import postcssLoader from "@visulima/packem/css/loader/postcss";
703
707
  import sourceMapLoader from "@visulima/packem/css/loader/sourcemap";
708
+ import transformer from "@visulima/packem/transformer/esbuild";
704
709
 
705
710
  export default defineConfig({
706
- transformer,
707
711
  rollup: {
708
712
  css: {
709
713
  loaders: [postcssLoader, sourceMapLoader],
710
714
  },
711
715
  },
716
+ transformer,
712
717
  });
713
718
  ```
714
719
 
@@ -744,18 +749,18 @@ Add the loader to your `packem.config.ts`:
744
749
 
745
750
  ```typescript
746
751
  import { defineConfig } from "@visulima/packem/config";
747
- import transformer from "@visulima/packem/transformer/esbuild";
748
752
  import postcssLoader from "@visulima/packem/css/loader/postcss";
749
753
  import sassLoader from "@visulima/packem/css/loader/sass";
750
754
  import sourceMapLoader from "@visulima/packem/css/loader/sourcemap";
755
+ import transformer from "@visulima/packem/transformer/esbuild";
751
756
 
752
757
  export default defineConfig({
753
- transformer,
754
758
  rollup: {
755
759
  css: {
756
760
  loaders: [postcssLoader, sassLoader, sourceMapLoader],
757
761
  },
758
762
  },
763
+ transformer,
759
764
  });
760
765
  ```
761
766
 
@@ -779,18 +784,18 @@ Add the loader to your `packem.config.ts`:
779
784
 
780
785
  ```typescript
781
786
  import { defineConfig } from "@visulima/packem/config";
782
- import transformer from "@visulima/packem/transformer/esbuild";
783
- import postcssLoader from "@visulima/packem/css/loader/postcss";
784
787
  import lessLoader from "@visulima/packem/css/loader/less";
788
+ import postcssLoader from "@visulima/packem/css/loader/postcss";
785
789
  import sourceMapLoader from "@visulima/packem/css/loader/sourcemap";
790
+ import transformer from "@visulima/packem/transformer/esbuild";
786
791
 
787
792
  export default defineConfig({
788
- transformer,
789
793
  rollup: {
790
794
  css: {
791
795
  loaders: [postcssLoader, lessLoader, sourceMapLoader],
792
796
  },
793
797
  },
798
+ transformer,
794
799
  });
795
800
  ```
796
801
 
@@ -814,18 +819,18 @@ Add the loader to your `packem.config.ts`:
814
819
 
815
820
  ```typescript
816
821
  import { defineConfig } from "@visulima/packem/config";
817
- import transformer from "@visulima/packem/transformer/esbuild";
818
822
  import postcssLoader from "@visulima/packem/css/loader/postcss";
819
- import stylusLoader from "@visulima/packem/css/loader/stylus";
820
823
  import sourceMapLoader from "@visulima/packem/css/loader/sourcemap";
824
+ import stylusLoader from "@visulima/packem/css/loader/stylus";
825
+ import transformer from "@visulima/packem/transformer/esbuild";
821
826
 
822
827
  export default defineConfig({
823
- transformer,
824
828
  rollup: {
825
829
  css: {
826
830
  loaders: [postcssLoader, stylusLoader, sourceMapLoader],
827
831
  },
828
832
  },
833
+ transformer,
829
834
  });
830
835
  ```
831
836
 
@@ -890,7 +895,7 @@ Will look for `_custom` first (_with the appropriate extension(s)_), and then fo
890
895
  styles({
891
896
  mode: "inject", // Unnecessary, set by default
892
897
  // ...or with custom options for injector
893
- mode: ["inject", { container: "body", singleTag: true, prepend: true, attributes: { id: "global" } }],
898
+ mode: ["inject", { attributes: { id: "global" }, container: "body", prepend: true, singleTag: true }],
894
899
  // ...or with custom injector
895
900
  mode: ["inject", (varname, id) => `console.log(${varname},${JSON.stringify(id)})`],
896
901
  });
@@ -943,10 +948,12 @@ import { defineConfig } from "@visulima/packem/config";
943
948
  export default defineConfig({
944
949
  // ...
945
950
  onSuccess() {
946
- const server = http.createServer((req, res) => {
951
+ const server = http.createServer((request, res) => {
947
952
  res.end("Hello World!");
948
953
  });
954
+
949
955
  server.listen(3000);
956
+
950
957
  return () => {
951
958
  server.close();
952
959
  };
@@ -964,10 +971,10 @@ The packem configuration file is a JavaScript file that exports an object with t
964
971
 
965
972
  You choose which one of the three supported transformer to use.
966
973
 
967
- - [esbuild](https://github.com/evanw/esbuild)
968
- - [@swc/core](https://github.com/swc-project/swc)
969
- - [sucrase](https://github.com/alangpierce/sucrase)
970
- - [OXC](https://www.npmjs.com/package/oxc-transform)
974
+ - [esbuild](https://github.com/evanw/esbuild)
975
+ - [@swc/core](https://github.com/swc-project/swc)
976
+ - [sucrase](https://github.com/alangpierce/sucrase)
977
+ - [OXC](https://www.npmjs.com/package/oxc-transform)
971
978
 
972
979
  ### File types
973
980
 
@@ -998,10 +1005,12 @@ This will provide the following type shims:
998
1005
  > To override the default typing, add a type definition file that contains your typings. Then, add the type reference before `@visulima/packem/files`.
999
1006
  >
1000
1007
  > packem-env-override.d.ts (the file that contains your typings):
1008
+ >
1001
1009
  > ```ts
1002
- > declare module '*.svg' {
1003
- > const content: React.FC<React.SVGProps<SVGElement>>
1004
- > export default content
1010
+ > declare module "*.svg" {
1011
+ > const content: React.FC<React.SVGProps<SVGElement>>;
1012
+ >
1013
+ > export default content;
1005
1014
  > }
1006
1015
  > ```
1007
1016
  >
@@ -1014,12 +1023,12 @@ This will provide the following type shims:
1014
1023
 
1015
1024
  ## Related
1016
1025
 
1017
- - [bunchee](https://github.com/huozhi/bunchee) - Zero config bundler for ECMAScript and TypeScript packages
1018
- - [unbuild](https://github.com/unjs/unbuild) - 📦 An unified javascript build system
1019
- - [pkgroll](https://github.com/privatenumber/pkgroll) - 📦 Zero-config package bundler for Node.js + TypeScript
1020
- - [siroc](https://github.com/danielroe/siroc) - Zero-config build tooling for Node
1021
- - [tsup](https://github.com/egoist/tsup) - The simplest and fastest way to bundle your TypeScript libraries
1022
- - [microbundle](https://github.com/developit/microbundle) - Zero-configuration bundler for tiny JS libs, powered by Rollup.
1026
+ - [bunchee](https://github.com/huozhi/bunchee) - Zero config bundler for ECMAScript and TypeScript packages
1027
+ - [unbuild](https://github.com/unjs/unbuild) - 📦 An unified javascript build system
1028
+ - [pkgroll](https://github.com/privatenumber/pkgroll) - 📦 Zero-config package bundler for Node.js + TypeScript
1029
+ - [siroc](https://github.com/danielroe/siroc) - Zero-config build tooling for Node
1030
+ - [tsup](https://github.com/egoist/tsup) - The simplest and fastest way to bundle your TypeScript libraries
1031
+ - [microbundle](https://github.com/developit/microbundle) - Zero-configuration bundler for tiny JS libs, powered by Rollup.
1023
1032
 
1024
1033
  ## Supported Node.js Versions
1025
1034
 
@@ -1034,8 +1043,8 @@ If you would like to help take a look at the [list of issues](https://github.com
1034
1043
 
1035
1044
  ## Credits
1036
1045
 
1037
- - [Daniel Bannert](https://github.com/prisis)
1038
- - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
1046
+ - [Daniel Bannert](https://github.com/prisis)
1047
+ - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
1039
1048
 
1040
1049
  ## License
1041
1050
 
@@ -1,3 +1,3 @@
1
- "use strict";var v=Object.defineProperty;var g=(e,t)=>v(e,"name",{value:t,configurable:!0});const P=require("@visulima/colorize"),h=require("@visulima/path"),k=require("../../packem_shared/create-or-update-key-storage-mzqiq3Nk.cjs"),A=require("node:fs"),y=require("@visulima/fs"),F=require("typedoc");var $=Object.defineProperty,b=g((e,t)=>$(e,"name",{value:t,configurable:!0}),"w");const q=b(async(e,t,r,a)=>{if(t.length===0)return;const{format:n,marker:o,output:R,plugin:j,readmePath:s,jsonFileName:p,...w}=e;if(n==="inline"&&s===void 0)throw new Error("The `readmePath` option is required when using the `inline` format.");if(n!=="inline"&&typeof s=="string"&&a.warn({message:"The `readmePath` option is only used when the `inline` format is used.",prefix:"typedoc"}),n==="json"){if(p===void 0)throw new Error("The `jsonFileName` option is required when using the `json` format.");if(p.endsWith(".json")===!1)throw new Error("The `jsonFileName` option must end with `.json`.")}n!=="json"&&typeof p=="string"&&a.warn({message:"The `jsonFileName` option is only used when the `json` format is used.",prefix:"typedoc"});const E=t.map(f=>f.input),u=j??[];u.push("typedoc-plugin-rename-defaults"),(n==="inline"||n==="markdown")&&u.push("typedoc-plugin-markdown");const l=await F.Application.bootstrapWithPlugins({...w,compilerOptions:{allowJs:!0,declaration:!1,declarationMap:!1,esModuleInterop:!0,module:99,moduleResolution:100,noEmit:!0,noImplicitAny:!1,skipLibCheck:!0,sourceMap:!1,target:99,...w.compilerOptions},entryPoints:E,hideGenerator:!0,plugin:u,out:r,...n==="inline"?{hideBreadcrumbs:!0,hidePageHeader:!0,navigation:!1,outputFileStrategy:"modules",useCodeBlocks:!0}:{}},[]),d=await l.convert();if(d){if(n==="json")await l.generateJson(d,p);else if(n==="html")await l.generateDocs(d,r);else if(await l.generateOutputs(d),n==="inline"){if(o===void 0)throw new Error("The `marker` option is required when using the `inline` format.");const f=A.readdirSync(r,{withFileTypes:!0}).filter(i=>i.isFile());let m="";for(const i of f)i.name==="README.md"&&t.length>1||(m+=y.readFileSync(h.join(r,i.name)).replaceAll(`<!-- ${o}`,`<!-- _REPLACE_${o}`).replaceAll("<!-- ${marker}",`<!-- _REPLACE_\\${o}`));if(m!==""){const i=y.readFileSync(s),c=k.g(i,o,`
2
- `+m);if(!c){a.error({message:`Could not find the typedoc marker: <!-- ${o} --><!-- /${o} --> in ${s}`,prefix:"typedoc"});return}if(i===c)return;c&&y.writeFileSync(s,c.replaceAll(`<!-- _REPLACE_${o}`,`<!-- ${o}`).replaceAll(`<!-- _REPLACE_\\${o}`,"<!-- ${marker}"),{overwrite:!0})}}}},"generateReferenceDocumentation");var _=Object.defineProperty,T=g((e,t)=>_(e,"name",{value:t,configurable:!0}),"r");const C=T(async(e,t,r,a)=>{if(e.options.typedoc&&e.options.typedoc.format!==void 0){let n="unknown";e.pkg.dependencies?.typedoc?n=e.pkg.dependencies.typedoc:e.pkg.devDependencies?.typedoc&&(n=e.pkg.devDependencies.typedoc),t&&k.d("typedoc",t,e.logger,!0),a&&e.logger.raw(`
3
- `),e.logger.info({message:"Using "+P.cyan("typedoc")+" "+n+" to generate reference documentation",prefix:"typedoc"}),await e.hooks.callHook("typedoc:before",e);let o=e.options.rootDir;e.options.typedoc.output?o=e.options.typedoc.output:e.options.typedoc.format==="inline"&&t?o=h.join(t,"typedoc"):e.options.typedoc.format!=="json"&&(o=h.join(o,"api-docs")),await q(e.options.typedoc,e.options.entries,o,e.logger),await e.hooks.callHook("typedoc:done",e)}},"builder");module.exports=C;
1
+ "use strict";var v=Object.defineProperty;var g=(e,o)=>v(e,"name",{value:o,configurable:!0});const $=require("@visulima/colorize"),h=require("@visulima/path"),k=require("../../packem_shared/create-or-update-key-storage-DKcZnYd5.cjs"),P=require("node:fs"),y=require("@visulima/fs"),A=require("typedoc");var F=Object.defineProperty,b=g((e,o)=>F(e,"name",{value:o,configurable:!0}),"w");const q=b(async(e,o,a,s)=>{if(o.length===0)return;const{format:t,jsonFileName:n,marker:i,output:R,plugin:j,readmePath:p,...w}=e;if(t==="inline"&&p===void 0)throw new Error("The `readmePath` option is required when using the `inline` format.");if(t!=="inline"&&typeof p=="string"&&s.warn({message:"The `readmePath` option is only used when the `inline` format is used.",prefix:"typedoc"}),t==="json"){if(n===void 0)throw new Error("The `jsonFileName` option is required when using the `json` format.");if(!n.endsWith(".json"))throw new Error("The `jsonFileName` option must end with `.json`.")}t!=="json"&&typeof n=="string"&&s.warn({message:"The `jsonFileName` option is only used when the `json` format is used.",prefix:"typedoc"});const E=o.map(f=>f.input),u=j??[];u.push("typedoc-plugin-rename-defaults"),(t==="inline"||t==="markdown")&&u.push("typedoc-plugin-markdown");const l=await A.Application.bootstrapWithPlugins({...w,compilerOptions:{allowJs:!0,declaration:!1,declarationMap:!1,esModuleInterop:!0,module:99,moduleResolution:100,noEmit:!0,noImplicitAny:!1,skipLibCheck:!0,sourceMap:!1,target:99,...w.compilerOptions},entryPoints:E,hideGenerator:!0,out:a,plugin:u,...t==="inline"?{hideBreadcrumbs:!0,hidePageHeader:!0,navigation:!1,outputFileStrategy:"modules",useCodeBlocks:!0}:{}},[]),d=await l.convert();if(d){if(t==="json")await l.generateJson(d,n);else if(t==="html")await l.generateDocs(d,a);else if(await l.generateOutputs(d),t==="inline"){if(i===void 0)throw new Error("The `marker` option is required when using the `inline` format.");const f=P.readdirSync(a,{withFileTypes:!0}).filter(r=>r.isFile());let m="";for(const r of f)r.name==="README.md"&&o.length>1||(m+=y.readFileSync(h.join(a,r.name)).replaceAll(`<!-- ${i}`,`<!-- _REPLACE_${i}`).replaceAll("<!-- ${marker}",`<!-- _REPLACE_\\${i}`));if(m!==""){const r=y.readFileSync(p),c=k.g(r,i,`
2
+ ${m}`);if(!c){s.error({message:`Could not find the typedoc marker: <!-- ${i} --><!-- /${i} --> in ${p}`,prefix:"typedoc"});return}if(r===c)return;c&&y.writeFileSync(p,c.replaceAll(`<!-- _REPLACE_${i}`,`<!-- ${i}`).replaceAll(`<!-- _REPLACE_\\${i}`,"<!-- ${marker}"),{overwrite:!0})}}}},"generateReferenceDocumentation");var _=Object.defineProperty,T=g((e,o)=>_(e,"name",{value:o,configurable:!0}),"r");const C=T(async(e,o,a,s)=>{if(e.options.typedoc&&e.options.typedoc.format!==void 0){let t="unknown";e.pkg.dependencies?.typedoc?t=e.pkg.dependencies.typedoc:e.pkg.devDependencies?.typedoc&&(t=e.pkg.devDependencies.typedoc),o&&k.d("typedoc",o,e.logger,!0),s&&e.logger.raw(`
3
+ `),e.logger.info({message:`Using ${$.cyan("typedoc")} ${t} to generate reference documentation`,prefix:"typedoc"}),await e.hooks.callHook("typedoc:before",e);let n=e.options.rootDir;e.options.typedoc.output?n=e.options.typedoc.output:e.options.typedoc.format==="inline"&&o?n=h.join(o,"typedoc"):e.options.typedoc.format!=="json"&&(n=h.join(n,"api-docs")),await q(e.options.typedoc,e.options.entries,n,e.logger),await e.hooks.callHook("typedoc:done",e)}},"builder");module.exports=C;
@@ -1,3 +1,3 @@
1
- var j=Object.defineProperty;var g=(e,t)=>j(e,"name",{value:t,configurable:!0});import{cyan as v}from"@visulima/colorize";import{join as h}from"@visulima/path";import{g as P,d as A}from"../../packem_shared/create-or-update-key-storage-Bm-Xu0uJ.mjs";import{readdirSync as $}from"node:fs";import{readFileSync as w,writeFileSync as F}from"@visulima/fs";import{Application as b}from"typedoc";var T=Object.defineProperty,_=g((e,t)=>T(e,"name",{value:t,configurable:!0}),"w");const C=_(async(e,t,r,a)=>{if(t.length===0)return;const{format:n,marker:o,output:x,plugin:k,readmePath:s,jsonFileName:p,...y}=e;if(n==="inline"&&s===void 0)throw new Error("The `readmePath` option is required when using the `inline` format.");if(n!=="inline"&&typeof s=="string"&&a.warn({message:"The `readmePath` option is only used when the `inline` format is used.",prefix:"typedoc"}),n==="json"){if(p===void 0)throw new Error("The `jsonFileName` option is required when using the `json` format.");if(p.endsWith(".json")===!1)throw new Error("The `jsonFileName` option must end with `.json`.")}n!=="json"&&typeof p=="string"&&a.warn({message:"The `jsonFileName` option is only used when the `json` format is used.",prefix:"typedoc"});const E=t.map(m=>m.input),u=k??[];u.push("typedoc-plugin-rename-defaults"),(n==="inline"||n==="markdown")&&u.push("typedoc-plugin-markdown");const l=await b.bootstrapWithPlugins({...y,compilerOptions:{allowJs:!0,declaration:!1,declarationMap:!1,esModuleInterop:!0,module:99,moduleResolution:100,noEmit:!0,noImplicitAny:!1,skipLibCheck:!0,sourceMap:!1,target:99,...y.compilerOptions},entryPoints:E,hideGenerator:!0,plugin:u,out:r,...n==="inline"?{hideBreadcrumbs:!0,hidePageHeader:!0,navigation:!1,outputFileStrategy:"modules",useCodeBlocks:!0}:{}},[]),d=await l.convert();if(d){if(n==="json")await l.generateJson(d,p);else if(n==="html")await l.generateDocs(d,r);else if(await l.generateOutputs(d),n==="inline"){if(o===void 0)throw new Error("The `marker` option is required when using the `inline` format.");const m=$(r,{withFileTypes:!0}).filter(i=>i.isFile());let f="";for(const i of m)i.name==="README.md"&&t.length>1||(f+=w(h(r,i.name)).replaceAll(`<!-- ${o}`,`<!-- _REPLACE_${o}`).replaceAll("<!-- ${marker}",`<!-- _REPLACE_\\${o}`));if(f!==""){const i=w(s),c=P(i,o,`
2
- `+f);if(!c){a.error({message:`Could not find the typedoc marker: <!-- ${o} --><!-- /${o} --> in ${s}`,prefix:"typedoc"});return}if(i===c)return;c&&F(s,c.replaceAll(`<!-- _REPLACE_${o}`,`<!-- ${o}`).replaceAll(`<!-- _REPLACE_\\${o}`,"<!-- ${marker}"),{overwrite:!0})}}}},"generateReferenceDocumentation");var R=Object.defineProperty,D=g((e,t)=>R(e,"name",{value:t,configurable:!0}),"r");const B=D(async(e,t,r,a)=>{if(e.options.typedoc&&e.options.typedoc.format!==void 0){let n="unknown";e.pkg.dependencies?.typedoc?n=e.pkg.dependencies.typedoc:e.pkg.devDependencies?.typedoc&&(n=e.pkg.devDependencies.typedoc),t&&A("typedoc",t,e.logger,!0),a&&e.logger.raw(`
3
- `),e.logger.info({message:"Using "+v("typedoc")+" "+n+" to generate reference documentation",prefix:"typedoc"}),await e.hooks.callHook("typedoc:before",e);let o=e.options.rootDir;e.options.typedoc.output?o=e.options.typedoc.output:e.options.typedoc.format==="inline"&&t?o=h(t,"typedoc"):e.options.typedoc.format!=="json"&&(o=h(o,"api-docs")),await C(e.options.typedoc,e.options.entries,o,e.logger),await e.hooks.callHook("typedoc:done",e)}},"builder");export{B as default};
1
+ var j=Object.defineProperty;var g=(e,o)=>j(e,"name",{value:o,configurable:!0});import{cyan as v}from"@visulima/colorize";import{join as h}from"@visulima/path";import{g as $,d as P}from"../../packem_shared/create-or-update-key-storage-BATQud1F.mjs";import{readdirSync as A}from"node:fs";import{readFileSync as w,writeFileSync as F}from"@visulima/fs";import{Application as b}from"typedoc";var T=Object.defineProperty,_=g((e,o)=>T(e,"name",{value:o,configurable:!0}),"w");const C=_(async(e,o,a,s)=>{if(o.length===0)return;const{format:t,jsonFileName:n,marker:i,output:x,plugin:k,readmePath:p,...y}=e;if(t==="inline"&&p===void 0)throw new Error("The `readmePath` option is required when using the `inline` format.");if(t!=="inline"&&typeof p=="string"&&s.warn({message:"The `readmePath` option is only used when the `inline` format is used.",prefix:"typedoc"}),t==="json"){if(n===void 0)throw new Error("The `jsonFileName` option is required when using the `json` format.");if(!n.endsWith(".json"))throw new Error("The `jsonFileName` option must end with `.json`.")}t!=="json"&&typeof n=="string"&&s.warn({message:"The `jsonFileName` option is only used when the `json` format is used.",prefix:"typedoc"});const E=o.map(m=>m.input),u=k??[];u.push("typedoc-plugin-rename-defaults"),(t==="inline"||t==="markdown")&&u.push("typedoc-plugin-markdown");const l=await b.bootstrapWithPlugins({...y,compilerOptions:{allowJs:!0,declaration:!1,declarationMap:!1,esModuleInterop:!0,module:99,moduleResolution:100,noEmit:!0,noImplicitAny:!1,skipLibCheck:!0,sourceMap:!1,target:99,...y.compilerOptions},entryPoints:E,hideGenerator:!0,out:a,plugin:u,...t==="inline"?{hideBreadcrumbs:!0,hidePageHeader:!0,navigation:!1,outputFileStrategy:"modules",useCodeBlocks:!0}:{}},[]),d=await l.convert();if(d){if(t==="json")await l.generateJson(d,n);else if(t==="html")await l.generateDocs(d,a);else if(await l.generateOutputs(d),t==="inline"){if(i===void 0)throw new Error("The `marker` option is required when using the `inline` format.");const m=A(a,{withFileTypes:!0}).filter(r=>r.isFile());let f="";for(const r of m)r.name==="README.md"&&o.length>1||(f+=w(h(a,r.name)).replaceAll(`<!-- ${i}`,`<!-- _REPLACE_${i}`).replaceAll("<!-- ${marker}",`<!-- _REPLACE_\\${i}`));if(f!==""){const r=w(p),c=$(r,i,`
2
+ ${f}`);if(!c){s.error({message:`Could not find the typedoc marker: <!-- ${i} --><!-- /${i} --> in ${p}`,prefix:"typedoc"});return}if(r===c)return;c&&F(p,c.replaceAll(`<!-- _REPLACE_${i}`,`<!-- ${i}`).replaceAll(`<!-- _REPLACE_\\${i}`,"<!-- ${marker}"),{overwrite:!0})}}}},"generateReferenceDocumentation");var R=Object.defineProperty,D=g((e,o)=>R(e,"name",{value:o,configurable:!0}),"r");const B=D(async(e,o,a,s)=>{if(e.options.typedoc&&e.options.typedoc.format!==void 0){let t="unknown";e.pkg.dependencies?.typedoc?t=e.pkg.dependencies.typedoc:e.pkg.devDependencies?.typedoc&&(t=e.pkg.devDependencies.typedoc),o&&P("typedoc",o,e.logger,!0),s&&e.logger.raw(`
3
+ `),e.logger.info({message:`Using ${v("typedoc")} ${t} to generate reference documentation`,prefix:"typedoc"}),await e.hooks.callHook("typedoc:before",e);let n=e.options.rootDir;e.options.typedoc.output?n=e.options.typedoc.output:e.options.typedoc.format==="inline"&&o?n=h(o,"typedoc"):e.options.typedoc.format!=="json"&&(n=h(n,"api-docs")),await C(e.options.typedoc,e.options.entries,n,e.logger),await e.hooks.callHook("typedoc:done",e)}},"builder");export{B as default};
@@ -2,9 +2,7 @@ import type { Cli } from "@visulima/cerebro";
2
2
  /**
3
3
  * Creates and registers the build command with the CLI.
4
4
  * Handles various build modes, environment variables, and build configurations.
5
- *
6
- * @param cli - CLI instance to register the command with
7
- *
5
+ * @param cli CLI instance to register the command with
8
6
  * @example
9
7
  * ```typescript
10
8
  * // Usage from command line:
@@ -17,7 +15,6 @@ import type { Cli } from "@visulima/cerebro";
17
15
  * // With custom environment variables:
18
16
  * // packem build --env.API_URL=http://api.example.com
19
17
  * ```
20
- *
21
18
  * @internal
22
19
  */
23
20
  declare const createBuildCommand: (cli: Cli) => void;