@visulima/packem 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -0
- package/LICENSE.md +62 -0
- package/README.md +255 -3
- 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 +114 -90
- 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-C4qkzoBI.d.ts +466 -0
- package/dist/packem_shared/types-CHrJNTEb.d.mts +466 -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-DYP5sakC.d.cts +466 -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/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 wo=Object.defineProperty;var f=(e,t)=>wo(e,"name",{value:t,configurable:!0});import{readdirSync as xt,existsSync as kt}from"node:fs";import{stat as Et,chmod as $o,rm as jo}from"node:fs/promises";import qe from"node:module";import Ne,{env as xo,versions as ko}from"node:process";import{cyan as D,bold as W,gray as G,green as Eo,yellow as So,grey as Oo}from"@visulima/colorize";import{findCacheDirSync as Do}from"@visulima/find-cache-dir";import{readFile as St,isAccessible as Le,writeFile as No,readFileSync as We,writeFileSync as ne,writeJsonSync as Ot,readJsonSync as Dt,walk as Po,isAccessibleSync as z,collectSync as Co,ensureDirSync as _o,emptyDir as Mo}from"@visulima/fs";import{formatBytes as H,duration as Xe}from"@visulima/humanizer";import{normalize as U,join as j,relative as I,dirname as K,basename as re,isAbsolute as Ue,resolve as k,parse as Pe,toNamespacedPath as ve,extname as Nt}from"@visulima/path";import{readTsConfig as Io,findTsConfig as To}from"@visulima/tsconfig";import Fo from"browserslist";import{defu as Ao}from"defu";import{createHooks as Ro}from"hookable";import{createJiti as Pt}from"jiti";import{rollup as Ct,watch as Ye,VERSION as Jo}from"rollup";import{exec as Bo}from"tinyexec";import _t from"@rollup/plugin-alias";import Lo from"@rollup/plugin-commonjs";import Wo from"@rollup/plugin-dynamic-import-vars";import{nodeResolve as Mt}from"@rollup/plugin-node-resolve";import It from"@rollup/plugin-replace";import{wasm as Uo}from"@rollup/plugin-wasm";import{isRelative as Tt,resolveAlias as Ko}from"@visulima/path/utils";import zo from"rollup-plugin-polyfill-node";import{visualizer as Vo}from"rollup-plugin-visualizer";import{minVersion as Ft,valid as Ho,coerce as Go}from"semver";import{E as Q,D as Ke,C as qo,S as Xo,R as At,a as be,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 Yo,createFilter as Z}from"@rollup/pluginutils";import Y from"magic-string";import Qo from"glob-parent";import{glob as Zo,isDynamicPattern as Ze,globSync as es}from"tinyglobby";import{P as ts,g as os}from"./packem_shared/index-J19UlsNC.mjs";import{SourceMapGenerator as ss}from"source-map-js";import{m as Ae}from"./packem_shared/sourcemap-DDVjvayf.mjs";import{i as ns,a as rs,b as et,c as tt,e as Ce,d as is,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 Rt,fileURLToPath as as,resolveModuleExportNames as ls,resolvePath as ot}from"mlly";import{parseAsync as cs}from"oxc-parser";import ps from"@rollup/plugin-json";import us from"rollup-plugin-license";import{g as ds,d as fs}from"./packem_shared/create-or-update-key-storage-BxGi6kMH.mjs";import{fileURLToPath as ms}from"node:url";import{parse as gs}from"@babel/parser";import hs from"child_process";import{parsePackageJson as ys}from"@visulima/package/package-json";import{NotFoundError as vs}from"@visulima/fs/error";import{distance as bs}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 ws=Object.defineProperty,$s=f((e,t)=>ws(e,"name",{value:t,configurable:!0}),"a$i");const Re=$s((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):o===t),"arrayIncludes");var js=Object.defineProperty,xs=f((e,t)=>js(e,"name",{value:t,configurable:!0}),"a$h");const ue=xs(e=>e==null?[]:Array.isArray(e)?e:[e],"arrayify");var ks=Object.defineProperty,Es=f((e,t)=>ks(e,"name",{value:t,configurable:!0}),"a$g");const Jt=Es((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var Ss=Object.defineProperty,Bt=f((e,t)=>Ss(e,"name",{value:t,configurable:!0}),"s$d");const Os=Bt((e,t,o)=>{const s=o??new Map;return(...n)=>{const i=t?typeof t=="function"?t(...n):t:JSON.stringify({args:n}),r=s.get(i);if(r!==void 0)return r;const a=e(...n);return s.set(i,a),a}},"memoize"),Ds=Bt(e=>{const t=new Map;return o=>Os(e,o,t)},"memoizeByKey");var Ns=Object.defineProperty,de=f((e,t)=>Ns(e,"name",{value:t,configurable:!0}),"r$d");const Ps=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 Yo(t.id))yield o;break}}},"exportName"),Cs=de(function*(e){if(e.declaration)for(const t of Ps(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"),_s=de(function*(e){e.exported?yield{exportedName:e.exported.name,from:"self",type:"named"}:yield{from:"other",source:e.source.value,type:"barrel"}},"parseExportAll"),Ms=de(function*(){yield{exportedName:"default",from:"self",type:"named"}},"parseExportDefault"),Is=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*_s(s);break}case"ExportDefaultDeclaration":{yield*Ms();break}case"ExportNamedDeclaration":{yield*Cs(s);break}}},"parseExports");var Ts=Object.defineProperty,fe=f((e,t)=>Ts(e,"name",{value:t,configurable:!0}),"n$a");const Lt=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"),Fs=fe(async function*(e,t,o){const s=await Lt(e,t.source,o);s&&(yield*ze(e,s))},"gatherBarrelReExports"),As=fe(async function*(e,t,o){const s=await Lt(e,t.source,o);if(!s)return;const n=new Map(t.bindings.map(i=>[i.importedName,i]));for await(const i of ze(e,s)){const r=n.get(i.exportedName);r&&(yield{...i,exportedName:r.exportedName})}},"gatherNamedReExports"),Rs=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 Is(e,t))o.from==="self"?yield*Rs(t,o):o.type==="barrel"?yield*Fs(e,o,t):yield*As(e,o,t)},"gatherExports");var Js=Object.defineProperty,Bs=f((e,t)=>Js(e,"name",{value:t,configurable:!0}),"r$c");const Ls=Bs(()=>({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 Ws=Object.defineProperty,Us=f((e,t)=>Ws(e,"name",{value:t,configurable:!0}),"r$b");const Ks=Us((e,t)=>{const o=e,s=[];let n;for(;(n=o.exec(t))!==null;)n.index===o.lastIndex&&o.lastIndex++,n.forEach(i=>{s.push(i)});return s.filter(Boolean)},"getRegexMatches");var zs=Object.defineProperty,Vs=f((e,t)=>zs(e,"name",{value:t,configurable:!0}),"a$f");const Wt=Vs(e=>{const t=Ks(/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[i,r]=n.split(" as ");r==="default"&&(s=i)}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 = `+
|
|
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 Hs=Object.defineProperty,st=f((e,t)=>Hs(e,"name",{value:t,configurable:!0}),"i$9");const Ut=st(({addDefaultProperty:e=!1,logger:t,type:o})=>({name:"packem:cjs-interop",renderChunk:st(async(s,n,i)=>{if(n.type!=="chunk"||!n.isEntry)return null;if(i.format==="cjs"&&i.exports==="auto"){const r=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(s);if(r===null||r.length<3)return null;const a=new Y(s);a.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),a.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&a.append(`
|
|
11
|
+
module.exports.default = `+r[2]+";");let c=a.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:a.generateMap({hires:!0})}}return i.format==="es"&&/\.d\.(?:ts|cts)$/.test(n.fileName)?o!=="commonjs"&&n.fileName.endsWith(".d.mts")?null:Wt(s):null},"renderChunk")}),"cjsInteropPlugin");var Gs=Object.defineProperty,qs=f((e,t)=>Gs(e,"name",{value:t,configurable:!0}),"f$d");const Xs=qs((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(i=>{if(typeof i=="string")return{src:i};if(typeof i=="object"&&"src"in i)return i}).filter(Boolean):typeof n=="string"&&(n=[{src:n}]),{async buildStart(){const i=await Promise.all(n.flatMap(r=>Array.isArray(r.src)?r.src.map(a=>({...r,src:a})):r).map(async r=>await Zo(ue(r.src),{ignore:ue(r.exclude).filter(Boolean)}).then(a=>({dest:r.dest??"",parent:Qo(r.src),src:a}))));for(const r of i)for(const a of r.src){let c;o.has(a)?c=o.get(a):(c={copied:[],dest:[],timestamp:0},o.set(a,c));const l=s.flatten?U(r.dest):j(r.dest,I(r.parent,K(a)));c.dest.includes(l)||c.dest.push(l),this.addWatchFile(a)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...o].map(async([r,a])=>{let c;try{const l=await Et(r);if(!l.isFile())return;const p=l.mtime.getTime();p>a.timestamp&&(a.timestamp=p,a.copied=[]),c=await St(r,{buffer:!0})}catch(l){t.error({context:[l],message:`error reading file ${r}`,prefix:"plugin:copy"});return}for(const l of a.dest){if(s.copyOnce&&a.copied.includes(l))continue;const p=re(r),d=j(l,p);try{this.emitFile({[s.exactFileNames?"fileName":"name"]:d,source:c,type:"asset"}),t.debug({message:`copied ${r} → ${d}`,prefix:"plugin:copy"}),a.copied.push(l)}catch(u){t.error({context:[u],message:`error copying file ${r} → ${d}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");var Ys=Object.defineProperty,Qs=f((e,t)=>Ys(e,"name",{value:t,configurable:!0}),"r$a");const nt=Qs((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 Zs=Object.defineProperty,en=f((e,t)=>Zs(e,"name",{value:t,configurable:!0}),"a$e");const tn=4,on=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):tn;let sn=class{static{f(this,"f")}static{en(this,"LoaderManager")}test;loaders=new Map;options;workQueue;logger;constructor({extensions:t,loaders:o,logger:s,options:n}){this.test=i=>t.some(r=>i.toLowerCase().endsWith(r)),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 ts({concurrency:on-1}));for await(const[s,n]of this.loaders){const i={...o,options:this.options[s]??{}};if(n.alwaysProcess||nt(i.id,n.test)){this.logger.debug(`Processing ${s} loader for ${i.id}`);const r=await this.workQueue.add(n.process.bind(i,t));r&&(t=r)}}return t}};var nn=Object.defineProperty,rn=f((e,t)=>nn(e,"name",{value:t,configurable:!0}),"u$a");const an=rn(async e=>{const t=new ss({file:""}),o=[];let s=0;for await(const{css:n,map:i}of e){o.push(n);const r=Ae(i),a=r.toObject();if(!a)continue;const c=r.toConsumer();if(c){if(c.eachMapping(l=>{t.addMapping({generated:{column:l.generatedColumn,line:s+l.generatedLine},name:l.name,original:{column:l.originalColumn,line:l.originalLine},source:l.source})}),a.sourcesContent)for(const l of a.sources)t.setSourceContent(l,c.sourceContentFor(l,!0));s+=n.split(`
|
|
12
|
+
`).length}}return{css:o.join(`
|
|
13
|
+
`),map:t}},"concat");var ln=Object.defineProperty,ce=f((e,t)=>ln(e,"name",{value:t,configurable:!0}),"b$4");const cn=ce(async(e,t)=>e.sort((o,s)=>t.indexOf(o.name)-t.indexOf(s.name)),"sortByNameOrder"),pn=ce(async(e,t,o,s,n,i,r,a,c,l)=>{const p={...l,...e.alias},d=Z(e.include,e.exclude),u=ns(e.sourceMap),m={...rs(e.mode),autoModules:e.autoModules??!1,dts:e.dts,extensions:e.extensions,namedExports:e.namedExports};typeof m.inject=="object"&&m.inject.treeshakeable&&(m.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&&(m.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&&(m.postcss.parser=await Ce(e.postcss.parser,"parser",s)),e.postcss?.syntax&&(m.postcss.syntax=await Ce(e.postcss.syntax,"syntax",s)),e.postcss?.stringifier&&(m.postcss.stringifier=await Ce(e.postcss.stringifier,"stringifier",s)),e.postcss?.plugins&&(m.postcss.plugins=await is(e.postcss.plugins,s)));const g=new sn({extensions:m.extensions,loaders:await cn(e.loaders,["sourcemap","stylus","less","sass","postcss"]),logger:t,options:{...e,...m,alias:p}});let b=[];const v=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(b.length===0)return null;const $=v(w.modules,this.getModuleInfo),O=b.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(b.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 m.extract=="string"?U(m.extract).replace(/^\.[/\\]/,""):U(`${E}.css`);Ue(x)&&this.error(["Extraction path must be relative to the output directory,",`which is ${I(s,y)}`].join(`
|
|
14
|
+
`)),Tt(x)&&this.error(["Extraction path must be nested inside output directory,",`which is ${I(s,y)}`].join(`
|
|
15
|
+
`));const B=b.filter(L=>N.includes(L.id)).sort((L,oe)=>N.lastIndexOf(L.id)-N.lastIndexOf(oe.id)),me=await an(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 m.extract=="string"){t.debug({message:`Extracting to ${m.extract}`,prefix:"css"});const E=[];for(const x of _){const B=v(x.modules,this.getModuleInfo);V.push(...B),E.push(...B)}for(const x of J)E.push(...v(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=v(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=v(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(bo=>u.transform?.(bo,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 ${I(s,$)}`),null}catch{}typeof e.onImport=="function"&&e.onImport(w,$);const O={alias:p,assets:new Map,autoModules:m.autoModules,browserTargets:o,cwd:s,debug:a,deps:new Set,dts:m.dts,emit:m.emit,environment:i,extensions:m.extensions,extract:m.extract,id:$,inject:m.inject,logger:t,namedExports:m.namedExports,options:{},plugin:this,sourceDir:n,sourceMap:u,useSourcemap:r,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;b=b.filter(_=>_.id!==P),b.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 un=Object.defineProperty,dn=f((e,t)=>un(e,"name",{value:t,configurable:!0}),"u$9");const fn=`
|
|
16
|
+
/* eslint-disable */
|
|
17
|
+
/* prettier-ignore */
|
|
18
|
+
// @ts-nocheck
|
|
19
|
+
/**
|
|
20
|
+
* Generated by packem
|
|
21
|
+
* @see https://npmjs.com/@visulima/packem
|
|
22
|
+
*/
|
|
23
|
+
`.trim(),mn=dn((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,i){let r=s;if(e.postcss&&typeof e.postcss.modules=="object"?r=_e(e.postcss.modules.include,i):e.lightningcss&&typeof e.lightningcss.modules=="object"&&(r=_e(e.lightningcss.modules.include,i)),e.autoModules&&r===void 0&&(r=_e(e.autoModules,i)),!r)return null;const{types:a}=this.getModuleInfo(i)?.meta.styles??{};return a===void 0||await Le(i)&&(await No(i+".d.ts",`${fn}
|
|
24
|
+
${a}`),o.info({message:`Generated types for ${U(i).replace(t+"/","")}`,prefix:"dts:css-modules"}),this.addWatchFile(i+".d.ts")),null}}},"cssModulesTypes");var gn=Object.defineProperty,Ee=f((e,t)=>gn(e,"name",{value:t,configurable:!0}),"t$9");const hn=/\Wrequire(?:\.resolve)?\(/,yn=Ee((e,t)=>{if(xo.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),hn.test(e)&&(n=!0),!o&&!s&&!n)return null;const i=Rt(e).pop(),r=i?i.end:0,a=new Y(e);return a.appendRight(r,t(o,s,n)),{code:a.toString(),map:a.generateMap()}},"CJSToESM"),vn=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"),bn=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"),wn=Ee((e,t)=>{const o=Z(t.include,t.exclude);return{name:"packem:esm-shim-cjs-syntax",renderChunk(s,n,i){if(i.format==="es"&&o(n.fileName)){let r=vn;if(e.engines?.node){const a=Ft(e.engines.node);a&&a.major>=20&&a.minor>=11&&(r=bn)}return yn(s,r)}return null}}},"esmShimCjsSyntaxPlugin");var $n=Object.defineProperty,jn=f((e,t)=>$n(e,"name",{value:t,configurable:!0}),"m$a");const xn=jn(()=>({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 kn=Object.defineProperty,En=f((e,t)=>kn(e,"name",{value:t,configurable:!0}),"a$d");const Sn=En((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("/"),i=t.split("/");let r=n.length-1,a=i.length-1;for(;r>=0&&a>=0&&n[r]===i[a];)r--,a--;const c=n.slice(0,r).join("/"),l=i.slice(a).join("/");return c+(l?"/"+l:"")},"extendString");var On=Object.defineProperty,Dn=f((e,t)=>On(e,"name",{value:t,configurable:!0}),"s$a");const Nn=Dn((...e)=>{if(e.length===0)return"";if(e.length===1)return K(e[0]);e=e.map(n=>ve(n));const[t,...o]=e;let s=t.split("/");for(const n of o){const i=n.split("/",s.length);let r=0;for(const a of i)if(a===s[r])r+=1;else{s=s.slice(0,r);break}s=s.slice(0,r)}return s.length<=1&&s[0]===""?`/${s[0]}`:s.join("/")},"lowestCommonAncestor");var Pn=Object.defineProperty,Me=f((e,t)=>Pn(e,"name",{value:t,configurable:!0}),"m$8");const Cn=Me((e,t,o,s,n={})=>{const i=Z(n.include,n.exclude),r={},a=Me((l,p)=>{r[l.replace(Q,"")]=p},"addOutput");async function c(l,p){if(!i(p))return;let d;try{const g=await cs(l,{sourceFilename:p});d=JSON.parse(g.program)}catch{}if(d){const g=d.body.filter(b=>b.type==="ImportDeclaration"||b.type==="ExportAllDeclaration"||b.type==="ExportNamedDeclaration");for(const b of g){if(!b.source||re(b.source.value).includes("."))continue;const v=await this.resolve(b.source.value,p);if(!(!v||v.external)&&(v.id.endsWith(".ts")||v.id.endsWith(".cts")||v.id.endsWith(".mts")||v.id.endsWith(".tsx")||v.id.endsWith(".ctsx")||v.id.endsWith(".mtsx"))){const w=v.id.replace(e+"/","");l=l.replaceAll('from "'+b.source.value+'"','from "'+Sn(b.source.value,w)+'"')}}}const{errors:u,sourceText:m}=await t(p,l);if(u.length>0){if(n.ignoreErrors){this.warn(u[0]);return}return this.error(u[0])}if(a(p,m),!d)return;const h=d.body.filter(g=>g.type==="ImportDeclaration"?g.importKind==="type"?!0:g.specifiers?.every(b=>b.type==="ImportSpecifier"&&b.importKind==="type"):g.type==="ExportNamedDeclaration"||g.type==="ExportAllDeclaration"?g.exportKind==="type"?!0:g.type==="ExportNamedDeclaration"&&g.specifiers?.every(b=>b.type==="ExportSpecifier"&&b.exportKind==="type"):!1);for await(const g of h){if(!g.source)continue;const b=await this.resolve(g.source.value,p);if(!b)return;const v=b.id;if(i(v)&&!r[v.replace(Q,"")])try{const w=await St(v);await c.call(this,w,v)}catch{}}}return f(c,"h"),Me(c,"transform"),{name:"packem:isolated-declarations",async renderStart(l,{input:p}){const d=Nn(...Array.isArray(p)?p:Object.values(p));typeof l.entryFileNames=="function"&&(l.entryFileNames=l.entryFileNames({name:l.name}));const u=l.entryFileNames.replace(/\.(.)?[jt]sx?$/,(m,h)=>`.d.${h||""}ts`);for await(let[m,h]of Object.entries(r)){if(s&&l.format==="cjs"){const b=Wt(h);b!==null&&(h=b.code)}const g=h.includes("from '")?"'":'"';(o===!0||o==="compatible")&&l.format==="cjs"&&this.emitFile({fileName:u.replace("[name]",I(d,m)).replace(".cts",".ts"),source:h.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(b,v,w,$)=>v+g+($||w)+".d.ts"+g+";"),type:"asset"}),this.emitFile({fileName:u.replace("[name]",I(d,m)),source:h.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(b,v,w,$)=>v+g+($||w)+(l.format==="cjs"?".d.cts":".d.mts")+g+";"),type:"asset"})}},transform:c}},"isolatedDeclarationsPlugin");var _n=Object.defineProperty,Mn=f((e,t)=>_n(e,"name",{value:t,configurable:!0}),"n$8");const rt="export default ",Kt=Mn(e=>{const t=ps(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 In{static{f(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:f(()=>this.should_skip=!0,"skip"),remove:f(()=>this.should_remove=!0,"remove"),replace:f(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 Tn extends In{static{f(this,"SyncWalker")}constructor(t,o){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:f(()=>this.should_skip=!0,"skip"),remove:f(()=>this.should_remove=!0,"remove"),replace:f(s=>this.replacement=s,"replace")},this.enter=t,this.leave=o}visit(t,o,s,n){if(t){if(this.enter){const r=this.should_skip,a=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 l=this.should_skip,p=this.should_remove;if(this.should_skip=r,this.should_remove=a,this.replacement=c,l)return t;if(p)return null}let i;for(i in t){const r=t[i];if(r&&typeof r=="object")if(Array.isArray(r)){const a=r;for(let c=0;c<a.length;c+=1){const l=a[c];it(l)&&(this.visit(l,t,i,c)||c--)}}else it(r)&&this.visit(r,t,i,null)}if(this.leave){const r=this.replacement,a=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=r,this.should_remove=a,c)return null}}return t}}function it(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}f(it,"isNode");function zt(e,{enter:t,leave:o}){return new Tn(t,o).visit(e,null)}f(zt,"walk");var Fn=Object.defineProperty,An=f((e,t)=>Fn(e,"name",{value:t,configurable:!0}),"u$8");const Rn=An(({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 i=null;try{i=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 r=!1;const a=new Y(s);return zt(i,{enter(c){if(c.type==="CallExpression"&&c.callee.type==="Identifier"&&c.callee.name==="jsx"){const l=c.arguments.filter(p=>p.type==="ObjectExpression"&&Array.isArray(p.properties));for(const p of l)for(const d of p.properties)d.type==="Property"&&d.key.type==="Literal"&&d.value.type==="Literal"&&e.includes(d.key.value)&&(a.overwrite(d.start-2,d.end,""),r=!0)}}}),r?{code:a.toString(),map:a.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var Jn=Object.defineProperty,Vt=f((e,t)=>Jn(e,"name",{value:t,configurable:!0}),"d$b");const Bn=Vt(e=>{const t=[],o=[];return e.forEach(s=>{s.startsWith("(")?t.push(s):o.push(s)}),[...o.sort(),...t.sort()]},"sortLicenses"),Ht=Vt(({dtsMarker:e,licenseFilePath:t,licenseTemplate:o,logger:s,marker:n,mode:i,packageName:r})=>us({thirdParty(a){const c=new Set,l=a.sort(({name:d},{name:u})=>(d||0)>(u||0)?1:(u||0)>(d||0)?-1:0).map(({author:d,contributors:u,license:m,licenseText:h,maintainers:g,name:b,repository:v})=>{let w="## "+b+`
|
|
35
|
+
`;m&&(w+=`License: ${m}
|
|
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
|
+
`),v&&(w+=`Repository: ${typeof v=="string"?v:v.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
|
+
`),m&&c.add(m),w}).join(`
|
|
31
44
|
---------------------------------------
|
|
32
45
|
|
|
33
|
-
`);if(
|
|
46
|
+
`);if(l===""){s.info({message:"No dependencies license information found.",prefix:"plugin:license:"+i});return}const p=o(Bn(c),l,r);try{const d=We(t),u=ds(d,n,p);if(!u){s.error({message:`Could not find the license marker: <!-- ${n} --><!-- /${n} --> in ${t}`,prefix:"plugin:license:"+i});return}d!==u&&(ne(t,u),s.info({message:`${t} updated.`,prefix:"plugin:license:"+i}))}catch(d){s.error(d)}}}),"license");var Ln=Object.defineProperty,Wn=f((e,t)=>Ln(e,"name",{value:t,configurable:!0}),"i$7");const Un=Wn(e=>({async buildEnd(){const t=[];for(const s of this.getModuleIds()){const n=this.getModuleInfo(s);if(n!=null&&!n.isExternal)for(const i of n.importedIds)t.push({source:s,target:i})}if(Array.isArray(t)&&t.length===0)return;const o=k(e.rootDir,e.outDir,"graph.json");Ot(o,t)},name:"packem:metafile"}),"metafilePlugin");var Kn=Object.defineProperty,zn=f((e,t)=>Kn(e,"name",{value:t,configurable:!0}),"g$5");let at=!1;const Vn=zn((e,t,o,s,n,i)=>{if(i!=="*"&&Ho(Go(i))===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 r={};for(const l of t)for(const p of l.exportKey)p.includes("/*")?r[p]=["./"+j(o,K(l.name),"*.d.ts")]:r[p]=[...r[p]??[],"./"+j(o,l.name+".d.ts")];const a=j(s,"package.json"),c=Dt(a);n==="file"&&Object.keys(r).length>0?(Ot(a,{...c,typesVersions:{...c.typesVersions,[i]:r}},{detectIndent:!0}),e.info({message:'Your package.json "typesVersions" field has been updated.',prefix:"plugin:node10-compatibility"})):Object.keys(r).length>0&&e.info({message:`Please add the following field into your package.json to enable node 10 compatibility:
|
|
34
47
|
|
|
35
|
-
${JSON.stringify({typesVersions:{"*":
|
|
36
|
-
`,prefix:"plugin:node10-compatibility"})}}},"node10CompatibilityPlugin");var
|
|
37
|
-
`+e}return null},order:"post"}}),"prependDirectivePlugin");var
|
|
48
|
+
${JSON.stringify({typesVersions:{"*":r}},null,4)}
|
|
49
|
+
`,prefix:"plugin:node10-compatibility"})}}},"node10CompatibilityPlugin");var Hn=Object.defineProperty,Gt=f((e,t)=>Hn(e,"name",{value:t,configurable:!0}),"d$a");const le=Gt(e=>e.handler||e,"getHandler"),M=Gt((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),i=j("load",q(s));if(t.has(i,n))return await t.get(i,n);const r=await le(e.load).call(this,s);return t.set(i,r,n),r},name:`cached(${e.name})`,async resolveId(s,n,i){if(!e.resolveId)return null;const r=j(o,e.name),a=j("resolveId",q(s),n?q(n):"",q(JSON.stringify(i)));if(t.has(a,r))return await t.get(a,r);const c=await le(e.resolveId).call(this,s,n,i);return t.set(a,c,r),c},async transform(s,n){if(!e.transform)return null;const i=j(o,e.name),r=j("transform",q(n),q(s));if(t.has(r,i))return await t.get(r,i);const a=await le(e.transform).call(this,s,n);return t.set(r,a,i),a}}),"cachingPlugin");var Gn=Object.defineProperty,qn=f((e,t)=>Gn(e,"name",{value:t,configurable:!0}),"n$7");const Xn=qn(()=>({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 Yn=Object.defineProperty,Qn=f((e,t)=>Yn(e,"name",{value:t,configurable:!0}),"c$a");const Zn=Qn(({directiveRegex:e,exclude:t=[],include:o=[],logger:s})=>{const n={},i={},r=Z(o,t);return{name:"packem:preserve-directives",onLog(a,c){return c.code==="MODULE_LEVEL_DIRECTIVE"&&a==="warn"?!1:null},renderChunk:{handler(a,c,{sourcemap:l}){const p=c.moduleIds.map(m=>n[m]?n[m]:null).reduce((m,h)=>(h&&h.forEach(g=>{m.add(g)}),m),new Set),d=new Y(a);p.size>0&&(s.debug({message:`directives for chunk "${c.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),d.prepend(`${[...p].map(m=>`'${m}';`).join(`
|
|
38
51
|
`)}
|
|
39
|
-
`));let
|
|
40
|
-
`)),p.size===0&&
|
|
41
|
-
`);if(
|
|
42
|
-
`),{code:
|
|
43
|
-
`)=>{const o
|
|
52
|
+
`));let u;return c.facadeModuleId&&typeof i[c.facadeModuleId]=="string"&&(u=i[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:l?d.generateMap({hires:!0}):null}},order:"post"},transform(a,c){if(!r(c))return null;let l=!1;const p=new Y(a);if(a.startsWith("#")&&a[1]==="!"){let u=0;for(let m=2,h=a.length;m<h;m++){const g=a.codePointAt(m);if(g===10||g===13||g===8232||g===8233){u=m;break}}u&&(i[c]=a.slice(0,u),p.remove(0,u+1),l=!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 m=null;"directive"in u?m=u.directive:u.expression.type==="Literal"&&typeof u.expression.value=="string"&&e.test(u.expression.value)&&(m=u.expression.value),m!=="use strict"&&m&&(n[c]||=new Set,n[c].add(m),"start"in u&&typeof u.start=="number"&&"end"in u&&typeof u.end=="number"&&(p.remove(u.start,u.end),l=!0),s.debug({message:`directive "${m}" for module "${c}" is preserved.`,prefix:"plugin:preserve-directives"}))}return l?{code:p.toString(),map:p.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...n[c]??[]],shebang:i[c]??null}}}:null}}},"preserveDirectives");var er=Object.defineProperty,tr=f((e,t)=>er(e,"name",{value:t,configurable:!0}),"n$6");const or=tr(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 sr=Object.defineProperty,nr=f((e,t)=>sr(e,"name",{value:t,configurable:!0}),"r$8");const qt=nr(()=>({name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return ms(e)}}),"resolveFileUrl");var rr=Object.defineProperty,Se=f((e,t)=>rr(e,"name",{value:t,configurable:!0}),"i$5");const $e=/^#![^\n]*/,Je=Se(async e=>{await $o(e,493).catch(()=>{})},"makeExecutable"),ir=Se((e,t)=>({name:"packem:shebang",renderChunk:{handler(o,s,n){if(!s.isEntry||!s.facadeModuleId)return null;const i=o.startsWith("#")&&o[1]==="!";if(i&&t.replace)return o.replace($e,t.shebang+`
|
|
54
|
+
`);if(i)return null;if(e.includes(s.name)){const r=new Y(o);return r.prepend(t.shebang+`
|
|
55
|
+
`),{code:r.toString(),map:n.sourcemap?r.generateMap({hires:!0}):void 0}}return null},order:"post"},async writeBundle(o,s){for(const[n,i]of Object.entries(s))if(i.type==="chunk"&&$e.test(i.code)&&o.dir){const r=k(o.dir,n);await Je(r)}}}),"shebangPlugin"),ar=Se(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace($e,"")}}),"removeShebangPlugin"),lr=Se((e,t=`
|
|
56
|
+
`)=>{const o=$e.exec(e);return o?o+t:""},"getShebang");var cr=Object.defineProperty,ee=f((e,t)=>cr(e,"name",{value:t,configurable:!0}),"r$7");const pr=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,ur=/MIT License|MIT license|BSD license/,dr=/\n{2,}/g,fr=/\b(\w+)\$\d+\b/g,mr=/[-/\\^$*+?.()|[\]{}]/g,gr=ee(e=>e.replaceAll(mr,"\\$&"),"escapeRegex"),hr=ee(e=>[...new Set(e)],"unique"),yr=ee(e=>e.replaceAll(pr,t=>ur.test(t)?"":t).replaceAll(dr,`
|
|
44
57
|
|
|
45
|
-
`),"cleanUnnecessaryComments"),
|
|
46
|
-
- ${
|
|
58
|
+
`),"cleanUnnecessaryComments"),lt=new Map;function Xt(e,t,{identifierReplacements:o},s){const n=Rt(e);for(const r in o){const a=n.find(l=>l.specifier===r&&l.imports.includes("{"));if(!a){this.warn(`${t.fileName} does not import "${r}" for replacement`),process.exitCode=1;continue}const c=o[r];for(const l in c){if(!a.imports.includes(l))throw new Error(`${t.fileName} does not import "${l}" from "${r}" for replacement`);const p=c[l],d=gr(l);p.includes(".")&&(e=e.replace(new RegExp(`\\b\\w+\\b as ${d},?\\s?`),"")),e=e.replaceAll(new RegExp(`\\b${d}\\b`,"g"),p)}}const i=hr(Array.from(e.matchAll(fr),r=>r[0]));if(i.length>0){const r=i.map(c=>`
|
|
59
|
+
- ${c}`).join(""),a=t.fileName.replace(/\.[^/.]+$/,"");lt.has(a)||s.warn({message:`${t.fileName} contains confusing identifier names${r}
|
|
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(a,!0)}return e}f(Xt,"I");ee(Xt,"replaceConfusingTypeNames");const vr=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 Yt(e,t){if(e.includes("@internal")){const o=new Y(e),s=gs(e,{plugins:["typescript"],sourceType:"module"});if(zt(s,{enter(n){vr(o,n)&&this.skip()}}),e=o.toString(),e.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`)}return e}f(Yt,"S");ee(Yt,"stripInternalTypes");const br=ee((e,t)=>({name:"packem:patch-types",renderChunk(o,s){return o=Xt.call(this,o,s,e,t),o=Yt.call(this,o,s),o=yr(o),o},resolveId(o){return o.startsWith("types/")?{external:!0,id:"../../"+(o.endsWith(".js")?o:o+".js")}:null}}),"patchTypescriptTypes");var wr=Object.defineProperty,Qt=f((e,t)=>wr(e,"name",{value:t,configurable:!0}),"m$7");const Zt=Qt((e,t=!0)=>{if(!e)return null;const{config:o,path:s}=e;if(!o.compilerOptions)return null;const{baseUrl:n,paths:i}=o.compilerOptions;if(!n)return null;const r=k(K(s),n),a=[];if(i)for(const[c,l]of Object.entries(i)){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 l){const m=[...U(k(r,u))].map(h=>h==="*"?"$"+(++d+""):h==="$"?"$$":h).join("");a.push({find:p,replacement:m})}}return t&&a.push({find:/^(?!\.*\/|\.*$|\w:)(.+)$/,replacement:`${[...U(r)].map(c=>c==="$"?"$$":c).join("")}/$1`}),a},"getConfigAlias"),eo=Qt((e,t)=>{const o=Zt(e);return{name:"packem:resolve-tsconfig-paths",async resolveId(s,n,i){if(!o||s.includes("\0"))return null;for(const{find:r,replacement:a}of o)if(r.test(s)){const c=s.replace(r,a),l=await this.resolve(c,n,{skipSelf:!0,...i});if(l)return t.debug({message:`Resolved ${s} to ${l.id} using paths from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-paths"}),l.id}return null}}},"resolveTsconfigPaths");var $r=Object.defineProperty,to=f((e,t)=>$r(e,"name",{value:t,configurable:!0}),"u$5");const jr=to((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 i=[];for(const r of n){if(r.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${s}.`);if(r.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${s}.`);i.push(k(e,r))}return i},"getRootDirectories"),oo=to((e,t,o)=>{const s=jr(e,o);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(n,i,r){if(s===null||s.length===0)return null;if(n.startsWith("."))for(const a of s){const c=j(a,n),l=await this.resolve(c,i,{skipSelf:!0,...r});if(l)return t.debug({message:`Resolved ${n} to ${l.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),l.id}return null}}},"resolveTsconfigRootDirectories");var xr=Object.defineProperty,kr=f((e,t)=>xr(e,"name",{value:t,configurable:!0}),"r$6");const so=kr(()=>{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 Er=Object.defineProperty,no=f((e,t)=>Er(e,"name",{value:t,configurable:!0}),"u$4");const ct=no((e,t,o,s)=>{const n=e.findIndex(r=>typeof r=="object"?r.name===o:!1);if(n===-1)throw new Error(`Plugin with name "${o}" was not found, try one of: ${e.map(r=>{if(typeof r=="object")return r.name}).filter(Boolean).join(", ")}`);const i=s?n+1:n;return e.splice(i,0,t),e},"appendPlugin"),ro=no((e,t)=>{if(!t)return e;for(const{after:o=void 0,before:s=void 0,plugin:n}of t)e=o?ct(e,n,o,!0):ct(e,n,s,!1);return e},"appendPlugins");var Sr=Object.defineProperty,Or=f((e,t)=>Sr(e,"name",{value:t,configurable:!0}),"s$7");const Dr=Or(e=>{const t=re(e).split(".");if(t.length>=2){const[o,s]=t.slice(-2),n=t[0],i=/^(\w+)-runtime$/.exec(o)?.[1];if(Ke.includes(s)&&i&&i.length>0)return n+"-"+i}},"getCustomModuleLayer");var Nr=Object.defineProperty,Pr=f((e,t)=>Nr(e,"name",{value:t,configurable:!0}),"i$4");const Ie=Pr(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var Cr=Object.defineProperty,pt=f((e,t)=>Cr(e,"name",{value:t,configurable:!0}),"d$8");const _r=pt((e,t)=>{const o=new Map;return pt(function(s,n){const i=n.getModuleInfo(s);if(!i)return;const{isEntry:r}=i,a=i.meta,c=Ie(a);if(!r){const l=o.get(s);if(l)return l;const p=Dr(s);if(p)return o.set(s,p),p}if(r){const l=n.getModuleIds();for(const p of l)n.getModuleInfo(p)&&Ie(a)===c&&(e.has(p)||e.set(p,new Set),e.get(p).add([s,c]))}if(c&&!r&&e.has(s)){const l=[...e.get(s)];if(l.some(([d])=>{if(t.some(u=>u.path===d)){const u=n.getModuleInfo(d);return Ie(u?u.meta:{})===c}return!1}))return;if(l.every(([,d])=>d===c))return o.has(s)?o.get(s):void 0;const p=re(s,Nt(s))+"-"+c;return o.set(s,p),p}},"splitChunks")},"createSplitChunks");var Mr=Object.defineProperty,Ir=f((e,t)=>Mr(e,"name",{value:t,configurable:!0}),"n$4");const X=Ir((e,t)=>e.isDynamicEntry?`${qo}/[name].${t}`:`${Xo}/${e.name}-[hash].${t}`,"getChunkFilename");var Tr=Object.defineProperty,Fr=f((e,t)=>Tr(e,"name",{value:t,configurable:!0}),"o$4");const Ar=process.platform==="win32",ut=Fr((e,t)=>{const o=Ar?"\\":"/";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 Rr=Object.defineProperty,Jr=f((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"p$1");const Ve=Jr((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 i=s[n];typeof i=="string"&&(o[n]=j(e.options.rootDir,i))}}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 Br=Object.defineProperty,F=f((e,t)=>Br(e,"name",{value:t,configurable:!0}),"l$5");const Lr=F((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"+ko.node.split(".")[0];if(t.pkg.engines?.node){const s=Ft(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"),io=F((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(I(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
|
|
54
|
-
exports: `+
|
|
55
|
-
${
|
|
56
|
-
`)}`),
|
|
57
|
-
`);l
|
|
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"),dt=new Map,Te=new Map,ao=F((e,t,o)=>{const s=Zt(e.tsconfig,!1);return{external(n){n=Ko(n,t);const i=Jt(n);if(Re(e.options.externals,i)||Re(e.options.externals,n))return!0;const{pkg:r}=e;if(n.startsWith(".")||Ue(n)||/src[/\\]/.test(n)||r.name&&n.startsWith(r.name))return!1;if(r.imports)for(const[a,c]of Object.entries(r.imports)){if(a===n)return!1;if(a.includes("*")){let l;Te.has(a)?l=Te.get(a):(l=xt(j(e.options.rootDir,c.replace("/*","")),{withFileTypes:!0}).filter(p=>p.isFile()).map(p=>p.name),Te.set(a,l));for(const p of l)if(p.replace(Q,"")===n.replace(Q,"").replace("#",""))return!1}}if(s){for(const{find:a}of s)if(a.test(n))return e.logger.debug({message:`Resolved alias ${n} to ${a.source}`,prefix:o}),!1}return dt.has(n)||e.logger.info({message:'Inlined implicit external "'+D(n)+'". If this is incorrect, add it to the "externals" option.',prefix:o}),dt.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:F((n,i)=>{let r=i.message;switch(i.stack&&(r=`${r}
|
|
65
|
+
${i.stack}`),n){case"info":{e.logger.info({message:r,prefix:o+(i.plugin?":plugin:"+i.plugin:"")});return}case"warn":{e.logger.warn({message:r,prefix:o+(i.plugin?":plugin:"+i.plugin:"")});return}case"debug":e.logger.debug({message:r,prefix:o+(i.plugin?":plugin:"+i.plugin:"")})}},"onLog"),onwarn(n,i){io(n,e)||n.code||i(n)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),lo=F(async(e,t)=>{const o=Ve(e,"build");let s;e.options.rollup.resolve&&(s=M(Mt({...e.options.rollup.resolve}),t));const n=e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:_r(e.dependencyGraphMap,e.buildEntries),preserveModules:!1};return{...ao(e,o,"dependencies"),output:[e.options.emitCJS&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:F(i=>X(i,"cjs"),"chunkFileNames"),compact:e.options.minify,dir:k(e.options.rootDir,e.options.outDir),entryFileNames:F(i=>ut(i,"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:F(i=>X(i,"mjs"),"chunkFileNames"),compact:e.options.minify,dir:k(e.options.rootDir,e.options.outDir),entryFileNames:F(i=>ut(i,"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:ro([M(qt(),t),M(so(),t),e.tsconfig&&M(oo(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&M(eo(e.tsconfig,e.logger),t),e.options.rollup.replace&&It({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&_t({customResolver:s,...e.options.rollup.alias,entries:o}),s,e.options.rollup.polyfillNode&&zo({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&Kt({...e.options.rollup.json}),Ls(),e.options.rollup.wasm&&Uo(e.options.rollup.wasm),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer&&Cn(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 pn({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&&mn(e.options.rollup.css,e.options.rootDir,e.logger),e.options.rollup.raw&&M(or(e.options.rollup.raw),t),e.options.transformer(Lr(e.options.transformerName,e)),M(Zn({directiveRegex:/^['|"](use (\w+))['|"]$/,...e.options.rollup.preserveDirectives,logger:e.logger}),t),e.options.rollup.shebang&&ir(e.options.entries.filter(i=>i.executable).map(i=>i.name).filter(Boolean),e.options.rollup.shebang),e.options.cjsInterop&&e.options.emitCJS&&Ut({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&xn(),e.options.rollup.dynamicVars&&Wo(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&M(Lo({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&&wn(e.pkg,e.options.rollup.shim),e.options.rollup.jsxRemoveAttributes&&M(Rn({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),t),e.options.rollup.metafile&&Un({outDir:k(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&Xs(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&Ht({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}),Xn(),e.options.emitCJS&&e.mode==="build"&&e.options.declaration==="compatible"&&e.options.rollup.node10Compatibility&&Vn(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&&Vo({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"),Wr=F(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"),Ur=Ds(Wr),co=F(async(e,t)=>{const o=Ve(e,"types"),s=e.tsconfig?.config.compilerOptions;delete s?.lib;let n;e.options.rollup.resolve&&(n=M(Mt({...e.options.rollup.resolve}),t));const i="dts-plugin:"+process.pid+e.tsconfig.path;return{...ao(e,o,"dts"),onwarn(r,a){io(r,e)||r.code!=="EMPTY_BUNDLE"&&a(r)},output:[e.options.emitCJS&&{chunkFileNames:F(r=>X(r,"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:F(r=>X(r,"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:F(r=>X(r,"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:ro([M(qt(),t),M(so(),t),e.options.rollup.json&&Kt({...e.options.rollup.json}),{load(r){return/\.(?:js|cjs|mjs|jsx|ts|tsx|ctsx|mtsx|mts|json)$/.test(r)?null:""},name:"packem:ignore-files"},e.tsconfig&&M(oo(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&M(eo(e.tsconfig,e.logger),t),e.options.rollup.replace&&It({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&_t({customResolver:n,...e.options.rollup.alias,entries:o}),n,await Ur(i)(e),e.options.cjsInterop&&e.options.emitCJS&&Ut({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&M(br(e.options.rollup.patchTypes,e.logger),t),ar(),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&Ht({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 Kr=Object.defineProperty,zr=f((e,t)=>Kr(e,"name",{value:t,configurable:!0}),"m$5");const ft="rollup-build.json",Vr=zr(async(e,t,o)=>{const s=await lo(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(ft,o));const i=await Ct(s);n&&t.set(ft,i.cache,o),await e.hooks.callHook("rollup:build",e,i);const r=new Map;for(const a of s.output){const{output:c}=await i.write(a),l=new Set,p=c.filter(u=>u.type==="chunk");for(const u of p){l.add(u.fileName);for(const m of u.imports)e.usedImports.add(m);u.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(u.code,"utf8"),chunks:u.imports.filter(m=>p.find(h=>h.fileName===m)),exports:u.exports,modules:Object.entries(u.modules).map(([m,h])=>({bytes:h.renderedLength,id:m})),path:u.fileName,type:"entry"})}const d=c.filter(u=>u.type==="asset");for(const u of d)r.has(u.fileName)||r.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(...r.values())},"build");var Hr=Object.defineProperty,ge=f((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"a$7");const mt="rollup-dts.json",Gr=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 co(e,t);if(await e.hooks.callHook("rollup:dts:options",e,s),Object.keys(s.input).length===0)return;s.cache=t.get(mt,o);const n=await Ct(s);t.set(mt,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(i=>X(i,"d.cts"),"chunkFileNames"),dir:k(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await n.write({chunkFileNames:ge(i=>X(i,"d.mts"),"chunkFileNames"),dir:k(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),e.options.declaration==="compatible"&&await n.write({chunkFileNames:ge(i=>X(i,"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 qr=Object.defineProperty,Xr=f((e,t)=>qr(e,"name",{value:t,configurable:!0}),"y$3");const Yr=Xr((e,t,o)=>e.reduce((s,n)=>{const i=n[t],r=n[o];return s[i]||(s[i]={}),s[i][r]||(s[i][r]=[]),s[i][r].push(n),s},{}),"groupByKeys");var Qr=Object.defineProperty,je=f((e,t)=>Qr(e,"name",{value:t,configurable:!0}),"j$1");const Zr=je((e,t)=>{const o=je(r=>I(t.options.rootDir,k(t.options.outDir,r)),"rPath");let s=!1;const n=[],i=t.buildEntries.filter(r=>r.type==="entry");if(i.length>0){e.raw(`Entries:
|
|
66
|
+
`);for(const r of i){let a=r.bytes??0;for(const l of r.chunks??[])a+=t.buildEntries.find(p=>p.path===l)?.bytes??0;let c=` ${W(o(r.path))} (${["total size: "+D(H(a)),r.bytes&&"chunk size: "+D(H(r.bytes))].filter(Boolean).join(", ")})`;if(c+=r.exports?.length?`
|
|
67
|
+
exports: `+G(r.exports.join(", ")):"",r.chunks?.length&&(c+=`
|
|
68
|
+
${r.chunks.map(l=>{const p=t.buildEntries.find(d=>d.path===l)??{};return G(" └─ "+o(l)+W(p.bytes?" ("+H(p?.bytes)+")":""))}).join(`
|
|
69
|
+
`)}`),r.modules&&r.modules.length>0){const l=r.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+=l.length>0?`
|
|
58
71
|
inlined modules:
|
|
59
|
-
`+
|
|
72
|
+
`+l:""}if(t.options.declaration){let l=r.path.replace(/\.js$/,".d.ts"),p="commonjs";r.path.endsWith(".cjs")?l=r.path.replace(/\.cjs$/,".d.cts"):r.path.endsWith(".mjs")&&(p="module",l=r.path.replace(/\.mjs$/,".d.mts"));const d=t.buildEntries.find(u=>u.path.endsWith(l));if(d){n.push(d.path);let u;l.includes(".d.ts")||(l=l.replace(".d.c",".d."),u=t.buildEntries.find(m=>m.path.endsWith(l))),u&&(n.push(u.path),c+=p==="commonjs"?`
|
|
60
73
|
types:
|
|
61
|
-
`+[u
|
|
74
|
+
`+[d,u].map(m=>G(" └─ ")+W(o(m.path))+" (total size: "+D(H(m.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(
|
|
66
|
-
└─ `)+
|
|
78
|
+
`,e.raw(r.chunk?G(c):c)}}if(t.buildEntries.filter(r=>r.type==="asset").length>0){let r="Assets:";for(const a of t.buildEntries.filter(c=>c.type==="asset"))n.includes(a.path)||(r+=G(`
|
|
79
|
+
└─ `)+W(o(a.path))+" (total size: "+D(H(a.bytes??0))+")");r+=`
|
|
67
80
|
|
|
68
|
-
`,e.raw(
|
|
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(r)}return s&&e.raw("Σ Total dist size (byte size):",D(H(t.buildEntries.reduce((r,a)=>r+(a.bytes??0),0),{decimals:2})),`
|
|
82
|
+
`),s},"showSizeInformation"),ei=je((e,t)=>{const o=Yr(e.options.entries,"environment","runtime"),s=new Set,n=new Set;for(const[i,r]of Object.entries(o))for(const[a,c]of Object.entries(r)){const l={...e};!e.options.dtsOnly&&(i!=="undefined"||a!=="undefined")&&e.logger.info("Preparing build for "+(i==="undefined"?"":D(i)+" environment"+(a==="undefined"?"":" with "))+(a==="undefined"?"":D(a)+" runtime"));const p={};l.options.rollup.replace?(l.options.rollup.replace.values===void 0&&(l.options.rollup.replace.values={}),i!=="undefined"&&(p[["process","env","NODE_ENV"].join(".")]=JSON.stringify(i)),p[["process","env","EdgeRuntime"].join(".")]=JSON.stringify(a==="edge-light"),Object.freeze(p)):e.logger.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");let d="";i!=="undefined"&&(d+=i+"/"),a!=="undefined"&&(d+=a+"/");let u=!1;l.options.minify!==void 0&&(u=l.options.minify),i==="development"?u=!1:i==="production"&&(u=!0);const m=[],h=[],g=[],b=[];for(const v of c)v.cjs&&v.esm?m.push(v):v.cjs?g.push(v):v.esm?h.push(v):v.declaration&&b.push(v);if(m.length>0){const v={...l,options:{...l.options,emitCJS:!0,emitESM:!0,entries:m,minify:u,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||s.add({context:v,fileCache:t,subDirectory:d}),e.options.declaration){const w=v.options.entries.filter($=>$.declaration);w.length>0&&n.add({context:{...v,options:{...v.options,entries:w}},fileCache:t,subDirectory:d})}}if(h.length>0){const v={...l,options:{...l.options,emitCJS:!1,emitESM:!0,entries:h,minify:u,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||s.add({context:v,fileCache:t,subDirectory:d}),e.options.declaration){const w=v.options.entries.filter($=>$.declaration);w.length>0&&n.add({context:{...v,options:{...v.options,entries:w}},fileCache:t,subDirectory:d})}}if(g.length>0){const v={...l,options:{...l.options,emitCJS:!0,emitESM:!1,entries:g,minify:u,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||s.add({context:v,fileCache:t,subDirectory:d}),e.options.declaration){const w=v.options.entries.filter($=>$.declaration);w.length>0&&n.add({context:{...v,options:{...v.options,entries:w}},fileCache:t,subDirectory:d})}}l.options.declaration&&b.length>0&&n.add({context:{...l,options:{...l.options,emitCJS:!1,emitESM:!1,entries:b,minify:u,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...p}}:!1}}},fileCache:t,subDirectory:d})}return{builders:s,typeBuilders:n}},"prepareRollupConfig"),ti=je(async(e,t)=>{await e.hooks.callHook("build:before",e);const{builders:o,typeBuilders:s}=ei(e,t);await Promise.all([...o].map(async({context:n,fileCache:i,subDirectory:r})=>await Vr(n,i,r))),await Promise.all([...s].map(async({context:n,fileCache:i,subDirectory:r})=>await Gr(n,i,r))),e.logger.success(Eo(e.options.name?"Build succeeded for "+e.options.name:"Build succeeded"));for await(const n of Po(j(e.options.rootDir,e.options.outDir))){let i=e.buildEntries.find(r=>j(e.options.rootDir,e.options.outDir,r.path)===n.path);if(i||(i={chunk:!0,path:n.path},e.buildEntries.push(i)),!i.bytes){const r=await Et(k(e.options.rootDir,e.options.outDir,n.path));i.bytes=r.size}}return await e.hooks.callHook("build:done",e),Zr(e.logger,e)},"build");var oi=Object.defineProperty,si=f((e,t)=>oi(e,"name",{value:t,configurable:!0}),"r$4");const S=si((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var ni=Object.defineProperty,po=f((e,t)=>ni(e,"name",{value:t,configurable:!0}),"t$4");const xe=po(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),Be=po((e,t,o,s)=>{if(e==="module-sync")return"esm";if(s){const r=xe(s);if(r)return r}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return o;const[n,...i]=t;return Be(n,i,o,s)},"inferExportType");var ri=Object.defineProperty,ii=f((e,t)=>ri(e,"name",{value:t,configurable:!0}),"y$2");const ai=new Set(["electron","import","require","node","node-addons","default","types","deno","browser","module-sync","bun","workerd",...At,...be]),He=ii((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(([r])=>!r.endsWith(".json"));let i=[];for(const[r,a]of n)if(typeof a=="string"){let c={};Number.isInteger(+r)?c={exportKey:"*"}:r.startsWith("./")?c={exportKey:r.replace("./","")}:c={exportKey:r==="."?".":"*",subKey:r},i.push({...c,file:a,key:"exports",type:Be(r,s,t,a)})}else if(typeof a=="object"&&a!==null)for(const[c,l]of Object.entries(a)){if(o===!1&&c==="types")continue;const p=Number.isInteger(+r)?c:r;typeof l=="string"?i.push({exportKey:p.replace("./",""),file:l,key:"exports",...ai.has(c)?{subKey:c}:{},type:Be(c,s,t,l)}):i=[...i,...He({[p]:l},t,o,[...s,c])]}return i}return[]},"extractExportFilenames");var li=Object.defineProperty,Oe=f((e,t)=>li(e,"name",{value:t,configurable:!0}),"c$4");const ci=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,i,r)=>{const a=ci(n,i.environment);let c="node";for(const d of At)if(n.file.includes("."+d+".")||n.subKey===d){c=d;break}let l=e.find(d=>d.input===t&&d.environment===a&&d.runtime===c);l===void 0?l=e[e.push({environment:a,exportKey:new Set([n.exportKey].filter(Boolean)),input:t,runtime:c})-1]:l.exportKey&&n.exportKey&&l.exportKey.add(n.exportKey),r&&(l.isGlob=!0),o&&(l.outDir=s),n.isExecutable?(l.executable=!0,l.declaration=!1,n.type==="cjs"?l.cjs=!0:n.type==="esm"&&(l.esm=!0)):(/\.d\.[mc]?ts$/.test(n.file)&&i.options.declaration!==!1&&(l.declaration=i.options.declaration),n.type==="cjs"?l.cjs=!0:n.type==="esm"&&(l.esm=!0));const p=n.file.replace(Nt(n.file),"").replace(new RegExp(`^./${i.options.outDir.replace(/^\.\//,"")}/`),"");be.has(n.subKey)&&!t.includes(p)&&(l.fileAlias=p)},"createOrUpdateEntry");let gt=!1;const ht=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"),pi=Oe((e,t,o)=>{const s=[];t.sort((a,c)=>a.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 i=He(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 c of a){const l=xe(c);if(l&&l!==n)throw new Error(`Exported file "${c}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);i.push({file:c,isExecutable:!0,key:"bin",type:l??n})}}e.main&&i.push({file:e.main,key:"main",type:xe(e.main)??n}),e.module&&i.push({file:e.module,key:"module",type:"esm"}),(e.types||e.typings)&&(ht(o),o.options.declaration===void 0&&(o.options.declaration="compatible"),i.push({file:e.types??e.typings,key:"types"}));const r=[];for(const a of i){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 c=a.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),l=c.endsWith("/");if(l&&["./","/"].includes(c))continue;const p=c.replace(new RegExp("(./)?"+o.options.outDir),o.options.sourceDir).replace("./",""),d="(?<=/|$)",u=l?"":"\\.\\w+$";if(a.file.includes("/*")&&a.key==="exports"){gt||(o.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),gt=!0);const b=[],v=new RegExp(d+p.replace("*","(.*)")+u),w=new RegExp(d+p.replace(/(.*)\.[^.]*$/,"$1").replace("*","(.*)")+u);for(const $ of t)(v.test($)||be.has(a.subKey)&&w.test($))&&b.push($);if(b.length===0){s.push(`Could not find entrypoint for \`${a.file}\``);continue}for(const $ of b)he(r,$,l,c,a,o,!0);continue}const m=new RegExp(d+p+u);let h=t.find(b=>m.test(b));if(be.has(a.subKey)&&h===void 0){const b=new RegExp(d+p.replace(/(.*)\.[^.]*$/,"$1")+u);h=t.find(v=>b.test(v))}if(h===void 0){z(k(o.options.rootDir,a.file))||s.push(`Could not find entrypoint for \`${a.file}\``);continue}(h.endsWith(".ts")||h.endsWith(".cts")||h.endsWith(".mts"))&&z(h)&&ht(o);const g=ve(h.replace(Q,""));z(g+".cts")&&z(g+".mts")?(he(r,g+".cts",l,c,{...a,type:"cjs"},o,!1),he(r,g+".mts",l,c,{...a,type:"esm"},o,!1)):he(r,h,l,c,a,o,!1)}return{entries:r,warnings:s}},"inferEntries");var ui=Object.defineProperty,di=f((e,t)=>ui(e,"name",{value:t,configurable:!0}),"o$3");const fi=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 mi=Object.defineProperty,gi=f((e,t)=>mi(e,"name",{value:t,configurable:!0}),"t$3");const hi={hooks:{"build:prepare":gi(function(e){if(e.options.entries.length>0)return;const t=j(e.options.rootDir,e.options.sourceDir);if(!kt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const o=Co(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=fi(s,e.options.declaration));const n=pi(s,o,e);for(const i of n.warnings)S(e,i);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(i=>i.fileAlias?W(i.fileAlias)+" => "+W(i.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*")):W(i.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),G([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(i=>`[${i}]`).join(" ")))},"build:prepare")}};var yi=Object.defineProperty,vi=f((e,t)=>yi(e,"name",{value:t,configurable:!0}),"t$2");const bi=vi(async(e,t)=>{if(e==="auto")e=hi;else{if(e==="none")return{};typeof e=="string"&&(e=await t.import(e)||{})}return typeof e=="function"&&(e=e()),e},"resolvePreset");var wi=Object.defineProperty,$i=f((e,t)=>wi(e,"name",{value:t,configurable:!0}),"j");const ji=$i(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,i)=>{if(Array.isArray(n)){const[r,...a]=n;return o.push(r),"["+["plugin"+i,...a.map(c=>JSON.stringify(c))].join(", ")+"]"}return o.push(n),"plugin"+i}).join(",")+"]":"[]");for(const n of e.options.entries){const i=k(e.options.rootDir,e.options.outDir,n.name),r=as(e.jiti.esmResolve(n.input,{try:!0})??n.input),a=r.replace(Q,""),c=We(r),l=lr(c);let p=[];try{p=await ls(r,{extensions:Ke})}catch(u){S(e,`Cannot analyze ${r} for exports: ${u.toString()}`);return}const d=p.includes("default")||p.length===0;if(e.options.emitESM){const u=I(K(i),await ot("jiti",{conditions:["node","import"],url:import.meta.url})),m=a+".d.mts";ne(`${i}.mjs`,l+['import { createJiti } from "'+u+'";',...o.map((h,g)=>"import plugin"+g+' from "'+h+'";'),"","const jiti = createJiti(import.meta.url, "+s+");","",'/** @type {import("'+m+'")} */','const _module = await jiti.import("'+r+'");',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(`${i}.d.mts`,'export * from "'+m+`";
|
|
85
|
+
`+(d?'export { default } from "'+m+'";':""))}if(e.options.emitCJS){const u=I(K(i),await ot("jiti",{conditions:["node","require"],url:import.meta.url})),m=a+".d.cts";ne(`${i}.cjs`,l+['const { createJiti } = require("'+u+'");',...o.map((h,g)=>"const plugin"+g+" = require("+JSON.stringify(h)+")"),"","const jiti = createJiti(__filename, "+s+");","",'/** @type {import("'+m+'")} */','module.exports = jiti("'+r+'")'].join(`
|
|
86
|
+
`)),e.options.declaration&&ne(i+".d.cts",'export * from "'+m+`";
|
|
87
|
+
`+(d?'export { default } from "'+m+'";':""))}l&&(await Je(`${i}.cjs`),await Je(`${i}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var xi=Object.defineProperty,Ge=f((e,t)=>xi(e,"name",{value:t,configurable:!0}),"i$2");const ki=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"),Ei=Ge(e=>`
|
|
76
89
|
${e.replaceAll(/^\n|\n$/g,"")}
|
|
77
|
-
`,"normalizeCodeFrame"),
|
|
78
|
-
file: ${
|
|
79
|
-
`+
|
|
80
|
-
${t}`)},"enhanceRollupError");var
|
|
90
|
+
`,"normalizeCodeFrame"),uo=Ge(e=>{const t=ki(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
|
+
`+So(Ei(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
|
|
93
|
+
${t}`)},"enhanceRollupError");var Si=Object.defineProperty,fo=f((e,t)=>Si(e,"name",{value:t,configurable:!0}),"d$3");const ke="rollup-watch.json",yt=fo(({context:e,doOnSuccessCleanup:t,fileCache:o,mode:s,runBuilder:n,runOnsuccess:i,watcher:r,useCache:a})=>{const c="watcher:"+s;r.on("change",async(l,{event:p})=>{await t?.(),e.logger.info({message:`${D(I(".",l))} was ${p}d`,prefix:c})}),r.on("restart",()=>{e.logger.info({message:"Rebuilding ...",prefix:c})}),r.on("event",async l=>{switch(l.code){case"END":{e.logger.success({message:"Rebuild finished",prefix:c}),await i?.();break}case"BUNDLE_START":{e.logger.info({message:D("build started..."),prefix:c});break}case"BUNDLE_END":{await l.result.close(),a&&o.set(s==="bundle"?ke:"dts-"+ke,l.result.cache),e.logger.raw(`
|
|
81
94
|
⚡️ Build run in `+l.duration+`ms
|
|
82
95
|
|
|
83
|
-
`),await n?.(!0);break}case"ERROR":{
|
|
84
|
-
└─ ${
|
|
96
|
+
`),await n?.(!0);break}case"ERROR":{uo(l.error),e.logger.error({context:[l.error],message:"Rebuild failed: "+l.error.message,prefix:c});break}}})},"watchHandler"),Oi=fo(async(e,t,o,s,n)=>{const i=await lo(e,t);if(await e.hooks.callHook("rollup:options",e,i),Object.keys(i.input).length===0)return;let r=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(r=!1),r&&(i.cache=t.get(ke)),e.options.rollup.watch&&typeof i.watch=="object"&&i.watch.include===void 0&&(i.watch={...i.watch,...e.options.rollup.watch},i.watch.include=[j(e.options.sourceDir,"**","*"),"package.json","packem.config.*"],Array.isArray(e.options.rollup.watch.include)?i.watch.include=[...i.watch.include,...e.options.rollup.watch.include]:e.options.rollup.watch.include&&i.watch.include.push(e.options.rollup.watch.include),i.watch.chokidar={cwd:e.options.rootDir,...i.watch.chokidar,ignored:["**/.git/**","**/node_modules/**","**/test-results/**",...i.watch.chokidar?.ignored??[]]});const a=Ye(i);await e.hooks.callHook("rollup:watch",e,a);const c=[...Array.isArray(i.input)?i.input:typeof i.input=="string"?[i.input]:Object.keys(i.input??{})];let l="Starting watcher for entries:";for(const p of c)l+=G(`
|
|
97
|
+
└─ ${I(process.cwd(),p)}`);if(e.logger.info(l),yt({context:e,doOnSuccessCleanup:n,fileCache:t,mode:"bundle",runBuilder:o,runOnsuccess:s,watcher:a,useCache:r}),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 co(e,t);r&&(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),yt({context:e,fileCache:t,mode:"types",watcher:d,useCache:r})}},"watch");var Di=Object.defineProperty,mo=f((e,t)=>Di(e,"name",{value:t,configurable:!0}),"s$4");const Ni=mo(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let Pi=class{static{f(this,"g")}static{mo(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(Ni(n)){const i=JSON.parse(n);return this.#o.set(s,i),i}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(ve(this.#s),"");return s=s.replaceAll(":","-"),j(this.#e,this.#n,o?.replaceAll(":","-")??"",ve(s))}};var Ci=Object.defineProperty,_i=f((e,t)=>Ci(e,"name",{value:t,configurable:!0}),"t$1");const Mi=_i(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 Ii=Object.defineProperty,ye=f((e,t)=>Ii(e,"name",{value:t,configurable:!0}),"l$4");const Ti=Z,Fi=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(i=>i.includes("/")?i:`**/${i}`);s=Ti(n,null,{resolve:e})}else s=ye(()=>null,"hasSideEffects");return s},"getPackageSideEffect");var Fe,vt;function Ai(){if(vt)return Fe;vt=1;var e=hs,t=e.spawn,o=e.exec;Fe=f(function(r,a,c){if(typeof a=="function"&&c===void 0&&(c=a,a=void 0),r=parseInt(r),Number.isNaN(r)){if(c)return c(new Error("pid must be a number"));throw new Error("pid must be a number")}var l={},p={};switch(l[r]=[],p[r]=1,process.platform){case"win32":o("taskkill /pid "+r+" /T /F",c);break;case"darwin":i(r,l,p,function(d){return t("pgrep",["-P",d])},function(){s(l,a,c)});break;default:i(r,l,p,function(d){return t("ps",["-o","pid","--no-headers","--ppid",d])},function(){s(l,a,c)});break}},"treeKill");function s(r,a,c){var l={};try{Object.keys(r).forEach(function(p){r[p].forEach(function(d){l[d]||(n(d,a),l[d]=1)}),l[p]||(n(p,a),l[p]=1)})}catch(p){if(c)return c(p);throw p}if(c)return c()}f(s,"killAll");function n(r,a){try{process.kill(parseInt(r,10),a)}catch(c){if(c.code!=="ESRCH")throw c}}f(n,"killPid");function i(r,a,c,l,p){var d=l(r),u="";d.stdout.on("data",function(g){var g=g.toString("ascii");u+=g});var m=f(function(h){if(delete c[r],h!=0){Object.keys(c).length==0&&p();return}u.match(/\d+/g).forEach(function(g){g=parseInt(g,10),a[r].push(g),a[g]=[],c[g]=1,i(g,a,c,l,p)})},"onClose");d.on("close",m)}return f(i,"buildProcessTree"),Fe}f(Ai,"requireTreeKill");var Ri=Ai();const Ji=os(Ri);var Bi=Object.defineProperty,go=f((e,t)=>Bi(e,"name",{value:t,configurable:!0}),"l$3");const Li=go(e=>process.platform==="win32"&&"cmd"in e&&"code"in e&&typeof e.cmd=="string"&&e.cmd.startsWith("taskkill")&&e.code===128,"isTaskKillCmdProcessNotFoundError"),Wi=go(async({pid:e,signal:t})=>await new Promise((o,s)=>{if(!Number.isInteger(e)||e<=0){s(new Error("Invalid process ID"));return}Ji(e,t,n=>{if(n&&!Li(n)){s(n);return}o()})}),"killProcess");var Ui=Object.defineProperty,Ki=f((e,t)=>Ui(e,"name",{value:t,configurable:!0}),"n");const ho=Ki(e=>{const t=j(e,"package.json");if(!z(t))throw new Error("package.json not found at "+t);return{packageJson:ys(t),packageJsonPath:t}},"loadPackageJson");var zi=Object.defineProperty,Vi=f((e,t)=>zi(e,"name",{value:t,configurable:!0}),"r$2");const bt=Vi((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 Hi=Object.defineProperty,yo=f((e,t)=>Hi(e,"name",{value:t,configurable:!0}),"r$1");const wt=yo(async(e,t)=>{if(typeof e.name!="string"){let o=Ue(e.input)?I(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)}`);Tt(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"),Gi=yo(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 r of e.options.rollup.watch.exclude)typeof r=="string"&&n.push(r)}const i=es([s.input],{cwd:e.options.rootDir,dot:!1,ignore:n,onlyFiles:!0});if(i.length===0)throw new vs("No files found in the glob pattern: "+D(j(e.options.rootDir,s.input)));for(const r of i)e.options.entries.push({...s,input:k(e.options.rootDir,r)});e.options.entries.splice(e.options.entries.indexOf(t),1)}for(const t of e.options.entries.filter(o=>o.fileAlias===void 0))await wt(t,e);for(const t of e.options.entries.filter(o=>o.fileAlias!==void 0))t.name=t.fileAlias,t.fileAlias=void 0,await wt(t,e)},"prepareEntries");var qi=Object.defineProperty,Xi=f((e,t)=>qi(e,"name",{value:t,configurable:!0}),"o");const Yi=Xi(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 i=Jt(n);!Re(e.options.externals,n)&&!n.startsWith("chunks/")&&e.pkg?.dependencies?.[i]===void 0&&e.pkg?.peerDependencies?.[i]===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,vo=f((e,t)=>Qi(e,"name",{value:t,configurable:!0}),"i$1");const Zi=vo((e,t)=>bs(e,t)<=e.length/3||t.includes(e),"isSimilar"),ea=vo((e,t)=>{const o=e.toLowerCase();return t.filter(s=>Zi(s.toLowerCase(),o))},"findAlternatives");var ta=Object.defineProperty,$t=f((e,t)=>ta(e,"name",{value:t,configurable:!0}),"r");const oa=$t(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(a=>t.dtsOnly?a.subKey==="types"?a.file:void 0:a.file)].filter(Boolean).map(a=>a&&k(t.rootDir,a.replace(/\/[^*/]*\*[^\n\r/\u2028\u2029]*(?:[\n\r\u2028\u2029][^*/]*\*[^\n\r/\u2028\u2029]*)*(?:\/.*)?$/,"")))),n=[];for(const a of s)a&&!a.includes("*")&&!kt(a)&&n.push(a.replace(`${t.rootDir}/`,""));const i=$t(a=>I(t.rootDir,k(t.outDir,a)),"rPath"),r=e.buildEntries.filter(a=>!a.chunk).map(a=>i(a.path));if(n.length>0){let a="Potential missing or wrong package.json files:";for(const c of n){const l=ea(c,r);a+=`
|
|
102
|
+
- `+D(c)+(l.length>0?Oo` (did you mean ${l.map(p=>`"${p}"`).join(", ")}?)`:"")}S(e,a)}},"validatePackageEntries");var sa=Object.defineProperty,na=f((e,t)=>sa(e,"name",{value:t,configurable:!0}),"l$1");const ra=na(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(i=>i.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[i,r]of Object.entries(o.bin))r&&r.includes(s?".mjs":".cjs")&&S(e,`The 'bin.${i}' field in your package.json should not use a ${s?".mjs":".cjs"} extension for ${s?"CommonJS":"ES modules"} binaries.`)}if(e.options.declaration){let i=!0;o.type==="module"&&(i=!!o.main?.endsWith(".cjs")),o.types===void 0&&o.typings===void 0&&i&&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")&&i&&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 ia=Object.defineProperty,aa=f((e,t)=>ia(e,"name",{value:t,configurable:!0}),"i");const la=aa(e=>{const{packageJson:t}=ho(e.options.rootDir);e.pkg=t,Yi(e),ra(e),oa(e)},"validator");var ca=Object.defineProperty,pa=f((e,t)=>ca(e,"name",{value:t,configurable:!0}),"a");const ua=/^[^a-z_@#~]|[^\w/@#~-]|@\/|#\/|~\//i,da=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"]),jt=pa(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(ua.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(da.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 fa=Object.defineProperty,T=f((e,t)=>fa(e,"name",{value:t,configurable:!0}),"u");const ma=T(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"),ga=T((e,t,o,s,n,i,r,a,c)=>{const l=ma(c?.config.compilerOptions?.jsx),p=Ao(i,n,r,{alias:{},browserTargets:Fo(),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:(a.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:l,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:T((d,u,m)=>`
|
|
90
103
|
# Licenses of bundled dependencies
|
|
91
|
-
The published ${
|
|
92
|
-
`+(
|
|
104
|
+
The published ${m} 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:T((d,u,m)=>`
|
|
97
110
|
# Licenses of bundled types
|
|
98
|
-
The published ${
|
|
99
|
-
`+(
|
|
111
|
+
The published ${m} 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:l,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:l,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:Fi(t,a),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:a.name??"unknown",pretty:!0,readme:"none",showConfig:s,tsconfig:c?.path}});if(!p.transformerName){const d=new Map([...Object.entries(a.dependencies??{}),...Object.entries(a.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 ")+Jo),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(", ")),a.dependencies&&p.externals.push(...Object.keys(a.dependencies)),a.peerDependencies&&p.externals.push(...Object.keys(a.peerDependencies)),a.optionalDependencies&&p.externals.push(...Object.keys(a.optionalDependencies)),jt(p.alias),p.rollup.alias&&p.rollup.alias.entries&&jt(p.rollup.alias.entries),p},"generateOptions"),ha=T(async(e,t,o,s,n,i,r,a,c,l)=>{const p=await bi(r.preset??i.preset??"auto",l),d=ga(e,t,s,n,i,r,p,a,c);_o(j(d.rootDir,d.outDir));const u={buildEntries:[],dependencyGraphMap:new Map,environment:s,hooks:Ro(),jiti:Pt(d.rootDir,d.jiti),logger:e,mode:o,options:d,pkg:a,tsconfig:c,usedImports:new Set,warnings:new Set};p.hooks&&u.hooks.addHooks(p.hooks),i.hooks&&u.hooks.addHooks(i.hooks),r.hooks&&u.hooks.addHooks(r.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 m=a.dependencies?.typescript!==void 0||a.devDependencies?.typescript!==void 0;if(u.options.declaration&&u.tsconfig===void 0&&m)throw new Error("Cannot build declaration files without a tsconfig.json");return m?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(a.devDependencies?.typescript??a.dependencies?.typescript??"unknown")),u.options.declaration&&(a.dependencies?.typescript||a.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 Gi(u),u},"createContext"),ya=T(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: \`./${I(e.options.rootDir,o)}\``),await Mo(o))},"cleanDistributionDirectories"),va=T(async(e,t,o)=>{if(e&&z(j(e,"keystore1.json"))){const s=Dt(j(e,"keystore.json")),n=xt(e,{withFileTypes:!0}).filter(r=>r.isDirectory());let i=o;for(const r of n)s[r.name]||(await jo(j(e,r.name),{force:!0,recursive:!0}),i&&t.raw(`
|
|
106
119
|
|
|
107
|
-
`),t.info({message:"Removing "+
|
|
108
|
-
${
|
|
109
|
-
`),await
|
|
110
|
-
⚡️ `+
|
|
120
|
+
`),t.info({message:"Removing "+r.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),i=!1)}},"removeOldCacheFolders"),ba=T(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),yl=T(async(e,t,o,s,n={})=>{const{configPath:i,debug:r,tsconfigPath:a,...c}=n;s.wrapAll(),e=k(Ne.cwd(),e),s.debug("Root directory:",e);const{packageJson:l,packageJsonPath:p}=ho(e);s.debug("Using package.json found at",p);let d;if(a){const b=j(e,a);if(!await Le(b))throw new Error("tsconfig.json not found at "+b);d={config:Io(b),path:b},s.info("Using tsconfig settings at",b)}else if(l.dependencies?.typescript||l.devDependencies?.typescript)try{d=await To(e),s.debug("Using tsconfig settings found at",d.path)}catch{s.info("No tsconfig.json or jsconfig.json found.")}const u=Do("@visulima/packem",{cwd:e});let m=!1,h,g;try{const b=await Mi(e,i??""),v=Pt(e,{debug:r});let w=await v.import(b,{default:!0,try:!0})||{};typeof w=="function"&&(w=await w(o,t)),s.debug("Using packem config found at",j(e,b));const $=q(JSON.stringify({version:l.version,...l.dependencies,...l.devDependencies,...l.peerDependencies,...l.peerDependenciesMeta,browser:l.browser,eNode:l.engines?.node,exports:l.exports,main:l.main,module:l.module,type:l.type,types:l.types}))+q(JSON.stringify(w));u&&fs($,u,s);const O=new Pi(e,u,$,s),y=await ha(s,e,t,o,r??!1,c,w,l,d,v);O.isEnabled=y.options.fileCache,y.logger.info(D(ba(t)+" "+y.options.name)),y.logger.debug({context:y.options.entries,message:`${W("Root dir:")} ${y.options.rootDir}
|
|
121
|
+
${W("Entries:")}`}),await ya(y);const P=T(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=T(()=>Xe(Math.floor(Date.now()-N)),"getBuilderDuration");await E(y,u,O,m),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"),_=T(async()=>{if(h!==void 0)await Wi({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=T(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=Bo(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=T(()=>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 Oi(y,O,P,J,_),bt(y,!1);return}t==="jit"?(await ji(y),await y.hooks.callHook("build:done",y)):(m=await ti(y,O),await y.hooks.callHook("validate:before",y),la(y),await y.hooks.callHook("validate:done",y),bt(y,m)),y.logger.raw(`
|
|
126
|
+
⚡️ Build run in `+te()),await P(),await J(),Ne.on("SIGINT",async()=>{await _()}),Ne.on("SIGTERM",async()=>{await _()})}catch(b){throw s.raw(`
|
|
127
|
+
`),uo(b),b}finally{s.restoreAll(),await va(u,s,m)}},"packem");export{yl as default};
|