@visulima/packem 1.3.0 → 1.4.1
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 +79 -0
- package/LICENSE.md +62 -0
- package/README.md +289 -2
- package/dist/builder/typedoc/index.cjs +3 -3
- package/dist/builder/typedoc/index.d.cts +34 -3
- package/dist/builder/typedoc/index.d.mts +35 -2
- package/dist/builder/typedoc/index.d.ts +34 -3
- package/dist/cli.mjs +116 -92
- package/dist/config.d.cts +40 -17
- package/dist/config.d.mts +40 -17
- package/dist/config.d.ts +40 -17
- package/dist/packem.cjs +86 -73
- package/dist/packem.d.cts +36 -4
- package/dist/packem.d.mts +36 -4
- package/dist/packem.d.ts +36 -4
- package/dist/packem.mjs +86 -73
- package/dist/packem_shared/constants-Bcej5NDs.cjs +1 -0
- package/dist/packem_shared/constants-ic_mxhvm.mjs +1 -0
- package/dist/packem_shared/create-or-update-key-storage-DOolYH4A.cjs +3 -0
- package/dist/packem_shared/ensure-auto-modules-9cmxx7iZ.mjs +1 -0
- package/dist/packem_shared/ensure-auto-modules-DBW-5Idh.cjs +1 -0
- package/dist/packem_shared/get-hash-WS4xNEhC.mjs +3 -0
- package/dist/packem_shared/get-hash-n81THiHZ.cjs +1 -0
- package/dist/packem_shared/index-BFKGQLWX.cjs +1 -0
- package/dist/packem_shared/index-J19UlsNC.mjs +1 -0
- package/dist/packem_shared/resolve-CisvRjnr.cjs +1 -0
- package/dist/packem_shared/resolve-aYsRgS8e.mjs +1 -0
- package/dist/packem_shared/{resolve-file-C9LytYzE.cjs → resolve-file-BffLoYJG.cjs} +1 -1
- package/dist/packem_shared/sourcemap-CXAd1Jcz.cjs +3 -0
- package/dist/packem_shared/sourcemap-DDVjvayf.mjs +3 -0
- package/dist/packem_shared/types-BLR6WWv2.d.cts +24 -0
- package/dist/packem_shared/types-BLR6WWv2.d.mts +24 -0
- package/dist/packem_shared/types-BLR6WWv2.d.ts +24 -0
- package/dist/packem_shared/types-CwzNHNx0.d.mts +463 -0
- package/dist/packem_shared/types-CzGE8V_d.d.cts +1951 -0
- package/dist/packem_shared/types-CzGE8V_d.d.mts +1951 -0
- package/dist/packem_shared/types-CzGE8V_d.d.ts +1951 -0
- package/dist/packem_shared/types-D8jzF-eM.d.ts +463 -0
- package/dist/packem_shared/types-DvWhOdt5.d.cts +10 -0
- package/dist/packem_shared/types-DvWhOdt5.d.mts +10 -0
- package/dist/packem_shared/types-DvWhOdt5.d.ts +10 -0
- package/dist/packem_shared/types-GPTFx90c.d.cts +463 -0
- package/dist/packem_shared/url-DFE8cAA0.cjs +1 -0
- package/dist/packem_shared/url-I6Jx3crl.mjs +1 -0
- package/dist/rollup/plugins/css/loaders/less/index.cjs +1 -0
- package/dist/rollup/plugins/css/loaders/less/index.d.cts +36 -0
- package/dist/rollup/plugins/css/loaders/less/index.d.mts +36 -0
- package/dist/rollup/plugins/css/loaders/less/index.d.ts +36 -0
- package/dist/rollup/plugins/css/loaders/less/index.mjs +1 -0
- package/dist/rollup/plugins/css/loaders/lightningcss.cjs +3 -0
- package/dist/rollup/plugins/css/loaders/lightningcss.d.cts +36 -0
- package/dist/rollup/plugins/css/loaders/lightningcss.d.mts +36 -0
- package/dist/rollup/plugins/css/loaders/lightningcss.d.ts +36 -0
- package/dist/rollup/plugins/css/loaders/lightningcss.mjs +3 -0
- package/dist/rollup/plugins/css/loaders/postcss/index.cjs +19 -0
- package/dist/rollup/plugins/css/loaders/postcss/index.d.cts +36 -0
- package/dist/rollup/plugins/css/loaders/postcss/index.d.mts +36 -0
- package/dist/rollup/plugins/css/loaders/postcss/index.d.ts +36 -0
- package/dist/rollup/plugins/css/loaders/postcss/index.mjs +19 -0
- package/dist/rollup/plugins/css/loaders/sass/index.cjs +8 -0
- package/dist/rollup/plugins/css/loaders/sass/index.d.cts +36 -0
- package/dist/rollup/plugins/css/loaders/sass/index.d.mts +36 -0
- package/dist/rollup/plugins/css/loaders/sass/index.d.ts +36 -0
- package/dist/rollup/plugins/css/loaders/sass/index.mjs +10 -0
- package/dist/rollup/plugins/css/loaders/sourcemap.cjs +1 -0
- package/dist/rollup/plugins/css/loaders/sourcemap.d.cts +36 -0
- package/dist/rollup/plugins/css/loaders/sourcemap.d.mts +36 -0
- package/dist/rollup/plugins/css/loaders/sourcemap.d.ts +36 -0
- package/dist/rollup/plugins/css/loaders/sourcemap.mjs +1 -0
- package/dist/rollup/plugins/css/loaders/stylus/index.cjs +1 -0
- package/dist/rollup/plugins/css/loaders/stylus/index.d.cts +36 -0
- package/dist/rollup/plugins/css/loaders/stylus/index.d.mts +36 -0
- package/dist/rollup/plugins/css/loaders/stylus/index.d.ts +36 -0
- package/dist/rollup/plugins/css/loaders/stylus/index.mjs +1 -0
- package/dist/rollup/plugins/css/minifiers/cssnano.cjs +1 -0
- package/dist/rollup/plugins/css/minifiers/cssnano.d.cts +36 -0
- package/dist/rollup/plugins/css/minifiers/cssnano.d.mts +36 -0
- package/dist/rollup/plugins/css/minifiers/cssnano.d.ts +36 -0
- package/dist/rollup/plugins/css/minifiers/cssnano.mjs +1 -0
- package/dist/rollup/plugins/css/minifiers/lightningcss.cjs +3 -0
- package/dist/rollup/plugins/css/minifiers/lightningcss.d.cts +36 -0
- package/dist/rollup/plugins/css/minifiers/lightningcss.d.mts +36 -0
- package/dist/rollup/plugins/css/minifiers/lightningcss.d.ts +36 -0
- package/dist/rollup/plugins/css/minifiers/lightningcss.mjs +3 -0
- package/dist/rollup/plugins/css/runtime/inject-css.cjs +1 -0
- package/dist/rollup/plugins/css/runtime/inject-css.d.cts +8 -0
- package/dist/rollup/plugins/css/runtime/inject-css.d.mts +8 -0
- package/dist/rollup/plugins/css/runtime/inject-css.d.ts +8 -0
- package/dist/rollup/plugins/css/runtime/inject-css.mjs +1 -0
- package/dist/rollup/plugins/esbuild/index.cjs +1 -1
- package/dist/rollup/plugins/esbuild/index.d.cts +7 -4
- package/dist/rollup/plugins/esbuild/index.d.mts +9 -4
- package/dist/rollup/plugins/esbuild/index.d.ts +7 -4
- package/dist/rollup/plugins/esbuild/index.mjs +1 -1
- package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.cts +34 -3
- package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.mts +35 -2
- package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +34 -3
- package/dist/rollup/plugins/sucrase/index.cjs +1 -1
- package/dist/rollup/plugins/sucrase/index.d.cts +6 -4
- package/dist/rollup/plugins/sucrase/index.d.mts +7 -3
- package/dist/rollup/plugins/sucrase/index.d.ts +6 -4
- package/dist/rollup/plugins/sucrase/index.mjs +1 -1
- package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.cts +34 -3
- package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.mts +35 -2
- package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts +34 -3
- package/dist/rollup/plugins/swc/swc-plugin.cjs +1 -1
- package/dist/rollup/plugins/swc/swc-plugin.d.cts +5 -4
- package/dist/rollup/plugins/swc/swc-plugin.d.mts +6 -3
- package/dist/rollup/plugins/swc/swc-plugin.d.ts +5 -4
- package/dist/rollup/plugins/swc/swc-plugin.mjs +1 -1
- package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.cts +35 -4
- package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.mts +36 -3
- package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +35 -4
- package/package.json +237 -10
- package/dist/build.d.cts +0 -6
- package/dist/build.d.mts +0 -4
- package/dist/build.d.ts +0 -6
- package/dist/builder/typedoc/generate-reference-documentation.d.cts +0 -6
- package/dist/builder/typedoc/generate-reference-documentation.d.mts +0 -4
- package/dist/builder/typedoc/generate-reference-documentation.d.ts +0 -6
- package/dist/cli.d.mts +0 -1
- package/dist/commands/add.d.mts +0 -3
- package/dist/commands/build.d.mts +0 -3
- package/dist/commands/init.d.mts +0 -3
- package/dist/constants.d.cts +0 -12
- package/dist/constants.d.mts +0 -12
- package/dist/constants.d.ts +0 -12
- package/dist/hooks/preset/auto.d.cts +0 -5
- package/dist/hooks/preset/auto.d.mts +0 -3
- package/dist/hooks/preset/auto.d.ts +0 -5
- package/dist/hooks/preset/utils/infer-entries.d.cts +0 -14
- package/dist/hooks/preset/utils/infer-entries.d.mts +0 -12
- package/dist/hooks/preset/utils/infer-entries.d.ts +0 -14
- package/dist/hooks/preset/utils/overwrite-with-publish-config.d.cts +0 -6
- package/dist/hooks/preset/utils/overwrite-with-publish-config.d.mts +0 -4
- package/dist/hooks/preset/utils/overwrite-with-publish-config.d.ts +0 -6
- package/dist/hooks/preset/utils/resolve-preset.d.cts +0 -6
- package/dist/hooks/preset/utils/resolve-preset.d.mts +0 -4
- package/dist/hooks/preset/utils/resolve-preset.d.ts +0 -6
- package/dist/jit/create-stub.d.cts +0 -5
- package/dist/jit/create-stub.d.mts +0 -3
- package/dist/jit/create-stub.d.ts +0 -5
- package/dist/packem_shared/constants-CWqse9ko.mjs +0 -1
- package/dist/packem_shared/constants-ISPLmXDX.cjs +0 -1
- package/dist/packem_shared/create-or-update-key-storage-DslhcsTU.cjs +0 -3
- package/dist/rollup/build-types.d.cts +0 -6
- package/dist/rollup/build-types.d.mts +0 -4
- package/dist/rollup/build-types.d.ts +0 -6
- package/dist/rollup/build.d.cts +0 -6
- package/dist/rollup/build.d.mts +0 -4
- package/dist/rollup/build.d.ts +0 -6
- package/dist/rollup/get-rollup-options.d.cts +0 -5
- package/dist/rollup/get-rollup-options.d.mts +0 -5
- package/dist/rollup/get-rollup-options.d.ts +0 -5
- package/dist/rollup/plugins/chunk-splitter/gather.d.cts +0 -10
- package/dist/rollup/plugins/chunk-splitter/gather.d.mts +0 -8
- package/dist/rollup/plugins/chunk-splitter/gather.d.ts +0 -10
- package/dist/rollup/plugins/chunk-splitter/index.d.cts +0 -8
- package/dist/rollup/plugins/chunk-splitter/index.d.mts +0 -6
- package/dist/rollup/plugins/chunk-splitter/index.d.ts +0 -8
- package/dist/rollup/plugins/chunk-splitter/parse/index.d.cts +0 -6
- package/dist/rollup/plugins/chunk-splitter/parse/index.d.mts +0 -4
- package/dist/rollup/plugins/chunk-splitter/parse/index.d.ts +0 -6
- package/dist/rollup/plugins/chunk-splitter/parse/types.d.cts +0 -24
- package/dist/rollup/plugins/chunk-splitter/parse/types.d.mts +0 -24
- package/dist/rollup/plugins/chunk-splitter/parse/types.d.ts +0 -24
- package/dist/rollup/plugins/cjs-interop.d.cts +0 -9
- package/dist/rollup/plugins/cjs-interop.d.mts +0 -9
- package/dist/rollup/plugins/cjs-interop.d.ts +0 -9
- package/dist/rollup/plugins/copy.d.cts +0 -26
- package/dist/rollup/plugins/copy.d.mts +0 -26
- package/dist/rollup/plugins/copy.d.ts +0 -26
- package/dist/rollup/plugins/esbuild/get-render-chunk.d.cts +0 -16
- package/dist/rollup/plugins/esbuild/get-render-chunk.d.mts +0 -14
- package/dist/rollup/plugins/esbuild/get-render-chunk.d.ts +0 -16
- package/dist/rollup/plugins/esbuild/optmize-deps.d.cts +0 -5
- package/dist/rollup/plugins/esbuild/optmize-deps.d.mts +0 -3
- package/dist/rollup/plugins/esbuild/optmize-deps.d.ts +0 -5
- package/dist/rollup/plugins/esbuild/types.d.cts +0 -40
- package/dist/rollup/plugins/esbuild/types.d.mts +0 -40
- package/dist/rollup/plugins/esbuild/types.d.ts +0 -40
- package/dist/rollup/plugins/esbuild/warn.d.cts +0 -6
- package/dist/rollup/plugins/esbuild/warn.d.mts +0 -4
- package/dist/rollup/plugins/esbuild/warn.d.ts +0 -6
- package/dist/rollup/plugins/esm-shim-cjs-syntax.d.cts +0 -8
- package/dist/rollup/plugins/esm-shim-cjs-syntax.d.mts +0 -8
- package/dist/rollup/plugins/esm-shim-cjs-syntax.d.ts +0 -8
- package/dist/rollup/plugins/fix-dynamic-import-extension.d.cts +0 -5
- package/dist/rollup/plugins/fix-dynamic-import-extension.d.mts +0 -3
- package/dist/rollup/plugins/fix-dynamic-import-extension.d.ts +0 -5
- package/dist/rollup/plugins/isolated-declarations/extend-string.d.cts +0 -4
- package/dist/rollup/plugins/isolated-declarations/extend-string.d.mts +0 -2
- package/dist/rollup/plugins/isolated-declarations/extend-string.d.ts +0 -4
- package/dist/rollup/plugins/isolated-declarations/index.d.cts +0 -16
- package/dist/rollup/plugins/isolated-declarations/index.d.mts +0 -16
- package/dist/rollup/plugins/isolated-declarations/index.d.ts +0 -16
- package/dist/rollup/plugins/isolated-declarations/lowest-common-ancestor.d.cts +0 -4
- package/dist/rollup/plugins/isolated-declarations/lowest-common-ancestor.d.mts +0 -2
- package/dist/rollup/plugins/isolated-declarations/lowest-common-ancestor.d.ts +0 -4
- package/dist/rollup/plugins/json.d.cts +0 -6
- package/dist/rollup/plugins/json.d.mts +0 -4
- package/dist/rollup/plugins/json.d.ts +0 -6
- package/dist/rollup/plugins/jsx-remove-attributes.d.cts +0 -8
- package/dist/rollup/plugins/jsx-remove-attributes.d.mts +0 -8
- package/dist/rollup/plugins/jsx-remove-attributes.d.ts +0 -8
- package/dist/rollup/plugins/license.d.cts +0 -18
- package/dist/rollup/plugins/license.d.mts +0 -18
- package/dist/rollup/plugins/license.d.ts +0 -18
- package/dist/rollup/plugins/metafile.d.cts +0 -9
- package/dist/rollup/plugins/metafile.d.mts +0 -7
- package/dist/rollup/plugins/metafile.d.ts +0 -9
- package/dist/rollup/plugins/node10-compatibility-plugin.d.cts +0 -7
- package/dist/rollup/plugins/node10-compatibility-plugin.d.mts +0 -7
- package/dist/rollup/plugins/node10-compatibility-plugin.d.ts +0 -7
- package/dist/rollup/plugins/plugin-cache.d.cts +0 -14
- package/dist/rollup/plugins/plugin-cache.d.mts +0 -12
- package/dist/rollup/plugins/plugin-cache.d.ts +0 -14
- package/dist/rollup/plugins/prepend-directives.d.cts +0 -5
- package/dist/rollup/plugins/prepend-directives.d.mts +0 -3
- package/dist/rollup/plugins/prepend-directives.d.ts +0 -5
- package/dist/rollup/plugins/preserve-directives.d.cts +0 -19
- package/dist/rollup/plugins/preserve-directives.d.mts +0 -17
- package/dist/rollup/plugins/preserve-directives.d.ts +0 -19
- package/dist/rollup/plugins/raw.d.cts +0 -7
- package/dist/rollup/plugins/raw.d.mts +0 -7
- package/dist/rollup/plugins/raw.d.ts +0 -7
- package/dist/rollup/plugins/resolve-file-url.d.cts +0 -5
- package/dist/rollup/plugins/resolve-file-url.d.mts +0 -3
- package/dist/rollup/plugins/resolve-file-url.d.ts +0 -5
- package/dist/rollup/plugins/shebang.d.cts +0 -9
- package/dist/rollup/plugins/shebang.d.mts +0 -9
- package/dist/rollup/plugins/shebang.d.ts +0 -9
- package/dist/rollup/plugins/sucrase/types.d.cts +0 -7
- package/dist/rollup/plugins/sucrase/types.d.mts +0 -7
- package/dist/rollup/plugins/sucrase/types.d.ts +0 -7
- package/dist/rollup/plugins/swc/types.d.cts +0 -7
- package/dist/rollup/plugins/swc/types.d.mts +0 -7
- package/dist/rollup/plugins/swc/types.d.ts +0 -7
- package/dist/rollup/plugins/typescript/patch-typescript-types.d.cts +0 -14
- package/dist/rollup/plugins/typescript/patch-typescript-types.d.mts +0 -14
- package/dist/rollup/plugins/typescript/patch-typescript-types.d.ts +0 -14
- package/dist/rollup/plugins/typescript/resolve-tsconfig-paths.d.cts +0 -36
- package/dist/rollup/plugins/typescript/resolve-tsconfig-paths.d.mts +0 -36
- package/dist/rollup/plugins/typescript/resolve-tsconfig-paths.d.ts +0 -36
- package/dist/rollup/plugins/typescript/resolve-tsconfig-root-dirs.d.cts +0 -28
- package/dist/rollup/plugins/typescript/resolve-tsconfig-root-dirs.d.mts +0 -26
- package/dist/rollup/plugins/typescript/resolve-tsconfig-root-dirs.d.ts +0 -28
- package/dist/rollup/plugins/typescript/resolve-typescript-mjs-cjs.d.cts +0 -12
- package/dist/rollup/plugins/typescript/resolve-typescript-mjs-cjs.d.mts +0 -10
- package/dist/rollup/plugins/typescript/resolve-typescript-mjs-cjs.d.ts +0 -12
- package/dist/rollup/plugins/typescript/utils/patch-cjs-default-export.d.cts +0 -8
- package/dist/rollup/plugins/typescript/utils/patch-cjs-default-export.d.mts +0 -6
- package/dist/rollup/plugins/typescript/utils/patch-cjs-default-export.d.ts +0 -8
- package/dist/rollup/utils/append-plugins.d.cts +0 -6
- package/dist/rollup/utils/append-plugins.d.mts +0 -4
- package/dist/rollup/utils/append-plugins.d.ts +0 -6
- package/dist/rollup/utils/chunks/create-split-chunks.d.cts +0 -6
- package/dist/rollup/utils/chunks/create-split-chunks.d.mts +0 -4
- package/dist/rollup/utils/chunks/create-split-chunks.d.ts +0 -6
- package/dist/rollup/utils/chunks/get-custom-module-layer.d.cts +0 -4
- package/dist/rollup/utils/chunks/get-custom-module-layer.d.mts +0 -2
- package/dist/rollup/utils/chunks/get-custom-module-layer.d.ts +0 -4
- package/dist/rollup/utils/chunks/get-module-layer.d.cts +0 -12
- package/dist/rollup/utils/chunks/get-module-layer.d.mts +0 -10
- package/dist/rollup/utils/chunks/get-module-layer.d.ts +0 -12
- package/dist/rollup/utils/get-chunk-filename.d.cts +0 -5
- package/dist/rollup/utils/get-chunk-filename.d.mts +0 -3
- package/dist/rollup/utils/get-chunk-filename.d.ts +0 -5
- package/dist/rollup/utils/get-entry-file-names.d.cts +0 -5
- package/dist/rollup/utils/get-entry-file-names.d.mts +0 -3
- package/dist/rollup/utils/get-entry-file-names.d.ts +0 -5
- package/dist/rollup/utils/get-hash.d.cts +0 -4
- package/dist/rollup/utils/get-hash.d.mts +0 -2
- package/dist/rollup/utils/get-hash.d.ts +0 -4
- package/dist/rollup/utils/resolve-aliases.d.cts +0 -5
- package/dist/rollup/utils/resolve-aliases.d.mts +0 -3
- package/dist/rollup/utils/resolve-aliases.d.ts +0 -5
- package/dist/rollup/utils/resolve-file.d.cts +0 -4
- package/dist/rollup/utils/resolve-file.d.mts +0 -2
- package/dist/rollup/utils/resolve-file.d.ts +0 -4
- package/dist/rollup/watch.d.cts +0 -6
- package/dist/rollup/watch.d.mts +0 -4
- package/dist/rollup/watch.d.ts +0 -6
- package/dist/types.d.cts +0 -280
- package/dist/types.d.mts +0 -280
- package/dist/types.d.ts +0 -280
- package/dist/utils/array-includes.d.cts +0 -4
- package/dist/utils/array-includes.d.mts +0 -2
- package/dist/utils/array-includes.d.ts +0 -4
- package/dist/utils/arrayify.d.cts +0 -4
- package/dist/utils/arrayify.d.mts +0 -2
- package/dist/utils/arrayify.d.ts +0 -4
- package/dist/utils/create-or-update-key-storage.d.cts +0 -5
- package/dist/utils/create-or-update-key-storage.d.mts +0 -3
- package/dist/utils/create-or-update-key-storage.d.ts +0 -5
- package/dist/utils/enhance-rollup-error.d.cts +0 -5
- package/dist/utils/enhance-rollup-error.d.mts +0 -3
- package/dist/utils/enhance-rollup-error.d.ts +0 -5
- package/dist/utils/extract-export-filenames.d.cts +0 -14
- package/dist/utils/extract-export-filenames.d.mts +0 -14
- package/dist/utils/extract-export-filenames.d.ts +0 -14
- package/dist/utils/file-cache.d.cts +0 -13
- package/dist/utils/file-cache.d.mts +0 -11
- package/dist/utils/file-cache.d.ts +0 -13
- package/dist/utils/find-packem-file.d.cts +0 -4
- package/dist/utils/find-packem-file.d.mts +0 -2
- package/dist/utils/find-packem-file.d.ts +0 -4
- package/dist/utils/get-package-name.d.cts +0 -4
- package/dist/utils/get-package-name.d.mts +0 -2
- package/dist/utils/get-package-name.d.ts +0 -4
- package/dist/utils/get-package-side-effect.d.cts +0 -5
- package/dist/utils/get-package-side-effect.d.mts +0 -3
- package/dist/utils/get-package-side-effect.d.ts +0 -5
- package/dist/utils/get-regex-matches.d.cts +0 -4
- package/dist/utils/get-regex-matches.d.mts +0 -2
- package/dist/utils/get-regex-matches.d.ts +0 -4
- package/dist/utils/group-by-keys.d.cts +0 -5
- package/dist/utils/group-by-keys.d.mts +0 -3
- package/dist/utils/group-by-keys.d.ts +0 -5
- package/dist/utils/infer-export-type.d.cts +0 -2
- package/dist/utils/infer-export-type.d.mts +0 -2
- package/dist/utils/infer-export-type.d.ts +0 -2
- package/dist/utils/kill-process.d.cts +0 -17
- package/dist/utils/kill-process.d.mts +0 -15
- package/dist/utils/kill-process.d.ts +0 -17
- package/dist/utils/levenstein.d.cts +0 -4
- package/dist/utils/levenstein.d.mts +0 -2
- package/dist/utils/levenstein.d.ts +0 -4
- package/dist/utils/load-package-json.d.cts +0 -8
- package/dist/utils/load-package-json.d.mts +0 -6
- package/dist/utils/load-package-json.d.ts +0 -8
- package/dist/utils/log-build-errors.d.cts +0 -5
- package/dist/utils/log-build-errors.d.mts +0 -3
- package/dist/utils/log-build-errors.d.ts +0 -5
- package/dist/utils/memoize.d.cts +0 -12
- package/dist/utils/memoize.d.mts +0 -10
- package/dist/utils/memoize.d.ts +0 -12
- package/dist/utils/prepare-entries.d.cts +0 -5
- package/dist/utils/prepare-entries.d.mts +0 -3
- package/dist/utils/prepare-entries.d.ts +0 -5
- package/dist/utils/replace-content-within-marker.d.cts +0 -4
- package/dist/utils/replace-content-within-marker.d.mts +0 -2
- package/dist/utils/replace-content-within-marker.d.ts +0 -4
- package/dist/utils/warn.d.cts +0 -5
- package/dist/utils/warn.d.mts +0 -3
- package/dist/utils/warn.d.ts +0 -5
- package/dist/validator/package-json/index.d.cts +0 -5
- package/dist/validator/package-json/index.d.mts +0 -3
- package/dist/validator/package-json/index.d.ts +0 -5
- package/dist/validator/package-json/validate-dependencies.d.cts +0 -5
- package/dist/validator/package-json/validate-dependencies.d.mts +0 -3
- package/dist/validator/package-json/validate-dependencies.d.ts +0 -5
- package/dist/validator/package-json/validate-package-entries.d.cts +0 -5
- package/dist/validator/package-json/validate-package-entries.d.mts +0 -3
- package/dist/validator/package-json/validate-package-entries.d.ts +0 -5
- package/dist/validator/package-json/validate-package-fields.d.cts +0 -5
- package/dist/validator/package-json/validate-package-fields.d.mts +0 -3
- package/dist/validator/package-json/validate-package-fields.d.ts +0 -5
- package/dist/validator/validate-alias-entries.d.cts +0 -5
- package/dist/validator/validate-alias-entries.d.mts +0 -3
- package/dist/validator/validate-alias-entries.d.ts +0 -5
package/dist/packem.mjs
CHANGED
|
@@ -1,114 +1,127 @@
|
|
|
1
|
-
var
|
|
1
|
+
var bo=Object.defineProperty;var m=(e,t)=>bo(e,"name",{value:t,configurable:!0});import{readdirSync as jt,existsSync as xt}from"node:fs";import{stat as kt,chmod as vo,rm as wo}from"node:fs/promises";import qe from"node:module";import Ne,{env as $o,versions as jo}from"node:process";import{cyan as D,bold as W,gray as G,green as xo,yellow as ko,grey as Eo}from"@visulima/colorize";import{findCacheDirSync as So}from"@visulima/find-cache-dir";import{readFile as Et,isAccessible as Le,writeFile as Oo,readFileSync as We,writeFileSync as ne,writeJsonSync as St,readJsonSync as Ot,walk as Do,isAccessibleSync as z,collectSync as No,ensureDirSync as Po,emptyDir as Co}from"@visulima/fs";import{formatBytes as H,duration as Xe}from"@visulima/humanizer";import{normalize as U,join as j,relative as T,dirname as K,basename as re,isAbsolute as Ue,resolve as k,parse as Pe,toNamespacedPath as be,extname as Dt}from"@visulima/path";import{readTsConfig as _o,findTsConfig as Mo}from"@visulima/tsconfig";import Io from"browserslist";import{defu as To}from"defu";import{createHooks as Fo}from"hookable";import{createJiti as Nt}from"jiti";import{rollup as Pt,watch as Ye,VERSION as Ao}from"rollup";import{exec as Ro}from"tinyexec";import Ct from"@rollup/plugin-alias";import Jo from"@rollup/plugin-commonjs";import Bo from"@rollup/plugin-dynamic-import-vars";import{nodeResolve as _t}from"@rollup/plugin-node-resolve";import Mt from"@rollup/plugin-replace";import{wasm as Lo}from"@rollup/plugin-wasm";import{isRelative as It,resolveAlias as Wo}from"@visulima/path/utils";import Uo from"rollup-plugin-polyfill-node";import{visualizer as Ko}from"rollup-plugin-visualizer";import{minVersion as Tt,valid as zo,coerce as Vo}from"semver";import{E as Q,D as Ke,C as Ho,S as Go,R as Ft,a as ve,P as pe,b as Qe,c as se,A as ae}from"./packem_shared/constants-ic_mxhvm.mjs";import we from"node:assert/strict";import{extractAssignedNames as qo,createFilter as Z}from"@rollup/pluginutils";import Y from"magic-string";import Xo from"glob-parent";import{glob as Yo,isDynamicPattern as Ze,globSync as Qo}from"tinyglobby";import{P as Zo,g as es}from"./packem_shared/index-J19UlsNC.mjs";import{SourceMapGenerator as ts}from"source-map-js";import{m as Ae}from"./packem_shared/sourcemap-DDVjvayf.mjs";import{i as os,a as ss,b as et,c as tt,e as Ce,d as ns,f as q}from"./packem_shared/get-hash-WS4xNEhC.mjs";import{n as _e}from"./packem_shared/ensure-auto-modules-9cmxx7iZ.mjs";import{findStaticImports as At,fileURLToPath as rs,resolveModuleExportNames as is,resolvePath as ot}from"mlly";import{parseAsync as as}from"oxc-parser";import ls from"@rollup/plugin-json";import cs from"rollup-plugin-license";import{g as ps,d as us}from"./packem_shared/create-or-update-key-storage-BxGi6kMH.mjs";import{fileURLToPath as ds}from"node:url";import{parse as fs}from"@babel/parser";import ms from"child_process";import{parsePackageJson as gs}from"@visulima/package/package-json";import{NotFoundError as hs}from"@visulima/fs/error";import{distance as ys}from"fastest-levenshtein";import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
|
|
2
2
|
import __cjs_path__ from "node:path"; // -- packem CommonJS __dirname shim --
|
|
3
3
|
import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
4
4
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
6
6
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
7
|
-
var
|
|
7
|
+
var bs=Object.defineProperty,vs=m((e,t)=>bs(e,"name",{value:t,configurable:!0}),"a$i");const Re=vs((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):o===t),"arrayIncludes");var ws=Object.defineProperty,$s=m((e,t)=>ws(e,"name",{value:t,configurable:!0}),"a$h");const ue=$s(e=>e==null?[]:Array.isArray(e)?e:[e],"arrayify");var js=Object.defineProperty,xs=m((e,t)=>js(e,"name",{value:t,configurable:!0}),"a$g");const Rt=xs((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var ks=Object.defineProperty,Jt=m((e,t)=>ks(e,"name",{value:t,configurable:!0}),"s$d");const Es=Jt((e,t,o)=>{const s=o??new Map;return(...n)=>{const r=t?typeof t=="function"?t(...n):t:JSON.stringify({args:n}),i=s.get(r);if(i!==void 0)return i;const l=e(...n);return s.set(r,l),l}},"memoize"),Ss=Jt(e=>{const t=new Map;return o=>Es(e,o,t)},"memoizeByKey");var Os=Object.defineProperty,de=m((e,t)=>Os(e,"name",{value:t,configurable:!0}),"r$d");const Ds=de(function*(e){switch(e.declaration?.type){case"ClassDeclaration":case"FunctionDeclaration":{const{id:t}=e.declaration;we(t,"Expected class/function to have a name"),yield t.name;break}case"VariableDeclaration":{for(const t of e.declaration.declarations)for(const o of qo(t.id))yield o;break}}},"exportName"),Ns=de(function*(e){if(e.declaration)for(const t of Ds(e))yield{exportedName:t,from:"self",type:"named"};else if(e.source)yield{bindings:e.specifiers.map(t=>({exportedName:t.exported.name,importedName:t.local.name})),from:"other",source:e.source.value,type:"named"};else for(const t of e.specifiers)yield{exportedName:t.exported.name,from:"self",type:"named"}},"parseExportNamed"),Ps=de(function*(e){e.exported?yield{exportedName:e.exported.name,from:"self",type:"named"}:yield{from:"other",source:e.source.value,type:"barrel"}},"parseExportAll"),Cs=de(function*(){yield{exportedName:"default",from:"self",type:"named"}},"parseExportDefault"),_s=de(function*(e,t){we(t.code!=null,`Module ${t.id} doesn't have associated code`);const o=e.parse(t.code);for(const s of o.body)switch(s.type){case"ExportAllDeclaration":{yield*Ps(s);break}case"ExportDefaultDeclaration":{yield*Cs();break}case"ExportNamedDeclaration":{yield*Ns(s);break}}},"parseExports");var Ms=Object.defineProperty,fe=m((e,t)=>Ms(e,"name",{value:t,configurable:!0}),"n$b");const Bt=fe(async function(e,t,o){const s=await e.resolve(t,o.id);if(we(s,`Rollup can't resolve ${t} from ${o.id}`),s.external)return null;const n=await e.load(s);return we(n,`Rollup doesn't have a module for id ${s.id}`),n},"getImportedModule"),Is=fe(async function*(e,t,o){const s=await Bt(e,t.source,o);s&&(yield*ze(e,s))},"gatherBarrelReExports"),Ts=fe(async function*(e,t,o){const s=await Bt(e,t.source,o);if(!s)return;const n=new Map(t.bindings.map(r=>[r.importedName,r]));for await(const r of ze(e,s)){const i=n.get(r.exportedName);i&&(yield{...r,exportedName:i.exportedName})}},"gatherNamedReExports"),Fs=fe(async function*(e,t){yield{exportedName:t.exportedName,id:e.id,sourceName:t.exportedName}},"gatherNamedSelfExports"),ze=fe(async function*(e,t){for(const o of _s(e,t))o.from==="self"?yield*Fs(t,o):o.type==="barrel"?yield*Is(e,o,t):yield*Ts(e,o,t)},"gatherExports");var As=Object.defineProperty,Rs=m((e,t)=>As(e,"name",{value:t,configurable:!0}),"r$c");const Js=Rs(()=>({moduleParsed:{async handler(e){if(e.isEntry)for await(const t of ze(this,e))t.id!==e.id&&this.emitFile({id:t.id,name:t.exportedName,preserveSignature:"exports-only",type:"chunk"})},order:"post"},name:"packem:chunk-splitter"}),"chunkSplitter");var Bs=Object.defineProperty,Ls=m((e,t)=>Bs(e,"name",{value:t,configurable:!0}),"r$b");const Ws=Ls((e,t)=>{const o=e,s=[];let n;for(;(n=o.exec(t))!==null;)n.index===o.lastIndex&&o.lastIndex++,n.forEach(r=>{s.push(r)});return s.filter(Boolean)},"getRegexMatches");var Us=Object.defineProperty,Ks=m((e,t)=>Us(e,"name",{value:t,configurable:!0}),"a$f");const Lt=Ks(e=>{const t=Ws(/export\s(\{\s(.*)\s\}|default\s.*);/g,e);if(t.length===0)return null;const o=t.at(-1).split(", ");let s="";for(const n of o)if(!n.includes("type")&&(n.includes("default ")&&(s=n.split("default ")[1]),n.includes("as"))){const[r,i]=n.split(" as ");i==="default"&&(s=r)}if(s!==""){const n=new Y(e);return n.replace(new RegExp(`(,s)?${s} as default(,)?`),""),n.replace(new RegExp(`export default ${s};
|
|
8
8
|
?`),""),n.append(`
|
|
9
9
|
|
|
10
|
-
export = `+
|
|
11
|
-
module.exports.default = `+i[2]+";");let l
|
|
12
|
-
`)
|
|
13
|
-
`),o&&(
|
|
14
|
-
`),(
|
|
15
|
-
`),t&&(r
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
`),
|
|
25
|
-
`),
|
|
10
|
+
export = `+s+";"),{code:n.toString().replace(/export\s\{\s\s\};/,""),map:n.generateMap({hires:!0})}}return null},"patchCjsDefaultExport");var zs=Object.defineProperty,st=m((e,t)=>zs(e,"name",{value:t,configurable:!0}),"i$9");const Wt=st(({addDefaultProperty:e=!1,logger:t,type:o})=>({name:"packem:cjs-interop",renderChunk:st(async(s,n,r)=>{if(n.type!=="chunk"||!n.isEntry)return null;if(r.format==="cjs"&&r.exports==="auto"){const i=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(s);if(i===null||i.length<3)return null;const l=new Y(s);l.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),l.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&l.append(`
|
|
11
|
+
module.exports.default = `+i[2]+";");let c=l.toString();return c=c.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+n.fileName+".",prefix:"plugin:cjs-interop"}),{code:c,map:l.generateMap({hires:!0})}}return r.format==="es"&&/\.d\.(?:ts|cts)$/.test(n.fileName)?o!=="commonjs"&&n.fileName.endsWith(".d.mts")?null:Lt(s):null},"renderChunk")}),"cjsInteropPlugin");var Vs=Object.defineProperty,Hs=m((e,t)=>Vs(e,"name",{value:t,configurable:!0}),"f$c");const Gs=Hs((e,t)=>{const o=new Map,s={copyOnce:!0,exactFileNames:!0,flatten:!1,...e};let{targets:n}=s;return Array.isArray(n)?n=n.map(r=>{if(typeof r=="string")return{src:r};if(typeof r=="object"&&"src"in r)return r}).filter(Boolean):typeof n=="string"&&(n=[{src:n}]),{async buildStart(){const r=await Promise.all(n.flatMap(i=>Array.isArray(i.src)?i.src.map(l=>({...i,src:l})):i).map(async i=>await Yo(ue(i.src),{ignore:ue(i.exclude).filter(Boolean)}).then(l=>({dest:i.dest??"",parent:Xo(i.src),src:l}))));for(const i of r)for(const l of i.src){let c;o.has(l)?c=o.get(l):(c={copied:[],dest:[],timestamp:0},o.set(l,c));const a=s.flatten?U(i.dest):j(i.dest,T(i.parent,K(l)));c.dest.includes(a)||c.dest.push(a),this.addWatchFile(l)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...o].map(async([i,l])=>{let c;try{const a=await kt(i);if(!a.isFile())return;const p=a.mtime.getTime();p>l.timestamp&&(l.timestamp=p,l.copied=[]),c=await Et(i,{buffer:!0})}catch(a){t.error({context:[a],message:`error reading file ${i}`,prefix:"plugin:copy"});return}for(const a of l.dest){if(s.copyOnce&&l.copied.includes(a))continue;const p=re(i),d=j(a,p);try{this.emitFile({[s.exactFileNames?"fileName":"name"]:d,source:c,type:"asset"}),t.debug({message:`copied ${i} → ${d}`,prefix:"plugin:copy"}),l.copied.push(a)}catch(u){t.error({context:[u],message:`error copying file ${i} → ${d}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");var qs=Object.defineProperty,Xs=m((e,t)=>qs(e,"name",{value:t,configurable:!0}),"r$a");const nt=Xs((e,t)=>{if(!t)return!1;if(typeof t=="function")return t(e);if(typeof t.test=="function")return t.test(e);throw new Error("Invalid condition type")},"matchFile");var Ys=Object.defineProperty,Qs=m((e,t)=>Ys(e,"name",{value:t,configurable:!0}),"a$e");const Zs=4,en=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):Zs;let tn=class{static{m(this,"f")}static{Qs(this,"LoaderManager")}test;loaders=new Map;options;workQueue;logger;constructor({extensions:t,loaders:o,logger:s,options:n}){this.test=r=>t.some(i=>r.toLowerCase().endsWith(i)),o.length>0&&this.add(...o),this.options=n,this.logger=s}add(...t){for(const o of t)this.loaders.has(o.name)||this.loaders.set(o.name,o)}isSupported(t){if(this.test(t))return!0;for(const[,o]of this.loaders)if(nt(t,o.test))return!0;return!1}async process(t,o){this.workQueue||(this.workQueue=new Zo({concurrency:en-1}));for await(const[s,n]of this.loaders){const r={...o,options:this.options[s]??{}};if(n.alwaysProcess||nt(r.id,n.test)){this.logger.debug(`Processing ${s} loader for ${r.id}`);const i=await this.workQueue.add(n.process.bind(r,t));i&&(t=i)}}return t}};var on=Object.defineProperty,sn=m((e,t)=>on(e,"name",{value:t,configurable:!0}),"u$9");const nn=sn(async e=>{const t=new ts({file:""}),o=[];let s=0;for await(const{css:n,map:r}of e){o.push(n);const i=Ae(r),l=i.toObject();if(!l)continue;const c=i.toConsumer();if(c){if(c.eachMapping(a=>{t.addMapping({generated:{column:a.generatedColumn,line:s+a.generatedLine},name:a.name,original:{column:a.originalColumn,line:a.originalLine},source:a.source})}),l.sourcesContent)for(const a of l.sources)t.setSourceContent(a,c.sourceContentFor(a,!0));s+=n.split(`
|
|
12
|
+
`).length}}return{css:o.join(`
|
|
13
|
+
`),map:t}},"concat");var rn=Object.defineProperty,ce=m((e,t)=>rn(e,"name",{value:t,configurable:!0}),"b$3");const an=ce(async(e,t)=>e.sort((o,s)=>t.indexOf(o.name)-t.indexOf(s.name)),"sortByNameOrder"),ln=ce(async(e,t,o,s,n,r,i,l,c,a)=>{const p={...a,...e.alias},d=Z(e.include,e.exclude),u=os(e.sourceMap),f={...ss(e.mode),autoModules:e.autoModules??!1,dts:e.dts,extensions:e.extensions,namedExports:e.namedExports};typeof f.inject=="object"&&f.inject.treeshakeable&&(f.namedExports=!1,t.info({message:"Disabling named exports due to `inject.treeshakeable` option",prefix:"css"}));let h=!1;if(e.loaders)for(const w of e.loaders)w.name==="postcss"&&(h=!0);else e.loaders=[];h&&(f.postcss={...e.postcss,config:et(e.postcss?.config,{}),import:tt(e.postcss?.import,p),modules:et(e.postcss?.modules,void 0),to:e.postcss?.to,url:tt(e.postcss?.url,p)},e.postcss?.parser&&(f.postcss.parser=await Ce(e.postcss.parser,"parser",s)),e.postcss?.syntax&&(f.postcss.syntax=await Ce(e.postcss.syntax,"syntax",s)),e.postcss?.stringifier&&(f.postcss.stringifier=await Ce(e.postcss.stringifier,"stringifier",s)),e.postcss?.plugins&&(f.postcss.plugins=await ns(e.postcss.plugins,s)));const g=new tn({extensions:f.extensions,loaders:await an(e.loaders,["sourcemap","stylus","less","sass","postcss"]),logger:t,options:{...e,...f,alias:p}});let v=[];const b=ce((w,$)=>{const O=[];for(const y of Object.keys(w)){const P=new Set;let _=[y];do{const J=[];for(const A of _){if(P.has(A))continue;if(g.isSupported(A)){d(A)&&J.push(A);continue}P.add(A);const te=$(A);te&&J.push(...te.importedIds)}_=J}while(_.some(J=>!g.isSupported(J)));O.push(..._)}return O},"traverseImportedModules");return{augmentChunkHash(w){if(v.length===0)return null;const $=b(w.modules,this.getModuleInfo),O=v.filter(y=>$.includes(y.id)).sort((y,P)=>$.lastIndexOf(y.id)-$.lastIndexOf(P.id)).map(y=>`${re(y.id)}:${y.css}`);return O.length===0?null:O.join(":")},async generateBundle(w,$){if(v.length===0||!(w.dir||w.file))return;const O=Object.values($),y=w.dir??K(w.file),P=O.filter(E=>E.type==="chunk"),_=P.filter(E=>!E.facadeModuleId),J=w.preserveModules?P:P.filter(E=>E.isEntry||E.isDynamicEntry),A=[],te=ce(async(E,N)=>{const x=typeof f.extract=="string"?U(f.extract).replace(/^\.[/\\]/,""):U(`${E}.css`);Ue(x)&&this.error(["Extraction path must be relative to the output directory,",`which is ${T(s,y)}`].join(`
|
|
14
|
+
`)),It(x)&&this.error(["Extraction path must be nested inside output directory,",`which is ${T(s,y)}`].join(`
|
|
15
|
+
`));const B=v.filter(L=>N.includes(L.id)).sort((L,oe)=>N.lastIndexOf(L.id)-N.lastIndexOf(oe.id)),me=await nn(B);return{css:me.css,map:Ae(me.map.toString()).relative(K(k(y,x))).toString(),name:x}},"getExtractedData"),R=ce(E=>{if(w.file)return Pe(w.file).name;if(w.preserveModules){const{dir:N,name:x}=Pe(E.fileName);return N?j(N,x):x}return E.name},"getName"),V=[];if(typeof f.extract=="string"){t.debug({message:`Extracting to ${f.extract}`,prefix:"css"});const E=[];for(const x of _){const B=b(x.modules,this.getModuleInfo);V.push(...B),E.push(...B)}for(const x of J)E.push(...b(x.modules,this.getModuleInfo).filter(B=>!V.includes(B)));const N=R(P[0]);A.push([N,E])}else{t.debug({message:"Extracting to individual files",prefix:"css"});for(const E of _){const N=b(E.modules,this.getModuleInfo);if(N.length===0)continue;V.push(...N);const x=R(E);A.push([x,N])}for(const E of J){const N=b(E.modules,this.getModuleInfo).filter(B=>!V.includes(B));if(N.length===0)continue;const x=R(E);A.push([x,N])}}for await(const[E,N]of A){const x=await te(E,N);if(typeof e.onExtract=="function"&&!e.onExtract(x))continue;if(c&&e.minifier){t.info({message:`Minifying ${x.name} with ${e.minifier.name}`,prefix:"css"});const{css:L,map:oe}=await e.minifier.handler.bind({browserTargets:o,warn:this.warn.bind(this)})(x,u,e[e.minifier.name]??{});x.css=L,x.map=oe}const B={fileName:x.name,name:x.name,names:[x.name],originalFileName:x.name,originalFileNames:[x.name],source:x.css,type:"asset"},me=this.emitFile(B);if(x.map&&u){const L=this.getFileName(me),oe=typeof w.assetFileNames=="string"?U(K(w.assetFileNames)):typeof w.assetFileNames=="function"?U(K(w.assetFileNames(B))):"assets",ie=Ae(x.map).modify(C=>(C.file=re(L),C)).modifySources(C=>{if(C==="<no source>"||oe.length<=1)return C;C=`../${C}`;for(const De of oe)De==="/"&&(C=`../${C}`);return C});if(u.inline)ie.modify(C=>u.transform?.(C,U(j(y,L)))),$[L].source+=ie.toCommentData();else{const C=`${L}.map`;ie.modify(yo=>u.transform?.(yo,U(j(y,C)))),this.emitFile({fileName:C,source:ie.toString(),type:"asset"});const{base:De}=Pe(C);$[L].source+=ie.toCommentFile(De)}}}},name:"packem:css",async transform(w,$){if(!d($)||!g.isSupported($)||w.replaceAll(/\s/g,"")==="")return null;try{return this.parse(w,{}),this.warn(`Skipping processed file ${T(s,$)}`),null}catch{}typeof e.onImport=="function"&&e.onImport(w,$);const O={alias:p,assets:new Map,autoModules:f.autoModules,browserTargets:o,cwd:s,debug:l,deps:new Set,dts:f.dts,emit:f.emit,environment:r,extensions:f.extensions,extract:f.extract,id:$,inject:f.inject,logger:t,namedExports:f.namedExports,options:{},plugin:this,sourceDir:n,sourceMap:u,useSourcemap:i,warn:this.warn.bind(this)},y=await g.process({code:w},O);for(const P of O.deps)this.addWatchFile(P);for(const[P,_]of O.assets)this.emitFile({fileName:P,source:_,type:"asset"});if(y.extracted){const{id:P}=y.extracted;v=v.filter(_=>_.id!==P),v.push(y.extracted)}return{code:y.code,map:u&&y.map?y.map:{mappings:""},meta:{styles:y.meta},moduleSideEffects:y.extracted?!0:null}}}},"default");var cn=Object.defineProperty,pn=m((e,t)=>cn(e,"name",{value:t,configurable:!0}),"u$8");const un=`
|
|
16
|
+
/* eslint-disable */
|
|
17
|
+
/* prettier-ignore */
|
|
18
|
+
// @ts-nocheck
|
|
19
|
+
/**
|
|
20
|
+
* Generated by packem
|
|
21
|
+
* @see https://npmjs.com/@visulima/packem
|
|
22
|
+
*/
|
|
23
|
+
`.trim(),dn=pn((e,t,o)=>{let s;return e.postcss&&typeof e.postcss.modules=="boolean"?s=e.postcss.modules:e.lightningcss&&typeof e.lightningcss.modules=="boolean"&&(s=e.lightningcss.modules),{async transform(n,r){let i=s;if(e.postcss&&typeof e.postcss.modules=="object"?i=_e(e.postcss.modules.include,r):e.lightningcss&&typeof e.lightningcss.modules=="object"&&(i=_e(e.lightningcss.modules.include,r)),e.autoModules&&i===void 0&&(i=_e(e.autoModules,r)),!i)return null;const{types:l}=this.getModuleInfo(r)?.meta.styles??{};return l===void 0||await Le(r)&&(await Oo(r+".d.ts",`${un}
|
|
24
|
+
${l}`),o.info({message:`Generated types for ${U(r).replace(t+"/","")}`,prefix:"dts:css-modules"}),this.addWatchFile(r+".d.ts")),null}}},"cssModulesTypes");var fn=Object.defineProperty,Ee=m((e,t)=>fn(e,"name",{value:t,configurable:!0}),"t$9");const mn=/\Wrequire(?:\.resolve)?\(/,gn=Ee((e,t)=>{if($o.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes("// -- packem CommonJS __filename shim")||e.includes("// -- packem CommonJS __dirname shim")||e.includes("// -- packem CommonJS require shim")))return null;let o=!1,s=!1,n=!1;if(e.includes("__filename")&&(o=!0),e.includes("__dirname")&&(s=!0),mn.test(e)&&(n=!0),!o&&!s&&!n)return null;const r=At(e).pop(),i=r?r.end:0,l=new Y(e);return l.appendRight(i,t(o,s,n)),{code:l.toString(),map:l.generateMap()}},"CJSToESM"),hn=Ee((e,t,o)=>{let s="";return(e||t)&&(s+=`import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
|
|
25
|
+
`),t&&(s+=`import __cjs_path__ from "node:path"; // -- packem CommonJS __dirname shim --
|
|
26
|
+
`),o&&(s+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
27
|
+
`),(e||t)&&(s+=`const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
28
|
+
`),t&&(s+=`const __dirname = __cjs_path__.dirname(__filename);
|
|
29
|
+
`),o&&(s+=`const require = __cjs_mod__.createRequire(import.meta.url);
|
|
30
|
+
`),s},"generateCJSShim"),yn=Ee((e,t,o)=>{let s="";return o&&(s+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
31
|
+
`),e&&(s+=`const __filename = import.meta.filename; // -- packem CommonJS __filename shim --
|
|
32
|
+
`),t&&(s+=`const __dirname = import.meta.dirname; // -- packem CommonJS __dirname shim --
|
|
33
|
+
`),o&&(s+=`const require = __cjs_mod__.createRequire(import.meta.url);
|
|
34
|
+
`),s},"generateCJSShimNode20_11"),bn=Ee((e,t)=>{const o=Z(t.include,t.exclude);return{name:"packem:esm-shim-cjs-syntax",renderChunk(s,n,r){if(r.format==="es"&&o(n.fileName)){let i=hn;if(e.engines?.node){const l=Tt(e.engines.node);l&&l.major>=20&&l.minor>=11&&(i=yn)}return gn(s,i)}return null}}},"esmShimCjsSyntaxPlugin");var vn=Object.defineProperty,wn=m((e,t)=>vn(e,"name",{value:t,configurable:!0}),"m$a");const $n=wn(()=>({name:"packem:fix-dynamic-import-extension",renderChunk(e,t,o){return o.format==="es"||o.format==="cjs"?{code:e.replaceAll(/(import\(.*)(.ts)(['´"`]\))/g,"$1."+(o.format==="es"?"mjs":"cjs")+"$3"),map:null}:null}}),"fixDynamicImportExtension");var jn=Object.defineProperty,xn=m((e,t)=>jn(e,"name",{value:t,configurable:!0}),"a$d");const kn=xn((e,t)=>{const o=e.replace(/^\.\//,""),s=t.replace(/^\.\//,"");if(s.startsWith(o))return e+s.slice(o.length);if(e.endsWith(t))return e;const n=e.split("/"),r=t.split("/");let i=n.length-1,l=r.length-1;for(;i>=0&&l>=0&&n[i]===r[l];)i--,l--;const c=n.slice(0,i).join("/"),a=r.slice(l).join("/");return c+(a?"/"+a:"")},"extendString");var En=Object.defineProperty,Sn=m((e,t)=>En(e,"name",{value:t,configurable:!0}),"s$a");const On=Sn((...e)=>{if(e.length===0)return"";if(e.length===1)return K(e[0]);e=e.map(n=>be(n));const[t,...o]=e;let s=t.split("/");for(const n of o){const r=n.split("/",s.length);let i=0;for(const l of r)if(l===s[i])i+=1;else{s=s.slice(0,i);break}s=s.slice(0,i)}return s.length<=1&&s[0]===""?`/${s[0]}`:s.join("/")},"lowestCommonAncestor");var Dn=Object.defineProperty,Me=m((e,t)=>Dn(e,"name",{value:t,configurable:!0}),"m$8");const Nn=Me((e,t,o,s,n={})=>{const r=Z(n.include,n.exclude),i={},l=Me((a,p)=>{i[a.replace(Q,"")]=p},"addOutput");async function c(a,p){if(!r(p))return;let d;try{const g=await as(a,{sourceFilename:p});d=JSON.parse(g.program)}catch{}if(d){const g=d.body.filter(v=>v.type==="ImportDeclaration"||v.type==="ExportAllDeclaration"||v.type==="ExportNamedDeclaration");for(const v of g){if(!v.source||re(v.source.value).includes("."))continue;const b=await this.resolve(v.source.value,p);if(!(!b||b.external)&&(b.id.endsWith(".ts")||b.id.endsWith(".cts")||b.id.endsWith(".mts")||b.id.endsWith(".tsx")||b.id.endsWith(".ctsx")||b.id.endsWith(".mtsx"))){const w=b.id.replace(e+"/","");a=a.replaceAll('from "'+v.source.value+'"','from "'+kn(v.source.value,w)+'"')}}}const{errors:u,sourceText:f}=await t(p,a);if(u.length>0){if(n.ignoreErrors){this.warn(u[0]);return}return this.error(u[0])}if(l(p,f),!d)return;const h=d.body.filter(g=>g.type==="ImportDeclaration"?g.importKind==="type"?!0:g.specifiers?.every(v=>v.type==="ImportSpecifier"&&v.importKind==="type"):g.type==="ExportNamedDeclaration"||g.type==="ExportAllDeclaration"?g.exportKind==="type"?!0:g.type==="ExportNamedDeclaration"&&g.specifiers?.every(v=>v.type==="ExportSpecifier"&&v.exportKind==="type"):!1);for await(const g of h){if(!g.source)continue;const v=await this.resolve(g.source.value,p);if(!v)return;const b=v.id;if(r(b)&&!i[b.replace(Q,"")])try{const w=await Et(b);await c.call(this,w,b)}catch{}}}return m(c,"h"),Me(c,"transform"),{name:"packem:isolated-declarations",async renderStart(a,{input:p}){const d=On(...Array.isArray(p)?p:Object.values(p));typeof a.entryFileNames=="function"&&(a.entryFileNames=a.entryFileNames({name:a.name}));const u=a.entryFileNames.replace(/\.(.)?[jt]sx?$/,(f,h)=>`.d.${h||""}ts`);for await(let[f,h]of Object.entries(i)){if(s&&a.format==="cjs"){const v=Lt(h);v!==null&&(h=v.code)}const g=h.includes("from '")?"'":'"';(o===!0||o==="compatible")&&a.format==="cjs"&&this.emitFile({fileName:u.replace("[name]",T(d,f)).replace(".cts",".ts"),source:h.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(v,b,w,$)=>b+g+($||w)+".d.ts"+g+";"),type:"asset"}),this.emitFile({fileName:u.replace("[name]",T(d,f)),source:h.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(v,b,w,$)=>b+g+($||w)+(a.format==="cjs"?".d.cts":".d.mts")+g+";"),type:"asset"})}},transform:c}},"isolatedDeclarationsPlugin");var Pn=Object.defineProperty,Cn=m((e,t)=>Pn(e,"name",{value:t,configurable:!0}),"n$9");const rt="export default ",Ut=Cn(e=>{const t=ls(e);return{...t,name:"packem:json",transform(o,s){const n=t.transform?.call(this,o,s);return n&&typeof n!="string"&&"code"in n&&n.code?.startsWith(rt)&&(n.code=n.code.replace(rt,"module.exports = ")),n}}},"JSONPlugin");class _n{static{m(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:m(()=>this.should_skip=!0,"skip"),remove:m(()=>this.should_remove=!0,"remove"),replace:m(t=>this.replacement=t,"replace")}}replace(t,o,s,n){t&&o&&(s!=null?t[o][s]=n:t[o]=n)}remove(t,o,s){t&&o&&(s!=null?t[o].splice(s,1):delete t[o])}}class Mn extends _n{static{m(this,"SyncWalker")}constructor(t,o){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:m(()=>this.should_skip=!0,"skip"),remove:m(()=>this.should_remove=!0,"remove"),replace:m(s=>this.replacement=s,"replace")},this.enter=t,this.leave=o}visit(t,o,s,n){if(t){if(this.enter){const i=this.should_skip,l=this.should_remove,c=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,o,s,n),this.replacement&&(t=this.replacement,this.replace(o,s,n,t)),this.should_remove&&this.remove(o,s,n);const a=this.should_skip,p=this.should_remove;if(this.should_skip=i,this.should_remove=l,this.replacement=c,a)return t;if(p)return null}let r;for(r in t){const i=t[r];if(i&&typeof i=="object")if(Array.isArray(i)){const l=i;for(let c=0;c<l.length;c+=1){const a=l[c];it(a)&&(this.visit(a,t,r,c)||c--)}}else it(i)&&this.visit(i,t,r,null)}if(this.leave){const i=this.replacement,l=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,t,o,s,n),this.replacement&&(t=this.replacement,this.replace(o,s,n,t)),this.should_remove&&this.remove(o,s,n);const c=this.should_remove;if(this.replacement=i,this.should_remove=l,c)return null}}return t}}function it(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}m(it,"isNode");function Kt(e,{enter:t,leave:o}){return new Mn(t,o).visit(e,null)}m(Kt,"walk");var In=Object.defineProperty,Tn=m((e,t)=>In(e,"name",{value:t,configurable:!0}),"u$7");const Fn=Tn(({attributes:e,logger:t})=>{const o=Z([/\.[tj]sx$/],/node_modules/);if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform(s,n){if(!o(n))return null;let r=null;try{r=this.parse(s,{allowReturnOutsideFunction:!0})}catch(c){return this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${n}" and remove the jsx attribute.`}),t.warn(c),null}let i=!1;const l=new Y(s);return Kt(r,{enter(c){if(c.type==="CallExpression"&&c.callee.type==="Identifier"&&c.callee.name==="jsx"){const a=c.arguments.filter(p=>p.type==="ObjectExpression"&&Array.isArray(p.properties));for(const p of a)for(const d of p.properties)d.type==="Property"&&d.key.type==="Literal"&&d.value.type==="Literal"&&e.includes(d.key.value)&&(l.overwrite(d.start-2,d.end,""),i=!0)}}}),i?{code:l.toString(),map:l.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var An=Object.defineProperty,zt=m((e,t)=>An(e,"name",{value:t,configurable:!0}),"d$a");const Rn=zt(e=>{const t=[],o=[];return e.forEach(s=>{s.startsWith("(")?t.push(s):o.push(s)}),[...o.sort(),...t.sort()]},"sortLicenses"),Vt=zt(({dtsMarker:e,licenseFilePath:t,licenseTemplate:o,logger:s,marker:n,mode:r,packageName:i})=>cs({thirdParty(l){const c=new Set,a=l.sort(({name:d},{name:u})=>(d||0)>(u||0)?1:(u||0)>(d||0)?-1:0).map(({author:d,contributors:u,license:f,licenseText:h,maintainers:g,name:v,repository:b})=>{let w="## "+v+`
|
|
35
|
+
`;f&&(w+=`License: ${f}
|
|
36
|
+
`);const $=new Set;for(const O of[d,...g,...u]){const y=typeof O=="string"?O:O?.name;y&&$.add(y)}return $.size>0&&(w+=`By: ${[...$].join(", ")}
|
|
37
|
+
`),b&&(w+=`Repository: ${typeof b=="string"?b:b.url}
|
|
38
|
+
`),h&&(w+=`
|
|
26
39
|
`+h.trim().replaceAll(/\r\n|\r/g,`
|
|
27
40
|
`).replaceAll(`<!-- ${n} -->`,"").replaceAll(e?`<!-- ${e} -->`:"","").replaceAll(`<!-- /${n} -->`,"").replaceAll(e?`<!-- /${e} -->`:"","").trim().split(`
|
|
28
|
-
`).map(
|
|
41
|
+
`).map(O=>O?`> ${O}`:">").join(`
|
|
29
42
|
`)+`
|
|
30
|
-
`),
|
|
43
|
+
`),f&&c.add(f),w}).join(`
|
|
31
44
|
---------------------------------------
|
|
32
45
|
|
|
33
|
-
`);if(
|
|
46
|
+
`);if(a===""){s.info({message:"No dependencies license information found.",prefix:"plugin:license:"+r});return}const p=o(Rn(c),a,i);try{const d=We(t),u=ps(d,n,p);if(!u){s.error({message:`Could not find the license marker: <!-- ${n} --><!-- /${n} --> in ${t}`,prefix:"plugin:license:"+r});return}d!==u&&(ne(t,u),s.info({message:`${t} updated.`,prefix:"plugin:license:"+r}))}catch(d){s.error(d)}}}),"license");var Jn=Object.defineProperty,Bn=m((e,t)=>Jn(e,"name",{value:t,configurable:!0}),"i$7");const Ln=Bn(e=>({async buildEnd(){const t=[];for(const s of this.getModuleIds()){const n=this.getModuleInfo(s);if(n!=null&&!n.isExternal)for(const r of n.importedIds)t.push({source:s,target:r})}if(Array.isArray(t)&&t.length===0)return;const o=k(e.rootDir,e.outDir,"graph.json");St(o,t)},name:"packem:metafile"}),"metafilePlugin");var Wn=Object.defineProperty,Un=m((e,t)=>Wn(e,"name",{value:t,configurable:!0}),"g$5");let at=!1;const Kn=Un((e,t,o,s,n,r)=>{if(r!=="*"&&zo(Vo(r))===null)throw new Error("Invalid typeScriptVersion option. It must be a valid semver range.");return{name:"packem:node10-compatibility",writeBundle(){at||(e.info({message:"Declaration node10 compatibility mode is enabled.",prefix:"plugin:node10-compatibility"}),at=!0);const i={};for(const a of t)for(const p of a.exportKey)p.includes("/*")?i[p]=["./"+j(o,K(a.name),"*.d.ts")]:i[p]=[...i[p]??[],"./"+j(o,a.name+".d.ts")];const l=j(s,"package.json"),c=Ot(l);n==="file"&&Object.keys(i).length>0?(St(l,{...c,typesVersions:{...c.typesVersions,[r]:i}},{detectIndent:!0}),e.info({message:'Your package.json "typesVersions" field has been updated.',prefix:"plugin:node10-compatibility"})):Object.keys(i).length>0&&e.info({message:`Please add the following field into your package.json to enable node 10 compatibility:
|
|
34
47
|
|
|
35
48
|
${JSON.stringify({typesVersions:{"*":i}},null,4)}
|
|
36
|
-
`,prefix:"plugin:node10-compatibility"})}}},"node10CompatibilityPlugin");var
|
|
37
|
-
`+e}return null},order:"post"}}),"prependDirectivePlugin");var
|
|
49
|
+
`,prefix:"plugin:node10-compatibility"})}}},"node10CompatibilityPlugin");var zn=Object.defineProperty,Ht=m((e,t)=>zn(e,"name",{value:t,configurable:!0}),"d$9");const le=Ht(e=>e.handler||e,"getHandler"),M=Ht((e,t,o="")=>({...e,async buildEnd(s){e.buildEnd&&await le(e.buildEnd).call(this,s)},async buildStart(s){e.buildStart&&await le(e.buildStart).call(this,s)},async load(s){if(!e.load)return null;const n=j(o,e.name),r=j("load",q(s));if(t.has(r,n))return await t.get(r,n);const i=await le(e.load).call(this,s);return t.set(r,i,n),i},name:`cached(${e.name})`,async resolveId(s,n,r){if(!e.resolveId)return null;const i=j(o,e.name),l=j("resolveId",q(s),n?q(n):"",q(JSON.stringify(r)));if(t.has(l,i))return await t.get(l,i);const c=await le(e.resolveId).call(this,s,n,r);return t.set(l,c,i),c},async transform(s,n){if(!e.transform)return null;const r=j(o,e.name),i=j("transform",q(n),q(s));if(t.has(i,r))return await t.get(i,r);const l=await le(e.transform).call(this,s,n);return t.set(i,l,r),l}}),"cachingPlugin");var Vn=Object.defineProperty,Hn=m((e,t)=>Vn(e,"name",{value:t,configurable:!0}),"n$8");const Gn=Hn(()=>({name:"packem:prepend-directive",transform:{handler(e,t){const o=this.getModuleInfo(t);if(o?.meta.preserveDirectives){const s=o.meta.preserveDirectives.directives[0];if(s)return`'${s.value}';
|
|
50
|
+
`+e}return null},order:"post"}}),"prependDirectivePlugin");var qn=Object.defineProperty,Xn=m((e,t)=>qn(e,"name",{value:t,configurable:!0}),"c$a");const Yn=Xn(({directiveRegex:e,exclude:t=[],include:o=[],logger:s})=>{const n={},r={},i=Z(o,t);return{name:"packem:preserve-directives",onLog(l,c){return c.code==="MODULE_LEVEL_DIRECTIVE"&&l==="warn"?!1:null},renderChunk:{handler(l,c,{sourcemap:a}){const p=c.moduleIds.map(f=>n[f]?n[f]:null).reduce((f,h)=>(h&&h.forEach(g=>{f.add(g)}),f),new Set),d=new Y(l);p.size>0&&(s.debug({message:`directives for chunk "${c.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),d.prepend(`${[...p].map(f=>`'${f}';`).join(`
|
|
38
51
|
`)}
|
|
39
|
-
`));let
|
|
40
|
-
`)),p.size===0&&
|
|
41
|
-
`);if(
|
|
42
|
-
`),{code:i.toString(),map:n.sourcemap?i.generateMap({hires:!0}):void 0}}return null},order:"post"},async writeBundle(o,
|
|
43
|
-
`)=>{const o
|
|
52
|
+
`));let u;return c.facadeModuleId&&typeof r[c.facadeModuleId]=="string"&&(u=r[c.facadeModuleId]),u&&(s.debug({message:`shebang for chunk "${c.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),d.prepend(`${u}
|
|
53
|
+
`)),p.size===0&&u===void 0?null:{code:d.toString(),map:a?d.generateMap({hires:!0}):null}},order:"post"},transform(l,c){if(!i(c))return null;let a=!1;const p=new Y(l);if(l.startsWith("#")&&l[1]==="!"){let u=0;for(let f=2,h=l.length;f<h;f++){const g=l.codePointAt(f);if(g===10||g===13||g===8232||g===8233){u=f;break}}u&&(r[c]=l.slice(0,u),p.remove(0,u+1),a=!0,s.debug({message:`shebang for module "${c}" is preserved.`,prefix:"plugin:preserve-directives"}))}let d=null;try{d=this.parse(p.toString(),{allowReturnOutsideFunction:!0})}catch(u){return this.warn({code:"PARSE_ERROR",message:`failed to parse "${c}" and extract the directives.`}),s.warn(u),null}if(d.type!=="Program")return null;for(const u of d.body.filter(Boolean)){if(u.type!=="ExpressionStatement")break;let f=null;"directive"in u?f=u.directive:u.expression.type==="Literal"&&typeof u.expression.value=="string"&&e.test(u.expression.value)&&(f=u.expression.value),f!=="use strict"&&f&&(n[c]||=new Set,n[c].add(f),"start"in u&&typeof u.start=="number"&&"end"in u&&typeof u.end=="number"&&(p.remove(u.start,u.end),a=!0),s.debug({message:`directive "${f}" for module "${c}" is preserved.`,prefix:"plugin:preserve-directives"}))}return a?{code:p.toString(),map:p.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...n[c]??[]],shebang:r[c]??null}}}:null}}},"preserveDirectives");var Qn=Object.defineProperty,Zn=m((e,t)=>Qn(e,"name",{value:t,configurable:!0}),"n$7");const er=Zn(e=>{const t=Z(e.include,e.exclude);return{async load(o){return o.includes("?raw")?await this.load({id:o.replace(/\?raw$/,"")}):null},name:"packem:raw",transform(o,s){return!t(s)&&!s.includes("?raw")?null:(s.includes("?raw")||(o=`export default ${JSON.stringify(o)}`),{code:o,map:{mappings:""}})}}},"rawPlugin");var tr=Object.defineProperty,or=m((e,t)=>tr(e,"name",{value:t,configurable:!0}),"r$8");const Gt=or(()=>({name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return ds(e)}}),"resolveFileUrl");var sr=Object.defineProperty,Se=m((e,t)=>sr(e,"name",{value:t,configurable:!0}),"i$5");const $e=/^#![^\n]*/,Je=Se(async e=>{await vo(e,493).catch(()=>{})},"makeExecutable"),nr=Se((e,t)=>({name:"packem:shebang",renderChunk:{handler(o,s,n){if(!s.isEntry||!s.facadeModuleId)return null;const r=o.startsWith("#")&&o[1]==="!";if(r&&t.replace)return o.replace($e,t.shebang+`
|
|
54
|
+
`);if(r)return null;if(e.includes(s.name)){const i=new Y(o);return i.prepend(t.shebang+`
|
|
55
|
+
`),{code:i.toString(),map:n.sourcemap?i.generateMap({hires:!0}):void 0}}return null},order:"post"},async writeBundle(o,s){for(const[n,r]of Object.entries(s))if(r.type==="chunk"&&$e.test(r.code)&&o.dir){const i=k(o.dir,n);await Je(i)}}}),"shebangPlugin"),rr=Se(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace($e,"")}}),"removeShebangPlugin"),ir=Se((e,t=`
|
|
56
|
+
`)=>{const o=$e.exec(e);return o?o+t:""},"getShebang");var ar=Object.defineProperty,ee=m((e,t)=>ar(e,"name",{value:t,configurable:!0}),"r$7");const lr=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,cr=/MIT License|MIT license|BSD license/,pr=/\n{2,}/g,ur=/\b(\w+)\$\d+\b/g,dr=/[-/\\^$*+?.()|[\]{}]/g,fr=ee(e=>e.replaceAll(dr,"\\$&"),"escapeRegex"),mr=ee(e=>[...new Set(e)],"unique"),gr=ee(e=>e.replaceAll(lr,t=>cr.test(t)?"":t).replaceAll(pr,`
|
|
44
57
|
|
|
45
|
-
`),"cleanUnnecessaryComments"),
|
|
46
|
-
- ${
|
|
58
|
+
`),"cleanUnnecessaryComments"),lt=new Map;function qt(e,t,{identifierReplacements:o},s){const n=At(e);for(const i in o){const l=n.find(a=>a.specifier===i&&a.imports.includes("{"));if(!l){this.warn(`${t.fileName} does not import "${i}" for replacement`),process.exitCode=1;continue}const c=o[i];for(const a in c){if(!l.imports.includes(a))throw new Error(`${t.fileName} does not import "${a}" from "${i}" for replacement`);const p=c[a],d=fr(a);p.includes(".")&&(e=e.replace(new RegExp(`\\b\\w+\\b as ${d},?\\s?`),"")),e=e.replaceAll(new RegExp(`\\b${d}\\b`,"g"),p)}}const r=mr(Array.from(e.matchAll(ur),i=>i[0]));if(r.length>0){const i=r.map(c=>`
|
|
59
|
+
- ${c}`).join(""),l=t.fileName.replace(/\.[^/.]+$/,"");lt.has(l)||s.warn({message:`${t.fileName} contains confusing identifier names${i}
|
|
47
60
|
|
|
48
|
-
To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),
|
|
61
|
+
To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),lt.set(l,!0)}return e}m(qt,"I");ee(qt,"replaceConfusingTypeNames");const hr=ee((e,t)=>{if(t.leadingComments?.some(o=>o.type==="CommentBlock"&&o.value.includes("@internal"))){const o=e.original[t.end]===","?t.end+1:t.end;return e.remove(t.leadingComments[0].start,o),!0}return!1},"removeInternal");function Xt(e,t){if(e.includes("@internal")){const o=new Y(e),s=fs(e,{plugins:["typescript"],sourceType:"module"});if(Kt(s,{enter(n){hr(o,n)&&this.skip()}}),e=o.toString(),e.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`)}return e}m(Xt,"S");ee(Xt,"stripInternalTypes");const yr=ee((e,t)=>({name:"packem:patch-types",renderChunk(o,s){return o=qt.call(this,o,s,e,t),o=Xt.call(this,o,s),o=gr(o),o},resolveId(o){return o.startsWith("types/")?{external:!0,id:"../../"+(o.endsWith(".js")?o:o+".js")}:null}}),"patchTypescriptTypes");var br=Object.defineProperty,Yt=m((e,t)=>br(e,"name",{value:t,configurable:!0}),"m$7");const Qt=Yt((e,t=!0)=>{if(!e)return null;const{config:o,path:s}=e;if(!o.compilerOptions)return null;const{baseUrl:n,paths:r}=o.compilerOptions;if(!n)return null;const i=k(K(s),n),l=[];if(r)for(const[c,a]of Object.entries(r)){let p;c==="@"||c==="~"||c==="#"?p=new RegExp(`^${c}/(.+)$`):p=new RegExp(`^${[...c].map(u=>u==="*"?"(.+)":u.replace(/[\\^$*+?.()|[\]{}]/,"\\$&")).join("")}$`);let d=0;for(const u of a){const f=[...U(k(i,u))].map(h=>h==="*"?"$"+(++d+""):h==="$"?"$$":h).join("");l.push({find:p,replacement:f})}}return t&&l.push({find:/^(?!\.*\/|\.*$|\w:)(.+)$/,replacement:`${[...U(i)].map(c=>c==="$"?"$$":c).join("")}/$1`}),l},"getConfigAlias"),Zt=Yt((e,t)=>{const o=Qt(e);return{name:"packem:resolve-tsconfig-paths",async resolveId(s,n,r){if(!o||s.includes("\0"))return null;for(const{find:i,replacement:l}of o)if(i.test(s)){const c=s.replace(i,l),a=await this.resolve(c,n,{skipSelf:!0,...r});if(a)return t.debug({message:`Resolved ${s} to ${a.id} using paths from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-paths"}),a.id}return null}}},"resolveTsconfigPaths");var vr=Object.defineProperty,eo=m((e,t)=>vr(e,"name",{value:t,configurable:!0}),"u$4");const wr=eo((e,t)=>{if(!t)return null;const{config:o,path:s}=t;if(!o.compilerOptions)return null;const{rootDirs:n}=o.compilerOptions;if(!n)return null;const r=[];for(const i of n){if(i.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${s}.`);if(i.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${s}.`);r.push(k(e,i))}return r},"getRootDirectories"),to=eo((e,t,o)=>{const s=wr(e,o);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(n,r,i){if(s===null||s.length===0)return null;if(n.startsWith("."))for(const l of s){const c=j(l,n),a=await this.resolve(c,r,{skipSelf:!0,...i});if(a)return t.debug({message:`Resolved ${n} to ${a.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),a.id}return null}}},"resolveTsconfigRootDirectories");var $r=Object.defineProperty,jr=m((e,t)=>$r(e,"name",{value:t,configurable:!0}),"r$6");const oo=jr(()=>{const e=/\.(?:[mc]?js|jsx)$/;return{name:"packem:resolve-typescript-mjs-cjs",async resolveId(t,o,s){return e.test(t)&&o?await this.resolve(t.replace(/js(x?)$/,"ts$1"),o,s):null}}},"resolveTypescriptMjsCts");var xr=Object.defineProperty,kr=m((e,t)=>xr(e,"name",{value:t,configurable:!0}),"s$7");const Er=kr(e=>{const t=re(e).split(".");if(t.length>=2){const[o,s]=t.slice(-2),n=t[0],r=/^(\w+)-runtime$/.exec(o)?.[1];if(Ke.includes(s)&&r&&r.length>0)return n+"-"+r}},"getCustomModuleLayer");var Sr=Object.defineProperty,Or=m((e,t)=>Sr(e,"name",{value:t,configurable:!0}),"i$4");const Ie=Or(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var Dr=Object.defineProperty,ct=m((e,t)=>Dr(e,"name",{value:t,configurable:!0}),"d$8");const Nr=ct((e,t)=>{const o=new Map;return ct(function(s,n){const r=n.getModuleInfo(s);if(!r)return;const{isEntry:i}=r,l=r.meta,c=Ie(l);if(!i){const a=o.get(s);if(a)return a;const p=Er(s);if(p)return o.set(s,p),p}if(i){const a=n.getModuleIds();for(const p of a)n.getModuleInfo(p)&&Ie(l)===c&&(e.has(p)||e.set(p,new Set),e.get(p).add([s,c]))}if(c&&!i&&e.has(s)){const a=[...e.get(s)];if(a.some(([d])=>{if(t.some(u=>u.path===d)){const u=n.getModuleInfo(d);return Ie(u?u.meta:{})===c}return!1}))return;if(a.every(([,d])=>d===c))return o.has(s)?o.get(s):void 0;const p=re(s,Dt(s))+"-"+c;return o.set(s,p),p}},"splitChunks")},"createSplitChunks");var Pr=Object.defineProperty,Cr=m((e,t)=>Pr(e,"name",{value:t,configurable:!0}),"n$5");const X=Cr((e,t)=>e.isDynamicEntry?`${Ho}/[name].${t}`:`${Go}/${e.name}-[hash].${t}`,"getChunkFilename");var _r=Object.defineProperty,Mr=m((e,t)=>_r(e,"name",{value:t,configurable:!0}),"o$4");const Ir=process.platform==="win32",pt=Mr((e,t)=>{const o=Ir?"\\":"/";for(let s of Array.isArray(e.names)?e.names:[]){if(s.includes("node_modules"+o+".pnpm"))return s=s.replace("node_modules"+o+".pnpm","external")+"."+t,s.replace("node_modules"+o,"");if(s.includes("node_modules"))return s.replace("node_modules","external")+"."+t}return"[name]."+t},"getEntryFileNames");var Tr=Object.defineProperty,Fr=m((e,t)=>Tr(e,"name",{value:t,configurable:!0}),"p$1");const Ve=Fr((e,t)=>{let o={};if(e.pkg.name&&(o[e.pkg.name]=e.options.rootDir),e.pkg.imports){const{imports:s}=e.pkg;for(const n in s){if(n.startsWith("#"))continue;const r=s[n];typeof r=="string"&&(o[n]=j(e.options.rootDir,r))}}return o={...o,...e.options.alias},e.options.rollup.alias&&(Array.isArray(e.options.rollup.alias.entries)?Object.assign(o,Object.fromEntries(e.options.rollup.alias.entries.map(s=>[s.find,s.replacement]))):Object.assign(o,e.options.rollup.alias.entries??e.options.rollup.alias)),e.logger.debug({message:"Resolved aliases: "+JSON.stringify(o),prefix:t}),o},"resolveAliases");var Ar=Object.defineProperty,I=m((e,t)=>Ar(e,"name",{value:t,configurable:!0}),"n$3");const so=I((e,t)=>{const o=[],s=[],n=[];return e&&e.filter(Boolean).filter(r=>r.type===t?!0:t==="build"&&r.type===void 0).forEach(r=>{r.enforce==="pre"?o.push(r.plugin):r.enforce==="post"?s.push(r.plugin):n.push(r.plugin)}),[o,n,s]},"sortUserPlugins"),Rr=I((e,t)=>{if(e==="esbuild"){if(!t.options.rollup.esbuild)throw new Error("No esbuild options found in your configuration.");t.tsconfig?.config.compilerOptions?.target?.toLowerCase()==="es3"&&(t.logger.warn(["ES3 target is not supported by esbuild, so ES5 will be used instead..","Please set 'target' option in tsconfig to at least ES5 to disable this error"].join(" ")),t.tsconfig.config.compilerOptions.target="es5",t.options.rollup.esbuild.target="es5");let o="node"+jo.node.split(".")[0];if(t.pkg.engines?.node){const s=Tt(t.pkg.engines.node);s&&(o="node"+s.major)}if(t.options.rollup.esbuild.target){const s=ue(t.options.rollup.esbuild.target);s.some(n=>n.startsWith("node"))||(t.options.rollup.esbuild.target=[...new Set([...ue(o),...s])])}else t.options.rollup.esbuild.target=ue(o);return t.tsconfig?.config.compilerOptions?.target==="es5"&&(t.options.rollup.esbuild.keepNames=!1,t.logger.debug("Disabling keepNames because target is set to es5")),{logger:t.logger,minify:t.options.minify,minifyWhitespace:t.options.minify,sourceMap:t.options.sourcemap,...t.options.rollup.esbuild}}if(e==="swc"){if(!t.options.rollup.swc)throw new Error("No swc options found in your configuration.");return{minify:t.options.minify,...t.options.rollup.swc,jsc:{minify:{compress:{directives:!1},format:{comments:"some"},mangle:{topLevel:!0},sourceMap:t.options.sourcemap,toplevel:t.options.emitCJS??t.options.emitESM},...t.options.rollup.swc.jsc},sourceMaps:t.options.sourcemap}}if(e==="sucrase"){if(!t.options.rollup.sucrase)throw new Error("No sucrase options found in your configuration.");return t.options.rollup.sucrase}throw new Error("A Unknown transformer was provided")},"getTransformerConfig"),no=I((e,t)=>{if(e.code==="CIRCULAR_DEPENDENCY"&&/Circular dependency:[\s\S]*node_modules/.test(e.message))return!0;if(e.code==="UNRESOLVED_IMPORT")throw new Error(`Failed to resolve the module "${e.exporter}" imported by "${D(T(k(),e.id))}"
|
|
49
62
|
Is the module installed? Note:
|
|
50
63
|
↳ to inline a module into your bundle, install it to "devDependencies".
|
|
51
|
-
↳ to depend on a module via import/require, install it to "dependencies".`);return e.code==="MODULE_LEVEL_DIRECTIVE"?!0:e.code==="MIXED_EXPORTS"&&t.options.cjsInterop===!0},"sharedOnWarn"),
|
|
52
|
-
${i.stack}`),s){case"info":{e.logger.info({message:a,prefix:o+(i.plugin?":plugin:"+i.plugin:"")});return}case"warn":{e.logger.warn({message:a,prefix:o+(i.plugin?":plugin:"+i.plugin:"")});return}case"debug":e.logger.debug({message:a,prefix:o+(i.plugin?":plugin:"+i.plugin:"")})}},"onLog"),onwarn(s,i){Lt(s,e)||s.code||i(s)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),Ut=O(async(e,t)=>{const o=Se(e,"build");let r;e.options.rollup.resolve&&(r=S(ht({...e.options.rollup.resolve}),t));const n=e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:Xn(e.dependencyGraphMap,e.buildEntries),preserveModules:!1};return{...Kt(e,o,"dependencies"),output:[e.options.emitCJS&&{chunkFileNames:O(s=>R(s,"cjs"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:O(s=>ze(s,"cjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"cjs",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,interop:"compat",sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...n},e.options.emitESM&&{chunkFileNames:O(s=>R(s,"mjs"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:O(s=>ze(s,"mjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"esm",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...n}].filter(Boolean),plugins:Wt([S(Ct(),t),S(Jt(),t),e.tsconfig&&S(Ft(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&S(At(e.tsconfig,e.logger),t),e.options.rollup.replace&&yt({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&>({customResolver:r,...e.options.rollup.alias,entries:o}),r,e.options.rollup.polyfillNode&&Do({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&St({...e.options.rollup.json}),wr(),e.options.rollup.wasm&&Oo(e.options.rollup.wasm),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer&&Vr(w(e.options.rootDir,e.options.sourceDir),e.options.isolatedDeclarationTransformer,e.options.declaration,!!e.options.rollup.cjsInterop,e.options.rollup.isolatedDeclarations),e.options.rollup.raw&&S(wn(e.options.rollup.raw),t),e.options.transformer(ii(e.options.transformerName,e)),S(yn({directiveRegex:/^['|"](use (\w+))['|"]$/,...e.options.rollup.preserveDirectives,logger:e.logger}),t),e.options.rollup.shebang&&xn(e.options.entries.filter(s=>s.executable).map(s=>s.name).filter(Boolean),e.options.rollup.shebang),e.options.cjsInterop&&e.options.emitCJS&&Et({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&Fr(),e.options.rollup.dynamicVars&&So(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&S(Eo({sourceMap:e.options.sourcemap,...e.options.rollup.commonjs}),t),e.options.rollup.preserveDynamicImports&&{name:"packem:preserve-dynamic-imports",renderDynamicImport(){return{left:"import(",right:")"}}},e.options.cjsInterop&&e.options.rollup.shim&&Mr(e.pkg,e.options.rollup.shim),e.options.rollup.jsxRemoveAttributes&&S(Zr({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),t),e.options.rollup.metafile&&nn({outDir:$(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&Nr(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&Nt({dtsMarker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dependenciesTemplate,logger:e.logger,marker:e.options.rollup.license.dependenciesMarker??"DEPENDENCIES",mode:"dependencies",packageName:e.pkg.name}),mn(),e.options.emitCJS&&e.mode==="build"&&e.options.declaration==="compatible"&&e.options.rollup.node10Compatibility&&ln(e.logger,e.options.entries,e.options.outDir,e.options.rootDir,e.options.rollup.node10Compatibility.writeToPackageJson?"file":"console",e.options.rollup.node10Compatibility.typeScriptVersion??"*"),e.options.analyze&&e.options.rollup.visualizer!==!1&&No({brotliSize:!0,gzipSize:!0,projectRoot:e.options.rootDir,sourcemap:e.options.sourcemap,...e.options.rollup.visualizer,filename:"packem-bundle-analyze.html",title:"Packem Visualizer"})].filter(Boolean),e.options.rollup.plugins)}},"getRollupOptions"),si=O(async e=>{const{dts:t}=require("rollup-plugin-dts");return t({compilerOptions:{...e.options.rollup.dts.compilerOptions,incremental:void 0,inlineSources:void 0,sourceMap:void 0,tsBuildInfoFile:void 0},respectExternal:e.options.rollup.dts.respectExternal,tsconfig:e.tsconfig?.path})},"createDtsPlugin"),ai=ar(si),zt=O(async(e,t)=>{const o=Se(e,"types"),r={load(a){return/\.(?:js|cjs|mjs|jsx|ts|tsx|ctsx|mtsx|mts|json)$/.test(a)?null:""},name:"packem:ignore-files"},n=e.tsconfig?.config.compilerOptions;delete n?.lib;let s;e.options.rollup.resolve&&(s=S(ht({...e.options.rollup.resolve}),t));const i="dts-plugin:"+process.pid+e.tsconfig.path;return{...Kt(e,o,"dts"),onwarn(a,l){Lt(a,e)||a.code!=="EMPTY_BUNDLE"&&l(a)},output:[e.options.emitCJS&&{chunkFileNames:O(a=>R(a,"d.cts"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.emitESM&&{chunkFileNames:O(a=>R(a,"d.mts"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts",format:"esm",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.declaration==="compatible"&&{chunkFileNames:O(a=>R(a,"d.ts"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output}].filter(Boolean),plugins:Wt([S(Ct(),t),S(Jt(),t),e.options.rollup.json&&St({...e.options.rollup.json}),r,e.tsconfig&&S(Ft(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&S(At(e.tsconfig,e.logger),t),e.options.rollup.replace&&yt({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&>({customResolver:s,...e.options.rollup.alias,entries:o}),s,await ai(i)(e),e.options.cjsInterop&&e.options.emitCJS&&Et({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&S(Rn(e.options.rollup.patchTypes,e.logger),t),En(),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&Nt({licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dtsTemplate,logger:e.logger,marker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",mode:"types",packageName:e.pkg.name})].filter(Boolean),e.options.rollup.plugins)}},"getRollupDtsOptions");var li=Object.defineProperty,ci=f((e,t)=>li(e,"name",{value:t,configurable:!0}),"f$6");const He="rollup-build.json",ve=ci(async(e,t,o)=>{const r=await Ut(e,t);if(await e.hooks.callHook("rollup:options",e,r),Object.keys(r.input).length===0)return;(!e.options.rollup.isolatedDeclarations||!e.options.isolatedDeclarationTransformer)&&(r.cache=t.get(He,o));const n=await mt(r);t.set(He,n.cache,o),await e.hooks.callHook("rollup:build",e,n);const s=new Map;for(const i of r.output){const{output:a}=await n.write(i),l=new Set,c=a.filter(u=>u.type==="chunk");for(const u of c){l.add(u.fileName);for(const d of u.imports)e.usedImports.add(d);u.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(u.code,"utf8"),chunks:u.imports.filter(d=>c.find(g=>g.fileName===d)),exports:u.exports,modules:Object.entries(u.modules).map(([d,g])=>({bytes:g.renderedLength,id:d})),path:u.fileName,type:"entry"})}const p=a.filter(u=>u.type==="asset");for(const u of p)s.has(u.fileName)||s.set(u.fileName,{bytes:Buffer.byteLength(u.source,"utf8"),path:u.fileName,type:"asset"});for(const u of l)e.usedImports.delete(u)}e.buildEntries.push(...s.values())},"build");var pi=Object.defineProperty,Y=f((e,t)=>pi(e,"name",{value:t,configurable:!0}),"a$7");const qe="rollup-dts.json",Q=Y(async(e,t,o)=>{if(e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer){e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});return}const r=await zt(e,t);if(await e.hooks.callHook("rollup:dts:options",e,r),Object.keys(r.input).length===0)return;r.cache=t.get(qe,o);const n=await mt(r);t.set(qe,n.cache,o),await e.hooks.callHook("rollup:dts:build",e,n),e.logger.info({message:"Building declaration files...",prefix:"dts"}),e.options.emitCJS&&await n.write({chunkFileNames:Y(s=>R(s,"d.cts"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await n.write({chunkFileNames:Y(s=>R(s,"d.mts"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),e.options.declaration==="compatible"&&await n.write({chunkFileNames:Y(s=>R(s,"d.mjs"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts"}),await e.hooks.callHook("rollup:dts:done",e)},"buildTypes");var ui=Object.defineProperty,di=f((e,t)=>ui(e,"name",{value:t,configurable:!0}),"y$2");const fi=di((e,t,o)=>e.reduce((r,n)=>{const s=n[t],i=n[o];return r[s]||(r[s]={}),r[s][i]||(r[s][i]=[]),r[s][i].push(n),r},{}),"groupByKeys");var mi=Object.defineProperty,ie=f((e,t)=>mi(e,"name",{value:t,configurable:!0}),"j$1");const gi=ie((e,t)=>{const o=ie(i=>N(t.options.rootDir,$(t.options.outDir,i)),"rPath");let r=!1;const n=[],s=t.buildEntries.filter(i=>i.type==="entry");if(s.length>0){e.raw(`Entries:
|
|
53
|
-
`);for(const i of
|
|
54
|
-
exports: `+
|
|
55
|
-
${i.chunks.map(
|
|
56
|
-
`)}`),i.modules&&i.modules.length>0){const
|
|
57
|
-
`);
|
|
64
|
+
↳ to depend on a module via import/require, install it to "dependencies".`);return e.code==="MODULE_LEVEL_DIRECTIVE"?!0:e.code==="MIXED_EXPORTS"&&t.options.cjsInterop===!0},"sharedOnWarn"),ut=new Map,Te=new Map,ro=I((e,t,o)=>{const s=Qt(e.tsconfig,!1);return{external(n){n=Wo(n,t);const r=Rt(n);if(Re(e.options.externals,r)||Re(e.options.externals,n))return!0;const{pkg:i}=e;if(n.startsWith(".")||Ue(n)||/src[/\\]/.test(n)||i.name&&n.startsWith(i.name))return!1;if(i.imports)for(const[l,c]of Object.entries(i.imports)){if(l===n)return!1;if(l.includes("*")){let a;Te.has(l)?a=Te.get(l):(a=jt(j(e.options.rootDir,c.replace("/*","")),{withFileTypes:!0}).filter(p=>p.isFile()).map(p=>p.name),Te.set(l,a));for(const p of a)if(p.replace(Q,"")===n.replace(Q,"").replace("#",""))return!1}}if(s){for(const{find:l}of s)if(l.test(n))return e.logger.debug({message:`Resolved alias ${n} to ${l.source}`,prefix:o}),!1}return ut.has(n)||e.logger.info({message:'Inlined implicit external "'+D(n)+'". If this is incorrect, add it to the "externals" option.',prefix:o}),ut.set(n,!0),!1},input:Object.fromEntries(e.options.entries.map(n=>[n.name,k(e.options.rootDir,n.input)])),logLevel:e.options.debug?"debug":"info",onLog:I((n,r)=>{let i=r.message;switch(r.stack&&(i=`${i}
|
|
65
|
+
${r.stack}`),n){case"info":{e.logger.info({message:i,prefix:o+(r.plugin?":plugin:"+r.plugin:"")});return}case"warn":{e.logger.warn({message:i,prefix:o+(r.plugin?":plugin:"+r.plugin:"")});return}case"debug":e.logger.debug({message:i,prefix:o+(r.plugin?":plugin:"+r.plugin:"")})}},"onLog"),onwarn(n,r){no(n,e)||n.code||r(n)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),io=I(async(e,t)=>{const o=Ve(e,"build");let s;e.options.rollup.resolve&&(s=M(_t({...e.options.rollup.resolve}),t));const n=e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:Nr(e.dependencyGraphMap,e.buildEntries),preserveModules:!1},[r,i,l]=so(e.options.rollup.plugins,"build");return{...ro(e,o,"build"),output:[e.options.emitCJS&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:I(c=>X(c,"cjs"),"chunkFileNames"),compact:e.options.minify,dir:k(e.options.rootDir,e.options.outDir),entryFileNames:I(c=>pt(c,"cjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"cjs",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,interop:"compat",sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...n},e.options.emitESM&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:I(c=>X(c,"mjs"),"chunkFileNames"),compact:e.options.minify,dir:k(e.options.rootDir,e.options.outDir),entryFileNames:I(c=>pt(c,"mjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"esm",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...n}].filter(Boolean),plugins:[M(Gt(),t),M(oo(),t),e.tsconfig&&M(to(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&M(Zt(e.tsconfig,e.logger),t),e.options.rollup.replace&&Mt({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&Ct({customResolver:s,...e.options.rollup.alias,entries:o}),...r,s,e.options.rollup.polyfillNode&&Uo({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&Ut({...e.options.rollup.json}),Js(),e.options.rollup.wasm&&Lo(e.options.rollup.wasm),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer&&Nn(j(e.options.rootDir,e.options.sourceDir),e.options.isolatedDeclarationTransformer,e.options.declaration,!!e.options.rollup.cjsInterop,e.options.rollup.isolatedDeclarations),e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0&&await ln({dts:!!e.options.declaration||e.options.isolatedDeclarationTransformer!==void 0,sourceMap:e.options.sourcemap,...e.options.rollup.css},e.logger,e.options.browserTargets,e.options.rootDir,e.options.sourceDir,e.environment,e.options.sourcemap,e.options.debug,e.options.minify??!1,o),e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0&&e.options.declaration&&dn(e.options.rollup.css,e.options.rootDir,e.logger),e.options.rollup.raw&&M(er(e.options.rollup.raw),t),...i,e.options.transformer(Rr(e.options.transformerName,e)),M(Yn({directiveRegex:/^['|"](use (\w+))['|"]$/,...e.options.rollup.preserveDirectives,logger:e.logger}),t),e.options.rollup.shebang&&nr(e.options.entries.filter(c=>c.executable).map(c=>c.name).filter(Boolean),e.options.rollup.shebang),e.options.cjsInterop&&e.options.emitCJS&&Wt({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&$n(),e.options.rollup.dynamicVars&&Bo(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&M(Jo({sourceMap:e.options.sourcemap,...e.options.rollup.commonjs}),t),e.options.rollup.preserveDynamicImports&&{name:"packem:preserve-dynamic-imports",renderDynamicImport(){return{left:"import(",right:")"}}},e.options.cjsInterop&&e.options.rollup.shim&&bn(e.pkg,e.options.rollup.shim),e.options.rollup.jsxRemoveAttributes&&M(Fn({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),t),...l,e.options.rollup.metafile&&Ln({outDir:k(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&Gs(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&Vt({dtsMarker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dependenciesTemplate,logger:e.logger,marker:e.options.rollup.license.dependenciesMarker??"DEPENDENCIES",mode:"dependencies",packageName:e.pkg.name}),Gn(),e.options.emitCJS&&e.mode==="build"&&e.options.declaration==="compatible"&&e.options.rollup.node10Compatibility&&Kn(e.logger,e.options.entries,e.options.outDir,e.options.rootDir,e.options.rollup.node10Compatibility.writeToPackageJson?"file":"console",e.options.rollup.node10Compatibility.typeScriptVersion??"*"),e.options.analyze&&e.options.rollup.visualizer!==!1&&Ko({brotliSize:!0,gzipSize:!0,projectRoot:e.options.rootDir,sourcemap:e.options.sourcemap,...e.options.rollup.visualizer,filename:"packem-bundle-analyze.html",title:"Packem Visualizer"})].filter(Boolean)}},"getRollupOptions"),Jr=I(async e=>{const{dts:t}=require("rollup-plugin-dts");return t({compilerOptions:{...e.options.rollup.dts.compilerOptions,incremental:void 0,inlineSources:void 0,sourceMap:void 0,tsBuildInfoFile:void 0},respectExternal:e.options.rollup.dts.respectExternal,tsconfig:e.tsconfig?.path})},"createDtsPlugin"),Br=Ss(Jr),ao=I(async(e,t)=>{const o=Ve(e,"types"),s=e.tsconfig?.config.compilerOptions;delete s?.lib;let n;e.options.rollup.resolve&&(n=M(_t({...e.options.rollup.resolve}),t));const r="dts-plugin:"+process.pid+e.tsconfig.path,[i,l,c]=so(e.options.rollup.plugins,"dts");return{...ro(e,o,"dts"),onwarn(a,p){no(a,e)||a.code!=="EMPTY_BUNDLE"&&p(a)},output:[e.options.emitCJS&&{chunkFileNames:I(a=>X(a,"d.cts"),"chunkFileNames"),compact:e.options.minify,dir:k(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.emitESM&&{chunkFileNames:I(a=>X(a,"d.mts"),"chunkFileNames"),compact:e.options.minify,dir:k(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts",format:"esm",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.declaration==="compatible"&&{chunkFileNames:I(a=>X(a,"d.ts"),"chunkFileNames"),compact:e.options.minify,dir:k(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output}].filter(Boolean),plugins:[M(Gt(),t),M(oo(),t),e.options.rollup.json&&Ut({...e.options.rollup.json}),{load(a){return/\.(?:js|cjs|mjs|jsx|ts|tsx|ctsx|mtsx|mts|json)$/.test(a)?null:""},name:"packem:ignore-files"},e.tsconfig&&M(to(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&M(Zt(e.tsconfig,e.logger),t),e.options.rollup.replace&&Mt({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&Ct({customResolver:n,...e.options.rollup.alias,entries:o}),...i,n,...l,await Br(r)(e),e.options.cjsInterop&&e.options.emitCJS&&Wt({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&M(yr(e.options.rollup.patchTypes,e.logger),t),rr(),...c,e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&Vt({licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dtsTemplate,logger:e.logger,marker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",mode:"types",packageName:e.pkg.name})].filter(Boolean)}},"getRollupDtsOptions");var Lr=Object.defineProperty,Wr=m((e,t)=>Lr(e,"name",{value:t,configurable:!0}),"m$5");const dt="rollup-build.json",Ur=Wr(async(e,t,o)=>{const s=await io(e,t);if(await e.hooks.callHook("rollup:options",e,s),Object.keys(s.input).length===0)return;let n=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(n=!1),n&&(s.cache=t.get(dt,o));const r=await Pt(s);n&&t.set(dt,r.cache,o),await e.hooks.callHook("rollup:build",e,r);const i=new Map;for(const l of s.output){const{output:c}=await r.write(l),a=new Set,p=c.filter(u=>u.type==="chunk");for(const u of p){a.add(u.fileName);for(const f of u.imports)e.usedImports.add(f);u.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(u.code,"utf8"),chunks:u.imports.filter(f=>p.find(h=>h.fileName===f)),exports:u.exports,modules:Object.entries(u.modules).map(([f,h])=>({bytes:h.renderedLength,id:f})),path:u.fileName,type:"entry"})}const d=c.filter(u=>u.type==="asset");for(const u of d)i.has(u.fileName)||i.set(u.fileName,{bytes:Buffer.byteLength(u.source,"utf8"),path:u.fileName,type:"asset"});for(const u of a)e.usedImports.delete(u)}e.buildEntries.push(...i.values())},"build");var Kr=Object.defineProperty,ge=m((e,t)=>Kr(e,"name",{value:t,configurable:!0}),"a$7");const ft="rollup-dts.json",zr=ge(async(e,t,o)=>{if(e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer){e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});return}const s=await ao(e,t);if(await e.hooks.callHook("rollup:dts:options",e,s),Object.keys(s.input).length===0)return;s.cache=t.get(ft,o);const n=await Pt(s);t.set(ft,n.cache,o),await e.hooks.callHook("rollup:dts:build",e,n),e.logger.info({message:"Building declaration files...",prefix:"dts"}),e.options.emitCJS&&await n.write({chunkFileNames:ge(r=>X(r,"d.cts"),"chunkFileNames"),dir:k(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await n.write({chunkFileNames:ge(r=>X(r,"d.mts"),"chunkFileNames"),dir:k(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),e.options.declaration==="compatible"&&await n.write({chunkFileNames:ge(r=>X(r,"d.mjs"),"chunkFileNames"),dir:k(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts"}),await e.hooks.callHook("rollup:dts:done",e)},"buildTypes");var Vr=Object.defineProperty,Hr=m((e,t)=>Vr(e,"name",{value:t,configurable:!0}),"y$3");const Gr=Hr((e,t,o)=>e.reduce((s,n)=>{const r=n[t],i=n[o];return s[r]||(s[r]={}),s[r][i]||(s[r][i]=[]),s[r][i].push(n),s},{}),"groupByKeys");var qr=Object.defineProperty,je=m((e,t)=>qr(e,"name",{value:t,configurable:!0}),"j$1");const Xr=je((e,t)=>{const o=je(i=>T(t.options.rootDir,k(t.options.outDir,i)),"rPath");let s=!1;const n=[],r=t.buildEntries.filter(i=>i.type==="entry");if(r.length>0){e.raw(`Entries:
|
|
66
|
+
`);for(const i of r){let l=i.bytes??0;for(const a of i.chunks??[])l+=t.buildEntries.find(p=>p.path===a)?.bytes??0;let c=` ${W(o(i.path))} (${["total size: "+D(H(l)),i.bytes&&"chunk size: "+D(H(i.bytes))].filter(Boolean).join(", ")})`;if(c+=i.exports?.length?`
|
|
67
|
+
exports: `+G(i.exports.join(", ")):"",i.chunks?.length&&(c+=`
|
|
68
|
+
${i.chunks.map(a=>{const p=t.buildEntries.find(d=>d.path===a)??{};return G(" └─ "+o(a)+W(p.bytes?" ("+H(p?.bytes)+")":""))}).join(`
|
|
69
|
+
`)}`),i.modules&&i.modules.length>0){const a=i.modules.filter(p=>p.id.includes("node_modules")).sort((p,d)=>(d.bytes||0)-(p.bytes||0)).map(p=>G(" 📦 "+o(p.id)+W(p.bytes?" ("+H(p.bytes)+")":""))).join(`
|
|
70
|
+
`);c+=a.length>0?`
|
|
58
71
|
inlined modules:
|
|
59
|
-
`+
|
|
72
|
+
`+a:""}if(t.options.declaration){let a=i.path.replace(/\.js$/,".d.ts"),p="commonjs";i.path.endsWith(".cjs")?a=i.path.replace(/\.cjs$/,".d.cts"):i.path.endsWith(".mjs")&&(p="module",a=i.path.replace(/\.mjs$/,".d.mts"));const d=t.buildEntries.find(u=>u.path.endsWith(a));if(d){n.push(d.path);let u;a.includes(".d.ts")||(a=a.replace(".d.c",".d."),u=t.buildEntries.find(f=>f.path.endsWith(a))),u&&(n.push(u.path),c+=p==="commonjs"?`
|
|
60
73
|
types:
|
|
61
|
-
`+[u
|
|
74
|
+
`+[d,u].map(f=>G(" └─ ")+W(o(f.path))+" (total size: "+D(H(f.bytes??0))+")").join(`
|
|
62
75
|
`):`
|
|
63
|
-
types: `+
|
|
76
|
+
types: `+W(o(d.path))+" (total size: "+D(H(d.bytes??0))+")")}}s=!0,c+=`
|
|
64
77
|
|
|
65
|
-
`,e.raw(i.chunk?
|
|
66
|
-
└─ `)+
|
|
78
|
+
`,e.raw(i.chunk?G(c):c)}}if(t.buildEntries.filter(i=>i.type==="asset").length>0){let i="Assets:";for(const l of t.buildEntries.filter(c=>c.type==="asset"))n.includes(l.path)||(i+=G(`
|
|
79
|
+
└─ `)+W(o(l.path))+" (total size: "+D(H(l.bytes??0))+")");i+=`
|
|
67
80
|
|
|
68
|
-
`,e.raw(i)}return
|
|
69
|
-
`),r},"showSizeInformation"),hi=ie((e,t)=>{const o=fi(e.options.entries,"environment","runtime"),r=[];for(const[n,s]of Object.entries(o))for(const[i,a]of Object.entries(s)){const l={...e};!e.options.dtsOnly&&(n!=="undefined"||i!=="undefined")&&e.logger.info("Preparing build for "+(n==="undefined"?"":x(n)+" environment"+(i==="undefined"?"":" with "))+(i==="undefined"?"":x(i)+" runtime")),l.options.rollup.replace?(l.options.rollup.replace.values===void 0&&(l.options.rollup.replace.values={}),n!=="undefined"&&(l.options.rollup.replace.values={...l.options.rollup.replace.values,[["process","env","NODE_ENV"].join(".")]:JSON.stringify(n)}),l.options.rollup.replace.values={...l.options.rollup.replace.values,[["process","env","EdgeRuntime"].join(".")]:JSON.stringify(i==="edge-light")}):e.logger.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");let c="";n!=="undefined"&&(c+=n+"/"),i!=="undefined"&&(c+=i+"/");let p=!1;l.options.minify!==void 0&&(p=l.options.minify),n==="development"?p=!1:n==="production"&&(p=!0);const u=[],d=[],g=[],h=[];for(const m of a)m.cjs&&m.esm?u.push(m):m.cjs?g.push(m):m.esm?d.push(m):m.declaration&&h.push(m);if(u.length>0){const m={...l,options:{...l.options,emitCJS:!0,emitESM:!0,entries:u,minify:p}};if(e.options.dtsOnly||r.push(ve(m,t,c)),e.options.declaration){const y=m.options.entries.filter(b=>b.declaration);y.length>0&&r.push(Q({...m,options:{...m.options,entries:y}},t,c))}}if(d.length>0){const m={...l,options:{...l.options,emitCJS:!1,emitESM:!0,entries:d,minify:p}};if(e.options.dtsOnly||r.push(ve(m,t,c)),e.options.declaration){const y=m.options.entries.filter(b=>b.declaration);y.length>0&&r.push(Q({...m,options:{...m.options,entries:y}},t,c))}}if(g.length>0){const m={...l,options:{...l.options,emitCJS:!0,emitESM:!1,entries:g,minify:p}};if(e.options.dtsOnly||r.push(ve(m,t,c)),e.options.declaration){const y=m.options.entries.filter(b=>b.declaration);y.length>0&&r.push(Q({...m,options:{...m.options,entries:y}},t,c))}}if(l.options.declaration&&h.length>0){const m={...l,options:{...l.options,emitCJS:!1,emitESM:!1,entries:h,minify:p}};r.push(Q(m,t,c))}}return r.filter(Boolean)},"prepareRollupConfig"),yi=ie(async(e,t)=>{await e.hooks.callHook("build:before",e),await Promise.all(hi(e,t)),e.logger.success(po(e.options.name?"Build succeeded for "+e.options.name:"Build succeeded"));for await(const o of go(w(e.options.rootDir,e.options.outDir))){let r=e.buildEntries.find(n=>w(e.options.rootDir,e.options.outDir,n.path)===o.path);if(r||(r={chunk:!0,path:o.path},e.buildEntries.push(r)),!r.bytes){const n=await it($(e.options.rootDir,e.options.outDir,o.path));r.bytes=n.size}}return await e.hooks.callHook("build:done",e),gi(e.logger,e)},"build");var vi=Object.defineProperty,bi=f((e,t)=>vi(e,"name",{value:t,configurable:!0}),"r$4");const j=bi((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var wi=Object.defineProperty,Vt=f((e,t)=>wi(e,"name",{value:t,configurable:!0}),"t$4");const se=Vt(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),je=Vt((e,t,o,r)=>{if(e==="module-sync")return"esm";if(r){const i=se(r);if(i)return i}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return o;const[n,...s]=t;return je(n,s,o,r)},"inferExportType");var $i=Object.defineProperty,ji=f((e,t)=>$i(e,"name",{value:t,configurable:!0}),"y$1");const ki=new Set(["electron","import","require","node","node-addons","default","types","deno","browser","module-sync","bun","workerd",...bt,...oe]),Oe=ji((e,t,o,r=[])=>{if(!e)return[];if(typeof e=="string"){const n=se(e);if(n&&n!==t)throw new Error(`Exported file "${e}" has an extension that does not match the package.json type "${t==="esm"?"module":"commonjs"}".`);return[{file:e,key:"exports",type:n??t}]}if(typeof e=="object"){const n=Object.entries(e).filter(([i])=>!i.endsWith(".json"));let s=[];for(const[i,a]of n)if(typeof a=="string"){let l={};Number.isInteger(+i)?l={exportKey:"*"}:i.startsWith("./")?l={exportKey:i.replace("./","")}:l={exportKey:i==="."?".":"*",subKey:i},s.push({...l,file:a,key:"exports",type:je(i,r,t,a)})}else if(typeof a=="object"&&a!==null)for(const[l,c]of Object.entries(a)){if(o===!1&&l==="types")continue;const p=Number.isInteger(+i)?l:i;typeof c=="string"?s.push({exportKey:p.replace("./",""),file:c,key:"exports",...ki.has(l)?{subKey:l}:{},type:je(l,r,t,c)}):s=[...s,...Oe({[p]:c},t,o,[...r,l])]}return s}return[]},"extractExportFilenames");var xi=Object.defineProperty,ue=f((e,t)=>xi(e,"name",{value:t,configurable:!0}),"c$4");const Ei=ue((e,t)=>e.key==="exports"&&e.subKey===H?H:e.key==="exports"&&e.subKey===Ie?Ie:t,"getEnvironment"),Z=ue((e,t,o,r,n,s,i)=>{const a=Ei(n,s.environment);let l="node";for(const u of bt)if(n.file.includes("."+u+".")||n.subKey===u){l=u;break}let c=e.find(u=>u.input===t&&u.environment===a&&u.runtime===l);c===void 0?c=e[e.push({environment:a,exportKey:new Set([n.exportKey].filter(Boolean)),input:t,runtime:l})-1]:c.exportKey&&n.exportKey&&c.exportKey.add(n.exportKey),i&&(c.isGlob=!0),o&&(c.outDir=r),n.isExecutable?(c.executable=!0,c.declaration=!1,n.type==="cjs"?c.cjs=!0:n.type==="esm"&&(c.esm=!0)):(/\.d\.[mc]?ts$/.test(n.file)&&s.options.declaration!==!1&&(c.declaration=s.options.declaration),n.type==="cjs"?c.cjs=!0:n.type==="esm"&&(c.esm=!0));const p=n.file.replace(ut(n.file),"").replace(new RegExp(`^./${s.options.outDir.replace(/^\.\//,"")}/`),"");oe.has(n.subKey)&&!t.includes(p)&&(c.fileAlias=p)},"createOrUpdateEntry");let Ge=!1;const Xe=ue(e=>{if(e.pkg?.dependencies?.typescript===void 0&&e.pkg?.devDependencies?.typescript===void 0)throw new Error("You tried to use a `.ts`, `.cts` or `.mts` file but `typescript` was not found in your package.json.")},"validateIfTypescriptIsInstalled"),Si=ue((e,t,o)=>{const r=[];t.sort((a,l)=>a.split("/").length-l.split("/").length);const n=e.type==="module"?"esm":"cjs";n==="esm"&&(o.options.emitESM=!0),n==="cjs"&&(o.options.emitCJS=!0);const s=Oe(e.exports,n,o.options.declaration);if(e.bin){const a=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const l of a){const c=se(l);if(c&&c!==n)throw new Error(`Exported file "${l}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);s.push({file:l,isExecutable:!0,key:"bin",type:c??n})}}e.main&&s.push({file:e.main,key:"main",type:se(e.main)??n}),e.module&&s.push({file:e.module,key:"module",type:"esm"}),(e.types||e.typings)&&(Xe(o),o.options.declaration===void 0&&(o.options.declaration="compatible"),s.push({file:e.types??e.typings,key:"types"}));const i=[];for(const a of s){o.options.declaration===void 0&&(a.key==="types"||a.subKey==="types")&&(o.options.declaration=a.file.includes(".d.ts")?"compatible":!0),o.options.emitCJS===void 0&&a.type==="cjs"&&(o.options.emitCJS=!0),o.options.emitESM===void 0&&a.type==="esm"&&(o.options.emitESM=!0);const l=a.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),c=l.endsWith("/");if(c&&["./","/"].includes(l))continue;const p=l.replace(new RegExp("(./)?"+o.options.outDir),o.options.sourceDir).replace("./",""),u="(?<=/|$)",d=c?"":"\\.\\w+$";if(a.file.includes("/*")&&a.key==="exports"){Ge||(o.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),Ge=!0);const y=[],b=new RegExp(u+p.replace("*","(.*)")+d),k=new RegExp(u+p.replace(/(.*)\.[^.]*$/,"$1").replace("*","(.*)")+d);for(const E of t)(b.test(E)||oe.has(a.subKey)&&k.test(E))&&y.push(E);if(y.length===0){r.push(`Could not find entrypoint for \`${a.file}\``);continue}for(const E of y)Z(i,E,c,l,a,o,!0);continue}const g=new RegExp(u+p+d);let h=t.find(y=>g.test(y));if(oe.has(a.subKey)&&h===void 0){const y=new RegExp(u+p.replace(/(.*)\.[^.]*$/,"$1")+d);h=t.find(b=>y.test(b))}if(h===void 0){T($(o.options.rootDir,a.file))||r.push(`Could not find entrypoint for \`${a.file}\``);continue}(h.endsWith(".ts")||h.endsWith(".cts")||h.endsWith(".mts"))&&T(h)&&Xe(o);const m=te(h.replace(J,""));T(m+".cts")&&T(m+".mts")?(Z(i,m+".cts",c,l,{...a,type:"cjs"},o,!1),Z(i,m+".mts",c,l,{...a,type:"esm"},o,!1)):Z(i,h,c,l,a,o,!1)}return{entries:i,warnings:r}},"inferEntries");var Oi=Object.defineProperty,Di=f((e,t)=>Oi(e,"name",{value:t,configurable:!0}),"o$3");const Ni=Di((e,t)=>{const{publishConfig:o}=e;return o&&(o.bin&&(typeof o.bin=="object"||typeof o.bin=="string")&&(e.bin=o.bin),o.type&&typeof o.type=="string"&&o.type!==""&&(e.type=o.type),o.main&&typeof o.main=="string"&&o.main!==""&&(e.main=o.main),o.module&&typeof o.module=="string"&&o.module!==""&&(e.module=o.module),t===void 0&&o.types&&typeof o.types=="string"&&o.types!==""?e.types=o.types:t===void 0&&o.typings&&typeof o.typings=="string"&&o.typings!==""&&(e.typings=o.typings),o.exports&&typeof o.exports=="object"&&(e.exports=o.exports)),e},"overwriteWithPublishConfig");var Pi=Object.defineProperty,Ci=f((e,t)=>Pi(e,"name",{value:t,configurable:!0}),"t$3");const _i={hooks:{"build:prepare":Ci(function(e){if(e.options.entries.length>0)return;const t=w(e.options.rootDir,e.options.sourceDir);if(!nt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const o=ho(t,{extensions:[],includeDirs:!1,includeSymlinks:!1});if(o.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let r={...e.pkg};r.publishConfig&&(e.logger.info('Using publishConfig found in package.json, to override the default key-value pairs of "'+Object.keys(r.publishConfig).join(", ")+'".'),e.logger.debug(r.publishConfig),r=Ni(r,e.options.declaration));const n=Si(r,o,e);for(const s of n.warnings)j(e,s);if(e.options.entries.push(...n.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");e.logger.info("Automatically detected entries:",x(e.options.entries.map(s=>s.fileAlias?C(s.fileAlias)+" => "+C(s.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*")):C(s.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),M([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(s=>`[${s}]`).join(" ")))},"build:prepare")}};var Ti=Object.defineProperty,Ii=f((e,t)=>Ti(e,"name",{value:t,configurable:!0}),"t$2");const Mi=Ii(async(e,t)=>{if(e==="auto")e=_i;else{if(e==="none")return{};typeof e=="string"&&(e=await t.import(e)||{})}return typeof e=="function"&&(e=e()),e},"resolvePreset");var Ai=Object.defineProperty,Ri=f((e,t)=>Ai(e,"name",{value:t,configurable:!0}),"j");const Fi=Ri(async e=>{const t=e.options.jiti.transformOptions?.babel?.plugins,o=[],r=JSON.stringify({...e.options.jiti,alias:{...Se(e,"jit"),...e.options.jiti.alias},transformOptions:{...e.options.jiti.transformOptions,babel:{...e.options.jiti.transformOptions?.babel,plugins:"__$BABEL_PLUGINS"}}},null,2).replace('"__$BABEL_PLUGINS"',Array.isArray(t)?"["+t.map((n,s)=>{if(Array.isArray(n)){const[i,...a]=n;return o.push(i),"["+["plugin"+s,...a.map(l=>JSON.stringify(l))].join(", ")+"]"}return o.push(n),"plugin"+s}).join(",")+"]":"[]");for(const n of e.options.entries){const s=$(e.options.rootDir,e.options.outDir,n.name),i=Fo(e.jiti.esmResolve(n.input,{try:!0})??n.input),a=i.replace(J,""),l=ke(i),c=Sn(l);let p=[];try{p=await Jo(i,{extensions:xe})}catch(d){j(e,`Cannot analyze ${i} for exports: ${d.toString()}`);return}const u=p.includes("default")||p.length===0;if(e.options.emitESM){const d=N(K(s),await Re("jiti",{conditions:["node","import"],url:import.meta.url})),g=a+".d.mts";L(`${s}.mjs`,c+['import { createJiti } from "'+d+'";',...o.map((h,m)=>"import plugin"+m+' from "'+h+'";'),"","const jiti = createJiti(import.meta.url, "+r+");","",'/** @type {import("'+g+'")} */','const _module = await jiti.import("'+i+'");',u?`
|
|
81
|
+
`,e.raw(i)}return s&&e.raw("Σ Total dist size (byte size):",D(H(t.buildEntries.reduce((i,l)=>i+(l.bytes??0),0),{decimals:2})),`
|
|
82
|
+
`),s},"showSizeInformation"),Yr=je((e,t)=>{const o=Gr(e.options.entries,"environment","runtime"),s=new Set,n=new Set;for(const[r,i]of Object.entries(o))for(const[l,c]of Object.entries(i)){const a={...e};!e.options.dtsOnly&&(r!=="undefined"||l!=="undefined")&&e.logger.info("Preparing build for "+(r==="undefined"?"":D(r)+" environment"+(l==="undefined"?"":" with "))+(l==="undefined"?"":D(l)+" runtime"));const p={};a.options.rollup.replace?(a.options.rollup.replace.values===void 0&&(a.options.rollup.replace.values={}),r!=="undefined"&&(p[["process","env","NODE_ENV"].join(".")]=JSON.stringify(r)),p[["process","env","EdgeRuntime"].join(".")]=JSON.stringify(l==="edge-light"),Object.freeze(p)):e.logger.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");let d="";r!=="undefined"&&(d+=r+"/"),l!=="undefined"&&(d+=l+"/");let u=!1;a.options.minify!==void 0&&(u=a.options.minify),r==="development"?u=!1:r==="production"&&(u=!0);const f=[],h=[],g=[],v=[];for(const b of c)b.cjs&&b.esm?f.push(b):b.cjs?g.push(b):b.esm?h.push(b):b.declaration&&v.push(b);if(f.length>0){const b={...a,options:{...a.options,emitCJS:!0,emitESM:!0,entries:f,minify:u,rollup:{...a.options.rollup,replace:a.options.rollup.replace?{...a.options.rollup.replace,values:{...a.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||s.add({context:b,fileCache:t,subDirectory:d}),e.options.declaration){const w=b.options.entries.filter($=>$.declaration);w.length>0&&n.add({context:{...b,options:{...b.options,entries:w}},fileCache:t,subDirectory:d})}}if(h.length>0){const b={...a,options:{...a.options,emitCJS:!1,emitESM:!0,entries:h,minify:u,rollup:{...a.options.rollup,replace:a.options.rollup.replace?{...a.options.rollup.replace,values:{...a.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||s.add({context:b,fileCache:t,subDirectory:d}),e.options.declaration){const w=b.options.entries.filter($=>$.declaration);w.length>0&&n.add({context:{...b,options:{...b.options,entries:w}},fileCache:t,subDirectory:d})}}if(g.length>0){const b={...a,options:{...a.options,emitCJS:!0,emitESM:!1,entries:g,minify:u,rollup:{...a.options.rollup,replace:a.options.rollup.replace?{...a.options.rollup.replace,values:{...a.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||s.add({context:b,fileCache:t,subDirectory:d}),e.options.declaration){const w=b.options.entries.filter($=>$.declaration);w.length>0&&n.add({context:{...b,options:{...b.options,entries:w}},fileCache:t,subDirectory:d})}}a.options.declaration&&v.length>0&&n.add({context:{...a,options:{...a.options,emitCJS:!1,emitESM:!1,entries:v,minify:u,rollup:{...a.options.rollup,replace:a.options.rollup.replace?{...a.options.rollup.replace,values:{...a.options.rollup.replace.values,...p}}:!1}}},fileCache:t,subDirectory:d})}return{builders:s,typeBuilders:n}},"prepareRollupConfig"),Qr=je(async(e,t)=>{await e.hooks.callHook("build:before",e);const{builders:o,typeBuilders:s}=Yr(e,t);await Promise.all([...o].map(async({context:n,fileCache:r,subDirectory:i})=>await Ur(n,r,i))),await Promise.all([...s].map(async({context:n,fileCache:r,subDirectory:i})=>await zr(n,r,i))),e.logger.success(xo(e.options.name?"Build succeeded for "+e.options.name:"Build succeeded"));for await(const n of Do(j(e.options.rootDir,e.options.outDir))){let r=e.buildEntries.find(i=>j(e.options.rootDir,e.options.outDir,i.path)===n.path);if(r||(r={chunk:!0,path:n.path},e.buildEntries.push(r)),!r.bytes){const i=await kt(k(e.options.rootDir,e.options.outDir,n.path));r.bytes=i.size}}return await e.hooks.callHook("build:done",e),Xr(e.logger,e)},"build");var Zr=Object.defineProperty,ei=m((e,t)=>Zr(e,"name",{value:t,configurable:!0}),"r$4");const S=ei((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var ti=Object.defineProperty,lo=m((e,t)=>ti(e,"name",{value:t,configurable:!0}),"t$4");const xe=lo(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),Be=lo((e,t,o,s)=>{if(e==="module-sync")return"esm";if(s){const i=xe(s);if(i)return i}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return o;const[n,...r]=t;return Be(n,r,o,s)},"inferExportType");var oi=Object.defineProperty,si=m((e,t)=>oi(e,"name",{value:t,configurable:!0}),"y$2");const ni=new Set(["electron","import","require","node","node-addons","default","types","deno","browser","module-sync","bun","workerd",...Ft,...ve]),He=si((e,t,o,s=[])=>{if(!e)return[];if(typeof e=="string"){const n=xe(e);if(n&&n!==t)throw new Error(`Exported file "${e}" has an extension that does not match the package.json type "${t==="esm"?"module":"commonjs"}".`);return[{file:e,key:"exports",type:n??t}]}if(typeof e=="object"){const n=Object.entries(e).filter(([i])=>!i.endsWith(".json"));let r=[];for(const[i,l]of n)if(typeof l=="string"){let c={};Number.isInteger(+i)?c={exportKey:"*"}:i.startsWith("./")?c={exportKey:i.replace("./","")}:c={exportKey:i==="."?".":"*",subKey:i},r.push({...c,file:l,key:"exports",type:Be(i,s,t,l)})}else if(typeof l=="object"&&l!==null)for(const[c,a]of Object.entries(l)){if(o===!1&&c==="types")continue;const p=Number.isInteger(+i)?c:i;typeof a=="string"?r.push({exportKey:p.replace("./",""),file:a,key:"exports",...ni.has(c)?{subKey:c}:{},type:Be(c,s,t,a)}):r=[...r,...He({[p]:a},t,o,[...s,c])]}return r}return[]},"extractExportFilenames");var ri=Object.defineProperty,Oe=m((e,t)=>ri(e,"name",{value:t,configurable:!0}),"c$4");const ii=Oe((e,t)=>e.key==="exports"&&e.subKey===pe?pe:e.key==="exports"&&e.subKey===Qe?Qe:t,"getEnvironment"),he=Oe((e,t,o,s,n,r,i)=>{const l=ii(n,r.environment);let c="node";for(const d of Ft)if(n.file.includes("."+d+".")||n.subKey===d){c=d;break}let a=e.find(d=>d.input===t&&d.environment===l&&d.runtime===c);a===void 0?a=e[e.push({environment:l,exportKey:new Set([n.exportKey].filter(Boolean)),input:t,runtime:c})-1]:a.exportKey&&n.exportKey&&a.exportKey.add(n.exportKey),i&&(a.isGlob=!0),o&&(a.outDir=s),n.isExecutable?(a.executable=!0,a.declaration=!1,n.type==="cjs"?a.cjs=!0:n.type==="esm"&&(a.esm=!0)):(/\.d\.[mc]?ts$/.test(n.file)&&r.options.declaration!==!1&&(a.declaration=r.options.declaration),n.type==="cjs"?a.cjs=!0:n.type==="esm"&&(a.esm=!0));const p=n.file.replace(Dt(n.file),"").replace(new RegExp(`^./${r.options.outDir.replace(/^\.\//,"")}/`),"");ve.has(n.subKey)&&!t.includes(p)&&(a.fileAlias=p)},"createOrUpdateEntry");let mt=!1;const gt=Oe(e=>{if(e.pkg?.dependencies?.typescript===void 0&&e.pkg?.devDependencies?.typescript===void 0)throw new Error("You tried to use a `.ts`, `.cts` or `.mts` file but `typescript` was not found in your package.json.")},"validateIfTypescriptIsInstalled"),ai=Oe((e,t,o)=>{const s=[];t.sort((l,c)=>l.split("/").length-c.split("/").length);const n=e.type==="module"?"esm":"cjs";n==="esm"&&(o.options.emitESM=!0),n==="cjs"&&(o.options.emitCJS=!0);const r=He(e.exports,n,o.options.declaration);if(e.bin){const l=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const c of l){const a=xe(c);if(a&&a!==n)throw new Error(`Exported file "${c}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);r.push({file:c,isExecutable:!0,key:"bin",type:a??n})}}e.main&&r.push({file:e.main,key:"main",type:xe(e.main)??n}),e.module&&r.push({file:e.module,key:"module",type:"esm"}),(e.types||e.typings)&&(gt(o),o.options.declaration===void 0&&(o.options.declaration="compatible"),r.push({file:e.types??e.typings,key:"types"}));const i=[];for(const l of r){o.options.declaration===void 0&&(l.key==="types"||l.subKey==="types")&&(o.options.declaration=l.file.includes(".d.ts")?"compatible":!0),o.options.emitCJS===void 0&&l.type==="cjs"&&(o.options.emitCJS=!0),o.options.emitESM===void 0&&l.type==="esm"&&(o.options.emitESM=!0);const c=l.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),a=c.endsWith("/");if(a&&["./","/"].includes(c))continue;const p=c.replace(new RegExp("(./)?"+o.options.outDir),o.options.sourceDir).replace("./",""),d="(?<=/|$)",u=a?"":"\\.\\w+$";if(l.file.includes("/*")&&l.key==="exports"){mt||(o.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),mt=!0);const v=[],b=new RegExp(d+p.replace("*","(.*)")+u),w=new RegExp(d+p.replace(/(.*)\.[^.]*$/,"$1").replace("*","(.*)")+u);for(const $ of t)(b.test($)||ve.has(l.subKey)&&w.test($))&&v.push($);if(v.length===0){s.push(`Could not find entrypoint for \`${l.file}\``);continue}for(const $ of v)he(i,$,a,c,l,o,!0);continue}const f=new RegExp(d+p+u);let h=t.find(v=>f.test(v));if(ve.has(l.subKey)&&h===void 0){const v=new RegExp(d+p.replace(/(.*)\.[^.]*$/,"$1")+u);h=t.find(b=>v.test(b))}if(h===void 0){z(k(o.options.rootDir,l.file))||s.push(`Could not find entrypoint for \`${l.file}\``);continue}(h.endsWith(".ts")||h.endsWith(".cts")||h.endsWith(".mts"))&&z(h)&>(o);const g=be(h.replace(Q,""));z(g+".cts")&&z(g+".mts")?(he(i,g+".cts",a,c,{...l,type:"cjs"},o,!1),he(i,g+".mts",a,c,{...l,type:"esm"},o,!1)):he(i,h,a,c,l,o,!1)}return{entries:i,warnings:s}},"inferEntries");var li=Object.defineProperty,ci=m((e,t)=>li(e,"name",{value:t,configurable:!0}),"o$3");const pi=ci((e,t)=>{const{publishConfig:o}=e;return o&&(o.bin&&(typeof o.bin=="object"||typeof o.bin=="string")&&(e.bin=o.bin),o.type&&typeof o.type=="string"&&o.type!==""&&(e.type=o.type),o.main&&typeof o.main=="string"&&o.main!==""&&(e.main=o.main),o.module&&typeof o.module=="string"&&o.module!==""&&(e.module=o.module),t===void 0&&o.types&&typeof o.types=="string"&&o.types!==""?e.types=o.types:t===void 0&&o.typings&&typeof o.typings=="string"&&o.typings!==""&&(e.typings=o.typings),o.exports&&typeof o.exports=="object"&&(e.exports=o.exports)),e},"overwriteWithPublishConfig");var ui=Object.defineProperty,di=m((e,t)=>ui(e,"name",{value:t,configurable:!0}),"t$3");const fi={hooks:{"build:prepare":di(function(e){if(e.options.entries.length>0)return;const t=j(e.options.rootDir,e.options.sourceDir);if(!xt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const o=No(t,{extensions:[],includeDirs:!1,includeSymlinks:!1});if(o.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let s={...e.pkg};s.publishConfig&&(e.logger.info('Using publishConfig found in package.json, to override the default key-value pairs of "'+Object.keys(s.publishConfig).join(", ")+'".'),e.logger.debug(s.publishConfig),s=pi(s,e.options.declaration));const n=ai(s,o,e);for(const r of n.warnings)S(e,r);if(e.options.entries.push(...n.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");e.logger.info("Automatically detected entries:",D(e.options.entries.map(r=>r.fileAlias?W(r.fileAlias)+" => "+W(r.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*")):W(r.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),G([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(r=>`[${r}]`).join(" ")))},"build:prepare")}};var mi=Object.defineProperty,gi=m((e,t)=>mi(e,"name",{value:t,configurable:!0}),"t$2");const hi=gi(async(e,t)=>{if(e==="auto")e=fi;else{if(e==="none")return{};typeof e=="string"&&(e=await t.import(e)||{})}return typeof e=="function"&&(e=e()),e},"resolvePreset");var yi=Object.defineProperty,bi=m((e,t)=>yi(e,"name",{value:t,configurable:!0}),"j");const vi=bi(async e=>{const t=e.options.jiti.transformOptions?.babel?.plugins,o=[],s=JSON.stringify({...e.options.jiti,alias:{...Ve(e,"jit"),...e.options.jiti.alias},transformOptions:{...e.options.jiti.transformOptions,babel:{...e.options.jiti.transformOptions?.babel,plugins:"__$BABEL_PLUGINS"}}},null,2).replace('"__$BABEL_PLUGINS"',Array.isArray(t)?"["+t.map((n,r)=>{if(Array.isArray(n)){const[i,...l]=n;return o.push(i),"["+["plugin"+r,...l.map(c=>JSON.stringify(c))].join(", ")+"]"}return o.push(n),"plugin"+r}).join(",")+"]":"[]");for(const n of e.options.entries){const r=k(e.options.rootDir,e.options.outDir,n.name),i=rs(e.jiti.esmResolve(n.input,{try:!0})??n.input),l=i.replace(Q,""),c=We(i),a=ir(c);let p=[];try{p=await is(i,{extensions:Ke})}catch(u){S(e,`Cannot analyze ${i} for exports: ${u.toString()}`);return}const d=p.includes("default")||p.length===0;if(e.options.emitESM){const u=T(K(r),await ot("jiti",{conditions:["node","import"],url:import.meta.url})),f=l+".d.mts";ne(`${r}.mjs`,a+['import { createJiti } from "'+u+'";',...o.map((h,g)=>"import plugin"+g+' from "'+h+'";'),"","const jiti = createJiti(import.meta.url, "+s+");","",'/** @type {import("'+f+'")} */','const _module = await jiti.import("'+i+'");',d?`
|
|
70
83
|
export default _module;`:"",...p.filter(h=>h!=="default").map(h=>`export const ${h} = _module.${h};`)].join(`
|
|
71
|
-
`)),e.options.declaration&&
|
|
72
|
-
`+(
|
|
73
|
-
`)),e.options.declaration&&
|
|
74
|
-
`+(
|
|
75
|
-
`;return
|
|
84
|
+
`)),e.options.declaration&&ne(`${r}.d.mts`,'export * from "'+f+`";
|
|
85
|
+
`+(d?'export { default } from "'+f+'";':""))}if(e.options.emitCJS){const u=T(K(r),await ot("jiti",{conditions:["node","require"],url:import.meta.url})),f=l+".d.cts";ne(`${r}.cjs`,a+['const { createJiti } = require("'+u+'");',...o.map((h,g)=>"const plugin"+g+" = require("+JSON.stringify(h)+")"),"","const jiti = createJiti(__filename, "+s+");","",'/** @type {import("'+f+'")} */','module.exports = jiti("'+i+'")'].join(`
|
|
86
|
+
`)),e.options.declaration&&ne(r+".d.cts",'export * from "'+f+`";
|
|
87
|
+
`+(d?'export { default } from "'+f+'";':""))}a&&(await Je(`${r}.cjs`),await Je(`${r}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var wi=Object.defineProperty,Ge=m((e,t)=>wi(e,"name",{value:t,configurable:!0}),"i$2");const $i=Ge(e=>{const{message:t,name:o="Error",stack:s}=e;if(!s)return s;const n=`${o}: ${t}
|
|
88
|
+
`;return s.startsWith(n)?s.slice(n.length):s},"extractStack"),ji=Ge(e=>`
|
|
76
89
|
${e.replaceAll(/^\n|\n$/g,"")}
|
|
77
|
-
`,"normalizeCodeFrame"),
|
|
78
|
-
file: ${
|
|
79
|
-
`+
|
|
80
|
-
${t}`)},"enhanceRollupError");var
|
|
81
|
-
⚡️ Build run in `+
|
|
90
|
+
`,"normalizeCodeFrame"),co=Ge(e=>{const t=$i(e);let o=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(o+=`
|
|
91
|
+
file: ${D(e.id+(e.loc?":"+e.loc.line+":"+e.loc.column:""))}`),e.frame&&(o+=`
|
|
92
|
+
`+ko(ji(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
|
|
93
|
+
${t}`)},"enhanceRollupError");var xi=Object.defineProperty,po=m((e,t)=>xi(e,"name",{value:t,configurable:!0}),"d$3");const ke="rollup-watch.json",ht=po(({context:e,doOnSuccessCleanup:t,fileCache:o,mode:s,runBuilder:n,runOnsuccess:r,watcher:i,useCache:l})=>{const c="watcher:"+s;i.on("change",async(a,{event:p})=>{await t?.(),e.logger.info({message:`${D(T(".",a))} was ${p}d`,prefix:c})}),i.on("restart",()=>{e.logger.info({message:"Rebuilding ...",prefix:c})}),i.on("event",async a=>{switch(a.code){case"END":{e.logger.success({message:"Rebuild finished",prefix:c}),await r?.();break}case"BUNDLE_START":{e.logger.info({message:D("build started..."),prefix:c});break}case"BUNDLE_END":{await a.result.close(),l&&o.set(s==="bundle"?ke:"dts-"+ke,a.result.cache),e.logger.raw(`
|
|
94
|
+
⚡️ Build run in `+a.duration+`ms
|
|
82
95
|
|
|
83
|
-
`),await n?.(!0);break}case"ERROR":{
|
|
84
|
-
└─ ${
|
|
96
|
+
`),await n?.(!0);break}case"ERROR":{co(a.error),e.logger.error({context:[a.error],message:"Rebuild failed: "+a.error.message,prefix:c});break}}})},"watchHandler"),ki=po(async(e,t,o,s,n)=>{const r=await io(e,t);if(await e.hooks.callHook("rollup:options",e,r),Object.keys(r.input).length===0)return;let i=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(i=!1),i&&(r.cache=t.get(ke)),e.options.rollup.watch&&typeof r.watch=="object"&&r.watch.include===void 0&&(r.watch={...r.watch,...e.options.rollup.watch},r.watch.include=[j(e.options.sourceDir,"**","*"),"package.json","packem.config.*"],Array.isArray(e.options.rollup.watch.include)?r.watch.include=[...r.watch.include,...e.options.rollup.watch.include]:e.options.rollup.watch.include&&r.watch.include.push(e.options.rollup.watch.include),r.watch.chokidar={cwd:e.options.rootDir,...r.watch.chokidar,ignored:["**/.git/**","**/node_modules/**","**/test-results/**",...r.watch.chokidar?.ignored??[]]});const l=Ye(r);await e.hooks.callHook("rollup:watch",e,l);const c=[...Array.isArray(r.input)?r.input:typeof r.input=="string"?[r.input]:Object.keys(r.input??{})];let a="Starting watcher for entries:";for(const p of c)a+=G(`
|
|
97
|
+
└─ ${T(process.cwd(),p)}`);if(e.logger.info(a),ht({context:e,doOnSuccessCleanup:n,fileCache:t,mode:"bundle",runBuilder:o,runOnsuccess:s,watcher:l,useCache:i}),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer)e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});else if(e.options.declaration){const p=await ao(e,t);i&&(p.cache=t.get("dts-"+ke)),await e.hooks.callHook("rollup:dts:options",e,p);const d=Ye(p);await e.hooks.callHook("rollup:watch",e,d),ht({context:e,fileCache:t,mode:"types",watcher:d,useCache:i})}},"watch");var Ei=Object.defineProperty,uo=m((e,t)=>Ei(e,"name",{value:t,configurable:!0}),"s$4");const Si=uo(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let Oi=class{static{m(this,"g")}static{uo(this,"FileCache")}#s;#e;#n;#t=!0;#o=new Map;constructor(t,o,s,n){this.#s=t,this.#n=s,o===void 0?n.debug({message:"Could not create cache directory.",prefix:"file-cache"}):(this.#e=o,n.debug({message:"Cache path is: "+this.#e,prefix:"file-cache"}))}set isEnabled(t){this.#t=t}has(t,o){return!this.#t||this.#e===void 0?!1:z(this.getFilePath(t,o))}get(t,o){if(!this.#t||this.#e===void 0)return;const s=this.getFilePath(t,o);if(this.#o.has(s))return this.#o.get(s);if(!z(s))return;const n=We(s);if(Si(n)){const r=JSON.parse(n);return this.#o.set(s,r),r}return this.#o.set(s,n),n}set(t,o,s){if(!this.#t||this.#e===void 0||o===void 0)return;const n=this.getFilePath(t,s);typeof o=="object"&&(o=JSON.stringify(o)),ne(n,o,{overwrite:!0})}getFilePath(t,o){let s=t.replaceAll(be(this.#s),"");return s=s.replaceAll(":","-"),j(this.#e,this.#n,o?.replaceAll(":","-")??"",be(s))}};var Di=Object.defineProperty,Ni=m((e,t)=>Di(e,"name",{value:t,configurable:!0}),"t$1");const Pi=Ni(async(e,t="")=>{let o=t;if(!o){const s=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const n of s)if(await Le(j(e,n))){o="./"+n;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(o))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return o},"findPackemFile");var Ci=Object.defineProperty,ye=m((e,t)=>Ci(e,"name",{value:t,configurable:!0}),"l$4");const _i=Z,Mi=ye((e,t)=>{const{sideEffects:o}=t;let s;if(typeof o=="boolean")s=ye(()=>o,"hasSideEffects");else if(Array.isArray(o))if(o.length<=0)s=ye(()=>!1,"hasSideEffects");else{const n=o.map(r=>r.includes("/")?r:`**/${r}`);s=_i(n,null,{resolve:e})}else s=ye(()=>null,"hasSideEffects");return s},"getPackageSideEffect");var Fe,yt;function Ii(){if(yt)return Fe;yt=1;var e=ms,t=e.spawn,o=e.exec;Fe=m(function(i,l,c){if(typeof l=="function"&&c===void 0&&(c=l,l=void 0),i=parseInt(i),Number.isNaN(i)){if(c)return c(new Error("pid must be a number"));throw new Error("pid must be a number")}var a={},p={};switch(a[i]=[],p[i]=1,process.platform){case"win32":o("taskkill /pid "+i+" /T /F",c);break;case"darwin":r(i,a,p,function(d){return t("pgrep",["-P",d])},function(){s(a,l,c)});break;default:r(i,a,p,function(d){return t("ps",["-o","pid","--no-headers","--ppid",d])},function(){s(a,l,c)});break}},"treeKill");function s(i,l,c){var a={};try{Object.keys(i).forEach(function(p){i[p].forEach(function(d){a[d]||(n(d,l),a[d]=1)}),a[p]||(n(p,l),a[p]=1)})}catch(p){if(c)return c(p);throw p}if(c)return c()}m(s,"killAll");function n(i,l){try{process.kill(parseInt(i,10),l)}catch(c){if(c.code!=="ESRCH")throw c}}m(n,"killPid");function r(i,l,c,a,p){var d=a(i),u="";d.stdout.on("data",function(g){var g=g.toString("ascii");u+=g});var f=m(function(h){if(delete c[i],h!=0){Object.keys(c).length==0&&p();return}u.match(/\d+/g).forEach(function(g){g=parseInt(g,10),l[i].push(g),l[g]=[],c[g]=1,r(g,l,c,a,p)})},"onClose");d.on("close",f)}return m(r,"buildProcessTree"),Fe}m(Ii,"requireTreeKill");var Ti=Ii();const Fi=es(Ti);var Ai=Object.defineProperty,fo=m((e,t)=>Ai(e,"name",{value:t,configurable:!0}),"l$3");const Ri=fo(e=>process.platform==="win32"&&"cmd"in e&&"code"in e&&typeof e.cmd=="string"&&e.cmd.startsWith("taskkill")&&e.code===128,"isTaskKillCmdProcessNotFoundError"),Ji=fo(async({pid:e,signal:t})=>await new Promise((o,s)=>{if(!Number.isInteger(e)||e<=0){s(new Error("Invalid process ID"));return}Fi(e,t,n=>{if(n&&!Ri(n)){s(n);return}o()})}),"killProcess");var Bi=Object.defineProperty,Li=m((e,t)=>Bi(e,"name",{value:t,configurable:!0}),"n");const mo=Li(e=>{const t=j(e,"package.json");if(!z(t))throw new Error("package.json not found at "+t);return{packageJson:gs(t),packageJsonPath:t}},"loadPackageJson");var Wi=Object.defineProperty,Ui=m((e,t)=>Wi(e,"name",{value:t,configurable:!0}),"r$2");const bt=Ui((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
|
|
85
98
|
`),e.logger.warn(`Build is done with some warnings:
|
|
86
99
|
|
|
87
100
|
${[...e.warnings].map(o=>`- ${o}`).join(`
|
|
88
|
-
`)}`),e.options.failOnWarn))throw new Error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`.")},"logBuildErrors");var
|
|
89
|
-
- `+
|
|
101
|
+
`)}`),e.options.failOnWarn))throw new Error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`.")},"logBuildErrors");var Ki=Object.defineProperty,go=m((e,t)=>Ki(e,"name",{value:t,configurable:!0}),"r$1");const vt=go(async(e,t)=>{if(typeof e.name!="string"){let o=Ue(e.input)?T(t.options.rootDir,e.input):U(e.input);o.startsWith("./")&&(o=o.slice(2)),e.name=o.replace(new RegExp(`^${t.options.sourceDir}/`),"").replace(Q,"")}if(!e.input)throw new Error(`Missing entry input: ${JSON.stringify(e)}`);It(e.input)&&(e.input=k(t.options.rootDir,e.input)),t.options.declaration&&e.declaration===void 0&&(e.declaration=t.options.declaration),e.executable&&(e.cjs===void 0||e.esm===void 0)?t.pkg.type==="commonjs"&&e.cjs===void 0&&t.options.emitCJS!==void 0?(e.cjs=t.options.emitCJS,e.esm=!1):t.pkg.type==="module"&&e.esm===void 0&&t.options.emitESM!==void 0&&(e.esm=t.options.emitESM,e.cjs=!1):e.cjs===void 0&&e.esm===void 0&&(t.options.emitCJS!==void 0&&(e.cjs=t.options.emitCJS),t.options.emitESM!==void 0&&(e.esm=t.options.emitESM)),e.outDir=k(t.options.rootDir,e.outDir??t.options.outDir)},"extendEntry"),zi=go(async e=>{e.options.entries=e.options.entries.map(t=>typeof t=="string"?{input:t,isGlob:Ze(t)}:{...t,exportKey:t.exportKey??new Set,isGlob:Ze(t.input)});for(const t of e.options.entries.filter(o=>o.isGlob)){const{isGlob:o,...s}=t,n=["**/.git/**","**/node_modules/**","**/test-results/**"];if(e.options.rollup.watch){if(typeof e.options.rollup.watch.exclude=="string")n.push(e.options.rollup.watch.exclude);else if(Array.isArray(e.options.rollup.watch.exclude))for(const i of e.options.rollup.watch.exclude)typeof i=="string"&&n.push(i)}const r=Qo([s.input],{cwd:e.options.rootDir,dot:!1,ignore:n,onlyFiles:!0});if(r.length===0)throw new hs("No files found in the glob pattern: "+D(j(e.options.rootDir,s.input)));for(const i of r)e.options.entries.push({...s,input:k(e.options.rootDir,i)});e.options.entries.splice(e.options.entries.indexOf(t),1)}for(const t of e.options.entries.filter(o=>o.fileAlias===void 0))await vt(t,e);for(const t of e.options.entries.filter(o=>o.fileAlias!==void 0))t.name=t.fileAlias,t.fileAlias=void 0,await vt(t,e)},"prepareEntries");var Vi=Object.defineProperty,Hi=m((e,t)=>Vi(e,"name",{value:t,configurable:!0}),"o");const Gi=Hi(e=>{if(e.options.validation?.packageJson?.dependencies===!1)return;const t=new Set,o=new Set(Object.keys(e.pkg?.dependencies??{})),s=new Set;for(const n of e.usedImports)o.delete(n),t.add(n);if(e.pkg?.dependencies)for(const n of Object.keys(e.pkg?.dependencies))o.delete(n);for(const n of t){const r=Rt(n);!Re(e.options.externals,n)&&!n.startsWith("chunks/")&&e.pkg?.dependencies?.[r]===void 0&&e.pkg?.peerDependencies?.[r]===void 0&&s.add(n)}o.size>0&&S(e,`Potential unused dependencies found: ${[...o].map(n=>D(n)).join(", ")}`),s.size>0&&S(e,`Potential implicit dependencies found: ${[...s].map(n=>D(n)).join(", ")}`)},"validateDependencies");var qi=Object.defineProperty,ho=m((e,t)=>qi(e,"name",{value:t,configurable:!0}),"i$1");const Xi=ho((e,t)=>ys(e,t)<=e.length/3||t.includes(e),"isSimilar"),Yi=ho((e,t)=>{const o=e.toLowerCase();return t.filter(s=>Xi(s.toLowerCase(),o))},"findAlternatives");var Qi=Object.defineProperty,wt=m((e,t)=>Qi(e,"name",{value:t,configurable:!0}),"r");const Zi=wt(e=>{const{options:t}=e;if(t.validation?.packageJson?.exports===!1)return;const o=t.validation?.packageJson,s=new Set([t.declaration&&o?.types?e.pkg.types:"",t.declaration&&o?.types?e.pkg.typings:"",...t.dtsOnly||o?.bin===!1?[""]:typeof e.pkg.bin=="string"?[e.pkg.bin]:Object.values(e.pkg.bin??{}),t.dtsOnly&&o?.main===!1?"":e.pkg.main,t.dtsOnly&&o?.module===!1?"":e.pkg.module,...o?.exports===!1?[]:He(e.pkg.exports,e.pkg.type==="module"?"esm":"cjs",t.declaration).map(l=>t.dtsOnly?l.subKey==="types"?l.file:void 0:l.file)].filter(Boolean).map(l=>l&&k(t.rootDir,l.replace(/\/[^*/]*\*[^\n\r/\u2028\u2029]*(?:[\n\r\u2028\u2029][^*/]*\*[^\n\r/\u2028\u2029]*)*(?:\/.*)?$/,"")))),n=[];for(const l of s)l&&!l.includes("*")&&!xt(l)&&n.push(l.replace(`${t.rootDir}/`,""));const r=wt(l=>T(t.rootDir,k(t.outDir,l)),"rPath"),i=e.buildEntries.filter(l=>!l.chunk).map(l=>r(l.path));if(n.length>0){let l="Potential missing or wrong package.json files:";for(const c of n){const a=Yi(c,i);l+=`
|
|
102
|
+
- `+D(c)+(a.length>0?Eo` (did you mean ${a.map(p=>`"${p}"`).join(", ")}?)`:"")}S(e,l)}},"validatePackageEntries");var ea=Object.defineProperty,ta=m((e,t)=>ea(e,"name",{value:t,configurable:!0}),"l$1");const oa=ta(e=>{const{options:{validation:t},pkg:o}=e;o.name===void 0&&t?.packageJson?.name!==!1&&S(e,"The 'name' field is missing in your package.json. Please provide a valid package name."),t?.packageJson?.files!==!1&&(o.files===void 0?S(e,"The 'files' field is missing in your package.json. Add the files to be included in the package."):o.files.length===0?S(e,"The 'files' field in your package.json is empty. Please specify the files to be included in the package."):o.files.some(r=>r.includes(e.options.outDir))||S(e,`The 'files' field in your package.json is missing the '${e.options.outDir}' directory. Ensure the output directory is included.`));const s=o.type==="commonjs"||o.type===void 0,n=o.type==="module";if(s?(t?.packageJson?.main!==!1&&(o.main===void 0&&S(e,"The 'main' field is missing in your package.json. This field should point to your main entry file."),o.main?.includes(".mjs")&&S(e,"The 'main' field in your package.json should not use a '.mjs' extension for CommonJS modules.")),t?.packageJson?.module!==!1&&(o.module===void 0&&e.options.emitESM&&S(e,"The 'module' field is missing in your package.json, but you are emitting ES modules."),o.module&&o.main&&o.module===o.main&&S(e,`Conflict detected: The 'module' and 'main' fields both point to '${o.module}'. Please ensure they refer to different module types.`),e.options.emitESM&&o.module?.includes(".cjs")&&S(e,"The 'module' field in your package.json should not use a '.cjs' extension for ES modules."))):n&&(o.exports===void 0&&!e.options.emitCJS?t?.packageJson?.exports!==!1&&S(e,"The 'exports' field is missing in your package.json. Define module exports explicitly."):e.options.emitCJS&&(t?.packageJson?.main!==!1&&o.main===void 0&&S(e,"The 'main' field is missing in your package.json. This field is needed when emitting CommonJS modules."),t?.packageJson?.module!==!1&&(o.module===void 0&&S(e,"The 'module' field is missing in your package.json. This field is necessary when emitting ES modules."),o.module?.includes(".cjs")&&S(e,"The 'module' field should not use a '.cjs' extension for ES modules."),o.module&&o.main&&o.module===o.main&&S(e,`Conflict detected: The 'module' and 'main' fields both point to '${o.module}'. Please ensure they refer to different module types.`)),t?.packageJson?.exports!==!1&&o.exports===void 0&&S(e,"The 'exports' field is missing in your package.json. This field is required for defining explicit exports."))),o.exports,t?.packageJson?.bin!==!1){if(typeof o.bin=="string"&&o.bin.includes(s?".mjs":".cjs"))S(e,`The 'bin' field in your package.json should not use a ${s?".mjs":".cjs"} extension for ${s?"CommonJS":"ES modules"} binaries.`);else if(typeof o.bin=="object")for(const[r,i]of Object.entries(o.bin))i&&i.includes(s?".mjs":".cjs")&&S(e,`The 'bin.${r}' field in your package.json should not use a ${s?".mjs":".cjs"} extension for ${s?"CommonJS":"ES modules"} binaries.`)}if(e.options.declaration){let r=!0;o.type==="module"&&(r=!!o.main?.endsWith(".cjs")),o.types===void 0&&o.typings===void 0&&r&&t?.packageJson?.types!==!1&&S(e,"The 'types' field is missing in your package.json. This field should point to your type definitions file."),(e.options.declaration===!0||e.options.declaration==="compatible")&&r&&t?.packageJson?.typesVersions!==!1&&(o.typesVersions===void 0||Object.keys(o.typesVersions).length===0)&&S(e,"No 'typesVersions' field found in your package.json. Consider adding this field, or change the declaration option to 'node16' or 'false'.")}},"validatePackageFields");var sa=Object.defineProperty,na=m((e,t)=>sa(e,"name",{value:t,configurable:!0}),"i");const ra=na(e=>{const{packageJson:t}=mo(e.options.rootDir);e.pkg=t,Gi(e),oa(e),Zi(e)},"validator");var ia=Object.defineProperty,aa=m((e,t)=>ia(e,"name",{value:t,configurable:!0}),"a");const la=/^[^a-z_@#~]|[^\w/@#~-]|@\/|#\/|~\//i,ca=new Set(["abstract","await","boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with","yield"]),$t=aa(e=>{if(!Array.isArray(e)&&e!==null)for(const[t,o]of Object.entries(e)){if(typeof t!="string"||t.trim()==="")throw new Error(`Alias name "${t}" is invalid. Alias names should be non-empty strings.`);if(la.test(t))throw new Error(`Alias name "${t}" is invalid. Alias names should start with a letter or underscore and only contain letters, numbers, underscores, and dashes.`);if(ca.has(t))throw new Error(`Alias name "${t}" is a reserved keyword and cannot be used.`);const s=k(o);if(!z(s))throw new Error(`Target path "${s}" for alias "${t}" does not exist.`)}},"validateAliasEntries");var pa=Object.defineProperty,F=m((e,t)=>pa(e,"name",{value:t,configurable:!0}),"u");const ua=F(e=>{switch(e){case"preserve":case"react-native":return"preserve";case"react":return"transform";case"react-jsx":case"react-jsxdev":return"automatic";default:return}},"resolveTsconfigJsxToJsxRuntime"),da=F((e,t,o,s,n,r,i,l,c)=>{const a=ua(c?.config.compilerOptions?.jsx),p=To(r,n,i,{alias:{},browserTargets:Io(),cjsInterop:!1,clean:!0,debug:s,declaration:void 0,emitCJS:void 0,emitESM:void 0,entries:[],externals:[...qe.builtinModules,...qe.builtinModules.map(d=>`node:${d}`)],failOnWarn:!0,fileCache:!0,jiti:{alias:{},debug:s,interopDefault:!0},minify:o===pe,name:(l.name??"").split("/").pop()??"default",outDir:c?.config.compilerOptions?.outDir??"dist",rollup:{alias:{},cjsInterop:{addDefaultProperty:!1},commonjs:{extensions:[".mjs",".js",".json",".node",".cjs"],ignoreTryCatch:!0,preserveSymlinks:!0,transformMixedEsModules:!1},css:{autoModules:!0,extensions:[".css",".pcss",".postcss",".sss"],namedExports:!0},dts:{compilerOptions:{baseUrl:c?.config.compilerOptions?.baseUrl??".",checkJs:!1,composite:!1,declaration:!0,declarationMap:!1,emitDeclarationOnly:!0,incremental:!1,moduleResolution:100,noEmit:!1,noEmitOnError:!0,preserveSymlinks:!1,skipLibCheck:!0,target:99},respectExternal:!0},dynamicVars:{errorWhenNoFilesFound:!0,include:/\bimport\s*[(/]/},esbuild:{charset:"utf8",exclude:se,jsx:a,jsxDev:c?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:c?.config.compilerOptions?.jsxFactory,jsxFragment:c?.config.compilerOptions?.jsxFragmentFactory,jsxImportSource:c?.config.compilerOptions?.jsxImportSource,jsxSideEffects:!0,keepNames:!0,sourcesContent:!1,target:c?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:c?.config},isolatedDeclarations:{exclude:se,ignoreErrors:!1,include:ae},json:{preferConst:!0},license:{dependenciesTemplate:F((d,u,f)=>`
|
|
90
103
|
# Licenses of bundled dependencies
|
|
91
|
-
The published ${
|
|
92
|
-
`+(
|
|
104
|
+
The published ${f} artifact additionally contains code with the following licenses:
|
|
105
|
+
`+(d.length>0?`${d.join(", ")}
|
|
93
106
|
|
|
94
107
|
`:`
|
|
95
108
|
`)+`# Bundled dependencies:
|
|
96
|
-
`+
|
|
109
|
+
`+u,"dependenciesTemplate"),dtsTemplate:F((d,u,f)=>`
|
|
97
110
|
# Licenses of bundled types
|
|
98
|
-
The published ${
|
|
99
|
-
`+(
|
|
111
|
+
The published ${f} artifact additionally contains code with the following licenses:
|
|
112
|
+
`+(d.length>0?`${d.join(", ")}
|
|
100
113
|
|
|
101
114
|
`:`
|
|
102
115
|
`)+`# Bundled types:
|
|
103
|
-
`+
|
|
116
|
+
`+u,"dtsTemplate")},node10Compatibility:{},patchTypes:{},polyfillNode:{},preserveDirectives:{exclude:se,include:ae},preserveDynamicImports:!0,raw:{exclude:se,include:[/\.(md|txt|htm|html|data)$/]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,exportConditions:["module-sync"],extensions:Ke,preferBuiltins:!1},shebang:{replace:!1,shebang:"#!/usr/bin/env node"},shim:{exclude:se,include:ae},sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:c?.config.compilerOptions?.esModuleInterop===!1,include:ae,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:o===pe,...c?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(c.config.compilerOptions.jsx)?{jsxFragmentPragma:c.config.compilerOptions.jsxFragmentFactory,jsxImportSource:c.config.compilerOptions.jsxImportSource,jsxPragma:c.config.compilerOptions.jsxFactory,jsxRuntime:a,transforms:["typescript","jsx",...c.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...c?.config.compilerOptions?.esModuleInterop?["imports"]:[]]}},swc:{include:ae,inlineSourcesContent:!1,inputSourceMap:!1,isModule:!0,jsc:{experimental:{keepImportAttributes:!0},externalHelpers:!1,keepClassNames:!0,loose:!0,parser:{decorators:c?.config.compilerOptions?.experimentalDecorators,syntax:c?"typescript":"ecmascript",[c?"tsx":"jsx"]:!0},target:c?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:c?.config.compilerOptions?.emitDecoratorMetadata,decoratorVersion:"2022-03",legacyDecorator:c?.config.compilerOptions?.experimentalDecorators,react:{development:o!==pe,pragma:c?.config.compilerOptions?.jsxFactory,pragmaFrag:c?.config.compilerOptions?.jsxFragmentFactory,runtime:a,throwIfNamespace:!0},treatConstEnumAsEnum:c?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:c?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:Mi(t,l),preset:"recommended",propertyReadSideEffects:!0},visualizer:{},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:se}},rootDir:t,sourceDir:"src",sourcemap:!1,transformerName:void 0,typedoc:{excludePrivate:!0,groupOrder:["Classes","Constructors","Accessors","Methods","Functions","Namespaces","Variables","Enumerations","Interfaces","Type Aliases","*"],kindSortOrder:["Project","Module","Class","Interface","Function","Namespace","Variable","Enum","EnumMember","TypeAlias","Reference","Constructor","Property","Accessor","Method","Parameter","TypeParameter","TypeLiteral","CallSignature","ConstructorSignature","IndexSignature","GetSignature","SetSignature"],marker:"TYPEDOC",name:l.name??"unknown",pretty:!0,readme:"none",showConfig:s,tsconfig:c?.path}});if(!p.transformerName){const d=new Map([...Object.entries(l.dependencies??{}),...Object.entries(l.devDependencies??{})]);let u="0.0.0";if(d.has("esbuild"))p.transformerName="esbuild",u=d.get("esbuild");else if(d.has("@swc/core"))p.transformerName="swc",u=d.get("@swc/core");else if(d.has("sucrase"))p.transformerName="sucrase",u=d.get("sucrase");else throw new Error("Unknown transformer, check your transformer options or install one of the supported transformers: esbuild, swc, sucrase");e.info("Using "+D("rollup ")+Ao),e.info({message:"Using "+D(p.transformerName)+" "+u,prefix:"transformer"})}return p.rollup.resolve&&p.rollup.resolve.preferBuiltins===!0&&(p.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true")),p.browserTargets&&p.browserTargets.length>0&&e.debug("Using browser targets: "+p.browserTargets.join(", ")),l.dependencies&&p.externals.push(...Object.keys(l.dependencies)),l.peerDependencies&&p.externals.push(...Object.keys(l.peerDependencies)),l.optionalDependencies&&p.externals.push(...Object.keys(l.optionalDependencies)),$t(p.alias),p.rollup.alias&&p.rollup.alias.entries&&$t(p.rollup.alias.entries),p},"generateOptions"),fa=F(async(e,t,o,s,n,r,i,l,c,a)=>{const p=await hi(i.preset??r.preset??"auto",a),d=da(e,t,s,n,r,i,p,l,c);Po(j(d.rootDir,d.outDir));const u={buildEntries:[],dependencyGraphMap:new Map,environment:s,hooks:Fo(),jiti:Nt(d.rootDir,d.jiti),logger:e,mode:o,options:d,pkg:l,tsconfig:c,usedImports:new Set,warnings:new Set};p.hooks&&u.hooks.addHooks(p.hooks),r.hooks&&u.hooks.addHooks(r.hooks),i.hooks&&u.hooks.addHooks(i.hooks),await u.hooks.callHook("build:prepare",u),u.options.emitESM===void 0&&u.logger.info("Emitting of ESM bundles, is disabled."),u.options.emitCJS===void 0&&u.logger.info("Emitting of CJS bundles, is disabled."),u.options.minify&&u.logger.info("Minification is enabled, the output will be minified");const f=l.dependencies?.typescript!==void 0||l.devDependencies?.typescript!==void 0;if(u.options.declaration&&u.tsconfig===void 0&&f)throw new Error("Cannot build declaration files without a tsconfig.json");return f?u.options.declaration===!1&&u.logger.info({message:"Generation of declaration files are disabled.",prefix:"dts"}):(u.options.declaration=!1,u.logger.info({message:"Typescript is not installed. Generation of declaration files are disabled.",prefix:"dts"})),u.options.declaration&&u.logger.info("Using typescript version: "+D(l.devDependencies?.typescript??l.dependencies?.typescript??"unknown")),u.options.declaration&&(l.dependencies?.typescript||l.devDependencies?.typescript)&&!u.tsconfig?.config.compilerOptions?.isolatedModules&&u.logger.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
|
|
104
117
|
Because none of the third-party transpiler, packem uses under the hood is type-aware, some techniques or features often used in TypeScript are not properly checked and can cause mis-compilation or even runtime errors.
|
|
105
|
-
To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),await
|
|
118
|
+
To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),await zi(u),u},"createContext"),ma=F(async e=>{const t=[];if(e.options.clean)for(const o of new Set(e.options.entries.map(s=>s.outDir).filter(Boolean).sort()))o===e.options.rootDir||o===e.options.sourceDir||e.options.rootDir.startsWith(o.endsWith("/")?o:`${o}/`)||t.some(s=>o.startsWith(s))||(t.push(o),e.logger.info(`Cleaning dist directory: \`./${T(e.options.rootDir,o)}\``),await Co(o))},"cleanDistributionDirectories"),ga=F(async(e,t,o)=>{if(e&&z(j(e,"keystore1.json"))){const s=Ot(j(e,"keystore.json")),n=jt(e,{withFileTypes:!0}).filter(i=>i.isDirectory());let r=o;for(const i of n)s[i.name]||(await wo(j(e,i.name),{force:!0,recursive:!0}),r&&t.raw(`
|
|
106
119
|
|
|
107
|
-
`),t.info({message:"Removing "+i.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),
|
|
108
|
-
${
|
|
109
|
-
`),await
|
|
110
|
-
⚡️ `+
|
|
120
|
+
`),t.info({message:"Removing "+i.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),r=!1)}},"removeOldCacheFolders"),ha=F(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),ml=F(async(e,t,o,s,n={})=>{const{configPath:r,debug:i,tsconfigPath:l,...c}=n;s.wrapAll(),e=k(Ne.cwd(),e),s.debug("Root directory:",e);const{packageJson:a,packageJsonPath:p}=mo(e);s.debug("Using package.json found at",p);let d;if(l){const v=j(e,l);if(!await Le(v))throw new Error("tsconfig.json not found at "+v);d={config:_o(v),path:v},s.info("Using tsconfig settings at",v)}else if(a.dependencies?.typescript||a.devDependencies?.typescript)try{d=await Mo(e),s.debug("Using tsconfig settings found at",d.path)}catch{s.info("No tsconfig.json or jsconfig.json found.")}const u=So("@visulima/packem",{cwd:e});let f=!1,h,g;try{const v=await Pi(e,r??""),b=Nt(e,{debug:i});let w=await b.import(v,{default:!0,try:!0})||{};typeof w=="function"&&(w=await w(o,t)),s.debug("Using packem config found at",j(e,v));const $=q(JSON.stringify({version:a.version,...a.dependencies,...a.devDependencies,...a.peerDependencies,...a.peerDependenciesMeta,browser:a.browser,eNode:a.engines?.node,exports:a.exports,main:a.main,module:a.module,type:a.type,types:a.types}))+q(JSON.stringify(w));u&&us($,u,s);const O=new Oi(e,u,$,s),y=await fa(s,e,t,o,i??!1,c,w,a,d,b);O.isEnabled=y.options.fileCache,y.logger.info(D(ha(t)+" "+y.options.name)),y.logger.debug({context:y.options.entries,message:`${W("Root dir:")} ${y.options.rootDir}
|
|
121
|
+
${W("Entries:")}`}),await ma(y);const P=F(async R=>{for await(const[V,E]of Object.entries(y.options.builder??{})){y.logger.raw(`
|
|
122
|
+
`),await y.hooks.callHook("builder:before",V,y);const N=Date.now(),x=F(()=>Xe(Math.floor(Date.now()-N)),"getBuilderDuration");await E(y,u,O,f),await y.hooks.callHook("builder:done",V,y),y.logger.raw(`
|
|
123
|
+
⚡️ `+V+" run in "+x()),R&&y.logger.raw(`
|
|
111
124
|
|
|
112
|
-
`)}},"runBuilder"),
|
|
113
|
-
⚡️ Build run in `+
|
|
114
|
-
`),
|
|
125
|
+
`)}},"runBuilder"),_=F(async()=>{if(h!==void 0)await Ji({pid:h.pid,signal:c.killSignal??w.killSignal??"SIGTERM"});else if(g!==void 0)try{await g()}catch(R){throw new Error("onSuccess function cleanup failed: "+R.message,{cause:R})}h=void 0,g=void 0},"doOnSuccessCleanup"),J=F(async()=>{if(typeof y.options.onSuccess=="function")try{g=await y.options.onSuccess()}catch(R){throw new Error("onSuccess function failed: "+R.message,{cause:R})}else if(typeof y.options.onSuccess=="string"){const R=y.options.onSuccessTimeout??3e4;if(h=Ro(y.options.onSuccess,[],{nodeOptions:{shell:!0,stdio:"inherit",timeout:R}}),await h,h.exitCode&&h.exitCode!==0)throw new Error("onSuccess script failed with exit code "+h.exitCode+". Check the output above for details.")}},"runOnsuccess"),A=Date.now(),te=F(()=>Xe(Math.floor(Date.now()-A)),"getDuration");if(t==="watch"){if(y.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await ki(y,O,P,J,_),bt(y,!1);return}t==="jit"?(await vi(y),await y.hooks.callHook("build:done",y)):(f=await Qr(y,O),await y.hooks.callHook("validate:before",y),ra(y),await y.hooks.callHook("validate:done",y),bt(y,f)),y.logger.raw(`
|
|
126
|
+
⚡️ Build run in `+te()),await P(),await J(),Ne.on("SIGINT",async()=>{await _()}),Ne.on("SIGTERM",async()=>{await _()})}catch(v){throw s.raw(`
|
|
127
|
+
`),co(v),v}finally{s.restoreAll(),await ga(u,s,f)}},"packem");export{ml as default};
|