@jadujoel/web-audio-clip-node 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/audio/ClipNode.js +312 -0
- package/dist/audio/processor-code.js +2 -0
- package/dist/audio/processor-kernel.js +861 -0
- package/dist/audio/processor.js +80 -0
- package/dist/audio/types.js +9 -0
- package/dist/audio/utils.js +128 -0
- package/dist/audio/version.d.ts +1 -0
- package/dist/audio/version.js +2 -0
- package/dist/audio/workletUrl.js +17 -0
- package/dist/components/AudioControl.js +99 -0
- package/dist/components/ContextMenu.js +73 -0
- package/dist/components/ControlSection.js +74 -0
- package/dist/components/DetuneControl.js +44 -0
- package/dist/components/DisplayPanel.js +6 -0
- package/dist/components/FilterControl.js +48 -0
- package/dist/components/GainControl.js +44 -0
- package/dist/components/PanControl.js +50 -0
- package/dist/components/PlaybackRateControl.js +44 -0
- package/dist/components/PlayheadSlider.js +20 -0
- package/dist/components/SnappableSlider.js +174 -0
- package/dist/components/TransportButtons.js +9 -0
- package/dist/controls/controlDefs.js +211 -0
- package/dist/controls/formatValueText.js +80 -0
- package/dist/controls/linkedControlPairs.js +51 -0
- package/dist/data/cache.js +17 -0
- package/dist/data/fileStore.js +39 -0
- package/dist/hooks/useClipNode.js +338 -0
- package/dist/lib-react.js +17 -19
- package/dist/lib.bundle.js +6 -0
- package/dist/lib.bundle.js.map +7 -0
- package/dist/lib.js +16 -44
- package/dist/store/clipStore.js +71 -0
- package/examples/README.md +10 -0
- package/examples/cdn-vanilla/README.md +13 -0
- package/examples/cdn-vanilla/index.html +69 -0
- package/examples/esm-bundler/README.md +8 -0
- package/examples/esm-bundler/index.html +12 -0
- package/examples/esm-bundler/node_modules/.package-lock.json +1168 -0
- package/examples/esm-bundler/node_modules/@esbuild/darwin-arm64/README.md +3 -0
- package/examples/esm-bundler/node_modules/@esbuild/darwin-arm64/bin/esbuild +0 -0
- package/examples/esm-bundler/node_modules/@esbuild/darwin-arm64/package.json +20 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/LICENSE +21 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/README.md +91 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/ClipNode.d.ts +86 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/ClipNode.js +312 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/processor-code.d.ts +1 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/processor-code.js +2 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/processor-kernel.d.ts +43 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/processor-kernel.js +861 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/processor.d.ts +1 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/processor.js +80 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/types.d.ts +192 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/types.js +9 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/utils.d.ts +22 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/utils.js +128 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/version.d.ts +1 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/version.js +2 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/workletUrl.d.ts +6 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/audio/workletUrl.js +17 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/AudioControl.d.ts +28 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/AudioControl.js +99 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/ContextMenu.d.ts +17 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/ContextMenu.js +73 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/ControlSection.d.ts +26 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/ControlSection.js +74 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/DetuneControl.d.ts +10 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/DetuneControl.js +44 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/DisplayPanel.d.ts +14 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/DisplayPanel.js +6 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/FilterControl.d.ts +12 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/FilterControl.js +48 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/GainControl.d.ts +10 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/GainControl.js +44 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/PanControl.d.ts +10 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/PanControl.js +50 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/PlaybackRateControl.d.ts +10 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/PlaybackRateControl.js +44 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/PlayheadSlider.d.ts +13 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/PlayheadSlider.js +20 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/SnappableSlider.d.ts +18 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/SnappableSlider.js +174 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/TransportButtons.d.ts +14 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/components/TransportButtons.js +9 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/controls/controlDefs.d.ts +31 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/controls/controlDefs.js +211 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/controls/formatValueText.d.ts +2 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/controls/formatValueText.js +80 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/controls/linkedControlPairs.d.ts +20 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/controls/linkedControlPairs.js +51 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/data/cache.d.ts +1 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/data/cache.js +17 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/data/fileStore.d.ts +6 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/data/fileStore.js +39 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/hooks/useClipNode.d.ts +31 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/hooks/useClipNode.js +338 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/lib-react.d.ts +15 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/lib-react.js +17 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/lib.d.ts +16 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/lib.js +16 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/processor.js +4 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/processor.js.map +12 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/store/clipStore.d.ts +63 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/store/clipStore.js +71 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/dist/styles.css +739 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/README.md +10 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/cdn-vanilla/README.md +13 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/cdn-vanilla/index.html +61 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/esm-bundler/README.md +8 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/esm-bundler/index.html +12 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/esm-bundler/package.json +15 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/esm-bundler/src/main.ts +43 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/react/README.md +10 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/react/index.html +12 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/react/package.json +21 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/react/src/App.tsx +20 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/react/src/main.tsx +9 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/react/vite.config.ts +6 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/self-hosted/README.md +11 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/self-hosted/index.html +12 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/self-hosted/package.json +16 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/self-hosted/public/.gitkeep +1 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/examples/self-hosted/src/main.ts +46 -0
- package/examples/esm-bundler/node_modules/@jadujoel/web-audio-clip-node/package.json +88 -0
- package/examples/esm-bundler/node_modules/@rollup/rollup-darwin-arm64/README.md +3 -0
- package/examples/esm-bundler/node_modules/@rollup/rollup-darwin-arm64/package.json +22 -0
- package/examples/esm-bundler/node_modules/@rollup/rollup-darwin-arm64/rollup.darwin-arm64.node +0 -0
- package/examples/esm-bundler/node_modules/@types/estree/LICENSE +21 -0
- package/examples/esm-bundler/node_modules/@types/estree/README.md +15 -0
- package/examples/esm-bundler/node_modules/@types/estree/flow.d.ts +167 -0
- package/examples/esm-bundler/node_modules/@types/estree/index.d.ts +694 -0
- package/examples/esm-bundler/node_modules/@types/estree/package.json +27 -0
- package/examples/esm-bundler/node_modules/esbuild/LICENSE.md +21 -0
- package/examples/esm-bundler/node_modules/esbuild/README.md +3 -0
- package/examples/esm-bundler/node_modules/esbuild/bin/esbuild +0 -0
- package/examples/esm-bundler/node_modules/esbuild/install.js +289 -0
- package/examples/esm-bundler/node_modules/esbuild/lib/main.d.ts +716 -0
- package/examples/esm-bundler/node_modules/esbuild/lib/main.js +2242 -0
- package/examples/esm-bundler/node_modules/esbuild/package.json +49 -0
- package/examples/esm-bundler/node_modules/fdir/LICENSE +7 -0
- package/examples/esm-bundler/node_modules/fdir/README.md +91 -0
- package/examples/esm-bundler/node_modules/fdir/dist/index.cjs +588 -0
- package/examples/esm-bundler/node_modules/fdir/dist/index.d.cts +155 -0
- package/examples/esm-bundler/node_modules/fdir/dist/index.d.mts +155 -0
- package/examples/esm-bundler/node_modules/fdir/dist/index.mjs +570 -0
- package/examples/esm-bundler/node_modules/fdir/package.json +103 -0
- package/examples/esm-bundler/node_modules/nanoid/LICENSE +20 -0
- package/examples/esm-bundler/node_modules/nanoid/README.md +39 -0
- package/examples/esm-bundler/node_modules/nanoid/async/index.browser.cjs +69 -0
- package/examples/esm-bundler/node_modules/nanoid/async/index.browser.js +34 -0
- package/examples/esm-bundler/node_modules/nanoid/async/index.cjs +71 -0
- package/examples/esm-bundler/node_modules/nanoid/async/index.d.ts +56 -0
- package/examples/esm-bundler/node_modules/nanoid/async/index.js +35 -0
- package/examples/esm-bundler/node_modules/nanoid/async/index.native.js +26 -0
- package/examples/esm-bundler/node_modules/nanoid/async/package.json +12 -0
- package/examples/esm-bundler/node_modules/nanoid/bin/nanoid.cjs +55 -0
- package/examples/esm-bundler/node_modules/nanoid/index.browser.cjs +72 -0
- package/examples/esm-bundler/node_modules/nanoid/index.browser.js +34 -0
- package/examples/esm-bundler/node_modules/nanoid/index.cjs +85 -0
- package/examples/esm-bundler/node_modules/nanoid/index.d.cts +91 -0
- package/examples/esm-bundler/node_modules/nanoid/index.d.ts +91 -0
- package/examples/esm-bundler/node_modules/nanoid/index.js +45 -0
- package/examples/esm-bundler/node_modules/nanoid/nanoid.js +1 -0
- package/examples/esm-bundler/node_modules/nanoid/non-secure/index.cjs +34 -0
- package/examples/esm-bundler/node_modules/nanoid/non-secure/index.d.ts +33 -0
- package/examples/esm-bundler/node_modules/nanoid/non-secure/index.js +21 -0
- package/examples/esm-bundler/node_modules/nanoid/non-secure/package.json +6 -0
- package/examples/esm-bundler/node_modules/nanoid/package.json +89 -0
- package/examples/esm-bundler/node_modules/nanoid/url-alphabet/index.cjs +7 -0
- package/examples/esm-bundler/node_modules/nanoid/url-alphabet/index.js +3 -0
- package/examples/esm-bundler/node_modules/nanoid/url-alphabet/package.json +6 -0
- package/examples/esm-bundler/node_modules/picocolors/LICENSE +15 -0
- package/examples/esm-bundler/node_modules/picocolors/README.md +21 -0
- package/examples/esm-bundler/node_modules/picocolors/package.json +25 -0
- package/examples/esm-bundler/node_modules/picocolors/picocolors.browser.js +4 -0
- package/examples/esm-bundler/node_modules/picocolors/picocolors.d.ts +5 -0
- package/examples/esm-bundler/node_modules/picocolors/picocolors.js +75 -0
- package/examples/esm-bundler/node_modules/picocolors/types.d.ts +51 -0
- package/examples/esm-bundler/node_modules/picomatch/LICENSE +21 -0
- package/examples/esm-bundler/node_modules/picomatch/README.md +749 -0
- package/examples/esm-bundler/node_modules/picomatch/index.js +17 -0
- package/examples/esm-bundler/node_modules/picomatch/lib/constants.js +184 -0
- package/examples/esm-bundler/node_modules/picomatch/lib/parse.js +1386 -0
- package/examples/esm-bundler/node_modules/picomatch/lib/picomatch.js +349 -0
- package/examples/esm-bundler/node_modules/picomatch/lib/scan.js +391 -0
- package/examples/esm-bundler/node_modules/picomatch/lib/utils.js +72 -0
- package/examples/esm-bundler/node_modules/picomatch/package.json +82 -0
- package/examples/esm-bundler/node_modules/picomatch/posix.js +3 -0
- package/examples/esm-bundler/node_modules/postcss/LICENSE +20 -0
- package/examples/esm-bundler/node_modules/postcss/README.md +28 -0
- package/examples/esm-bundler/node_modules/postcss/lib/at-rule.d.ts +139 -0
- package/examples/esm-bundler/node_modules/postcss/lib/at-rule.js +25 -0
- package/examples/esm-bundler/node_modules/postcss/lib/comment.d.ts +67 -0
- package/examples/esm-bundler/node_modules/postcss/lib/comment.js +13 -0
- package/examples/esm-bundler/node_modules/postcss/lib/container.d.ts +478 -0
- package/examples/esm-bundler/node_modules/postcss/lib/container.js +447 -0
- package/examples/esm-bundler/node_modules/postcss/lib/css-syntax-error.d.ts +247 -0
- package/examples/esm-bundler/node_modules/postcss/lib/css-syntax-error.js +133 -0
- package/examples/esm-bundler/node_modules/postcss/lib/declaration.d.ts +150 -0
- package/examples/esm-bundler/node_modules/postcss/lib/declaration.js +24 -0
- package/examples/esm-bundler/node_modules/postcss/lib/document.d.ts +68 -0
- package/examples/esm-bundler/node_modules/postcss/lib/document.js +33 -0
- package/examples/esm-bundler/node_modules/postcss/lib/fromJSON.d.ts +9 -0
- package/examples/esm-bundler/node_modules/postcss/lib/fromJSON.js +54 -0
- package/examples/esm-bundler/node_modules/postcss/lib/input.d.ts +226 -0
- package/examples/esm-bundler/node_modules/postcss/lib/input.js +273 -0
- package/examples/esm-bundler/node_modules/postcss/lib/lazy-result.d.ts +189 -0
- package/examples/esm-bundler/node_modules/postcss/lib/lazy-result.js +550 -0
- package/examples/esm-bundler/node_modules/postcss/lib/list.d.ts +60 -0
- package/examples/esm-bundler/node_modules/postcss/lib/list.js +58 -0
- package/examples/esm-bundler/node_modules/postcss/lib/map-generator.js +376 -0
- package/examples/esm-bundler/node_modules/postcss/lib/no-work-result.d.ts +45 -0
- package/examples/esm-bundler/node_modules/postcss/lib/no-work-result.js +137 -0
- package/examples/esm-bundler/node_modules/postcss/lib/node.d.ts +555 -0
- package/examples/esm-bundler/node_modules/postcss/lib/node.js +449 -0
- package/examples/esm-bundler/node_modules/postcss/lib/parse.d.ts +9 -0
- package/examples/esm-bundler/node_modules/postcss/lib/parse.js +42 -0
- package/examples/esm-bundler/node_modules/postcss/lib/parser.js +611 -0
- package/examples/esm-bundler/node_modules/postcss/lib/postcss.d.mts +66 -0
- package/examples/esm-bundler/node_modules/postcss/lib/postcss.d.ts +456 -0
- package/examples/esm-bundler/node_modules/postcss/lib/postcss.js +101 -0
- package/examples/esm-bundler/node_modules/postcss/lib/postcss.mjs +30 -0
- package/examples/esm-bundler/node_modules/postcss/lib/previous-map.d.ts +80 -0
- package/examples/esm-bundler/node_modules/postcss/lib/previous-map.js +145 -0
- package/examples/esm-bundler/node_modules/postcss/lib/processor.d.ts +114 -0
- package/examples/esm-bundler/node_modules/postcss/lib/processor.js +67 -0
- package/examples/esm-bundler/node_modules/postcss/lib/result.d.ts +204 -0
- package/examples/esm-bundler/node_modules/postcss/lib/result.js +42 -0
- package/examples/esm-bundler/node_modules/postcss/lib/root.d.ts +86 -0
- package/examples/esm-bundler/node_modules/postcss/lib/root.js +61 -0
- package/examples/esm-bundler/node_modules/postcss/lib/rule.d.ts +126 -0
- package/examples/esm-bundler/node_modules/postcss/lib/rule.js +27 -0
- package/examples/esm-bundler/node_modules/postcss/lib/stringifier.d.ts +45 -0
- package/examples/esm-bundler/node_modules/postcss/lib/stringifier.js +353 -0
- package/examples/esm-bundler/node_modules/postcss/lib/stringify.d.ts +9 -0
- package/examples/esm-bundler/node_modules/postcss/lib/stringify.js +11 -0
- package/examples/esm-bundler/node_modules/postcss/lib/symbols.js +5 -0
- package/examples/esm-bundler/node_modules/postcss/lib/terminal-highlight.js +70 -0
- package/examples/esm-bundler/node_modules/postcss/lib/tokenize.js +266 -0
- package/examples/esm-bundler/node_modules/postcss/lib/warn-once.js +13 -0
- package/examples/esm-bundler/node_modules/postcss/lib/warning.d.ts +146 -0
- package/examples/esm-bundler/node_modules/postcss/lib/warning.js +37 -0
- package/examples/esm-bundler/node_modules/postcss/package.json +88 -0
- package/examples/esm-bundler/node_modules/rollup/LICENSE.md +679 -0
- package/examples/esm-bundler/node_modules/rollup/README.md +134 -0
- package/examples/esm-bundler/node_modules/rollup/dist/bin/rollup +1912 -0
- package/examples/esm-bundler/node_modules/rollup/dist/es/getLogFilter.js +64 -0
- package/examples/esm-bundler/node_modules/rollup/dist/es/package.json +1 -0
- package/examples/esm-bundler/node_modules/rollup/dist/es/parseAst.js +12 -0
- package/examples/esm-bundler/node_modules/rollup/dist/es/rollup.js +17 -0
- package/examples/esm-bundler/node_modules/rollup/dist/es/shared/node-entry.js +24463 -0
- package/examples/esm-bundler/node_modules/rollup/dist/es/shared/parseAst.js +2124 -0
- package/examples/esm-bundler/node_modules/rollup/dist/es/shared/watch.js +9909 -0
- package/examples/esm-bundler/node_modules/rollup/dist/getLogFilter.d.ts +5 -0
- package/examples/esm-bundler/node_modules/rollup/dist/getLogFilter.js +69 -0
- package/examples/esm-bundler/node_modules/rollup/dist/loadConfigFile.d.ts +20 -0
- package/examples/esm-bundler/node_modules/rollup/dist/loadConfigFile.js +29 -0
- package/examples/esm-bundler/node_modules/rollup/dist/native.js +161 -0
- package/examples/esm-bundler/node_modules/rollup/dist/parseAst.d.ts +4 -0
- package/examples/esm-bundler/node_modules/rollup/dist/parseAst.js +22 -0
- package/examples/esm-bundler/node_modules/rollup/dist/rollup.d.ts +1225 -0
- package/examples/esm-bundler/node_modules/rollup/dist/rollup.js +127 -0
- package/examples/esm-bundler/node_modules/rollup/dist/shared/fsevents-importer.js +37 -0
- package/examples/esm-bundler/node_modules/rollup/dist/shared/index.js +9615 -0
- package/examples/esm-bundler/node_modules/rollup/dist/shared/loadConfigFile.js +572 -0
- package/examples/esm-bundler/node_modules/rollup/dist/shared/parseAst.js +2361 -0
- package/examples/esm-bundler/node_modules/rollup/dist/shared/rollup.js +24385 -0
- package/examples/esm-bundler/node_modules/rollup/dist/shared/watch-cli.js +542 -0
- package/examples/esm-bundler/node_modules/rollup/dist/shared/watch.js +324 -0
- package/examples/esm-bundler/node_modules/rollup/package.json +289 -0
- package/examples/esm-bundler/node_modules/source-map-js/LICENSE +28 -0
- package/examples/esm-bundler/node_modules/source-map-js/README.md +765 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/array-set.js +121 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/base64-vlq.js +140 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/base64.js +67 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/binary-search.js +111 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/mapping-list.js +79 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/quick-sort.js +132 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/source-map-generator.js +444 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/source-node.d.ts +1 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/source-node.js +413 -0
- package/examples/esm-bundler/node_modules/source-map-js/lib/util.js +594 -0
- package/examples/esm-bundler/node_modules/source-map-js/package.json +71 -0
- package/examples/esm-bundler/node_modules/source-map-js/source-map.d.ts +104 -0
- package/examples/esm-bundler/node_modules/source-map-js/source-map.js +8 -0
- package/examples/esm-bundler/node_modules/tinyglobby/LICENSE +21 -0
- package/examples/esm-bundler/node_modules/tinyglobby/README.md +25 -0
- package/examples/esm-bundler/node_modules/tinyglobby/dist/index.cjs +334 -0
- package/examples/esm-bundler/node_modules/tinyglobby/dist/index.d.cts +148 -0
- package/examples/esm-bundler/node_modules/tinyglobby/dist/index.d.mts +148 -0
- package/examples/esm-bundler/node_modules/tinyglobby/dist/index.mjs +306 -0
- package/examples/esm-bundler/node_modules/tinyglobby/package.json +73 -0
- package/examples/esm-bundler/node_modules/vite/LICENSE.md +2406 -0
- package/examples/esm-bundler/node_modules/vite/README.md +20 -0
- package/examples/esm-bundler/node_modules/vite/bin/openChrome.applescript +95 -0
- package/examples/esm-bundler/node_modules/vite/bin/vite.js +79 -0
- package/examples/esm-bundler/node_modules/vite/client.d.ts +279 -0
- package/examples/esm-bundler/node_modules/vite/dist/client/client.mjs +1134 -0
- package/examples/esm-bundler/node_modules/vite/dist/client/env.mjs +24 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/chunks/dep-3RmXg9uo.js +553 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/chunks/dep-4-IQbZQm.js +822 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/chunks/dep-CvfTChi5.js +8218 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/chunks/dep-Dq2t6Dq0.js +49565 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/chunks/dep-lpEPC2f9.js +7113 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/cli.js +949 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/constants.js +149 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/index.d.ts +4227 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/index.js +194 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/module-runner.d.ts +290 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/module-runner.js +1311 -0
- package/examples/esm-bundler/node_modules/vite/dist/node/moduleRunnerTransport.d-DJ_mE5sf.d.ts +87 -0
- package/examples/esm-bundler/node_modules/vite/dist/node-cjs/publicUtils.cjs +3987 -0
- package/examples/esm-bundler/node_modules/vite/index.cjs +96 -0
- package/examples/esm-bundler/node_modules/vite/index.d.cts +6 -0
- package/examples/esm-bundler/node_modules/vite/misc/false.js +1 -0
- package/examples/esm-bundler/node_modules/vite/misc/true.js +1 -0
- package/examples/esm-bundler/node_modules/vite/package.json +204 -0
- package/examples/esm-bundler/node_modules/vite/types/customEvent.d.ts +45 -0
- package/examples/esm-bundler/node_modules/vite/types/hmrPayload.d.ts +74 -0
- package/examples/esm-bundler/node_modules/vite/types/hot.d.ts +39 -0
- package/examples/esm-bundler/node_modules/vite/types/import-meta.d.ts +5 -0
- package/examples/esm-bundler/node_modules/vite/types/importGlob.d.ts +75 -0
- package/examples/esm-bundler/node_modules/vite/types/importMeta.d.ts +31 -0
- package/examples/esm-bundler/node_modules/vite/types/internal/cssPreprocessorOptions.d.ts +63 -0
- package/examples/esm-bundler/node_modules/vite/types/internal/lightningcssOptions.d.ts +18 -0
- package/examples/esm-bundler/node_modules/vite/types/metadata.d.ts +35 -0
- package/examples/esm-bundler/node_modules/vite/types/package.json +4 -0
- package/examples/esm-bundler/package-lock.json +1127 -0
- package/examples/esm-bundler/package.json +15 -0
- package/examples/esm-bundler/src/main.ts +43 -0
- package/examples/react/README.md +10 -0
- package/examples/react/index.html +12 -0
- package/examples/react/package.json +19 -0
- package/examples/react/src/App.tsx +20 -0
- package/examples/react/src/main.tsx +9 -0
- package/examples/self-hosted/README.md +11 -0
- package/examples/self-hosted/index.html +12 -0
- package/examples/self-hosted/package.json +16 -0
- package/examples/self-hosted/public/.gitkeep +1 -0
- package/examples/self-hosted/src/main.ts +46 -0
- package/package.json +4 -2
- package/dist/lib-react.js.map +0 -9
- package/dist/lib.js.map +0 -9
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export interface StartOfSourceMap {
|
|
2
|
+
file?: string;
|
|
3
|
+
sourceRoot?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface RawSourceMap extends StartOfSourceMap {
|
|
7
|
+
version: string;
|
|
8
|
+
sources: string[];
|
|
9
|
+
names: string[];
|
|
10
|
+
sourcesContent?: string[];
|
|
11
|
+
mappings: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Position {
|
|
15
|
+
line: number;
|
|
16
|
+
column: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface LineRange extends Position {
|
|
20
|
+
lastColumn: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FindPosition extends Position {
|
|
24
|
+
// SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND
|
|
25
|
+
bias?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface SourceFindPosition extends FindPosition {
|
|
29
|
+
source: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface MappedPosition extends Position {
|
|
33
|
+
source: string;
|
|
34
|
+
name?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface MappingItem {
|
|
38
|
+
source: string | null;
|
|
39
|
+
generatedLine: number;
|
|
40
|
+
generatedColumn: number;
|
|
41
|
+
originalLine: number | null;
|
|
42
|
+
originalColumn: number | null;
|
|
43
|
+
name: string | null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export class SourceMapConsumer {
|
|
47
|
+
static GENERATED_ORDER: number;
|
|
48
|
+
static ORIGINAL_ORDER: number;
|
|
49
|
+
|
|
50
|
+
static GREATEST_LOWER_BOUND: number;
|
|
51
|
+
static LEAST_UPPER_BOUND: number;
|
|
52
|
+
|
|
53
|
+
constructor(rawSourceMap: RawSourceMap);
|
|
54
|
+
readonly file: string | undefined | null;
|
|
55
|
+
readonly sourceRoot: string | undefined | null;
|
|
56
|
+
readonly sourcesContent: readonly string[] | null | undefined;
|
|
57
|
+
readonly sources: readonly string[]
|
|
58
|
+
|
|
59
|
+
computeColumnSpans(): void;
|
|
60
|
+
originalPositionFor(generatedPosition: FindPosition): MappedPosition;
|
|
61
|
+
generatedPositionFor(originalPosition: SourceFindPosition): LineRange;
|
|
62
|
+
allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
|
|
63
|
+
hasContentsOfAllSources(): boolean;
|
|
64
|
+
sourceContentFor(source: string, returnNullOnMissing?: boolean): string | null;
|
|
65
|
+
eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface Mapping {
|
|
69
|
+
generated: Position;
|
|
70
|
+
original?: Position | null;
|
|
71
|
+
source?: string | null;
|
|
72
|
+
name?: string | null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export class SourceMapGenerator {
|
|
76
|
+
constructor(startOfSourceMap?: StartOfSourceMap);
|
|
77
|
+
static fromSourceMap(sourceMapConsumer: SourceMapConsumer, startOfSourceMap?: StartOfSourceMap): SourceMapGenerator;
|
|
78
|
+
addMapping(mapping: Mapping): void;
|
|
79
|
+
setSourceContent(sourceFile: string, sourceContent: string | null | undefined): void;
|
|
80
|
+
applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
|
|
81
|
+
toString(): string;
|
|
82
|
+
toJSON(): RawSourceMap;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface CodeWithSourceMap {
|
|
86
|
+
code: string;
|
|
87
|
+
map: SourceMapGenerator;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export class SourceNode {
|
|
91
|
+
constructor();
|
|
92
|
+
constructor(line: number, column: number, source: string);
|
|
93
|
+
constructor(line: number, column: number, source: string, chunk?: string, name?: string);
|
|
94
|
+
static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
|
|
95
|
+
add(chunk: string): void;
|
|
96
|
+
prepend(chunk: string): void;
|
|
97
|
+
setSourceContent(sourceFile: string, sourceContent: string): void;
|
|
98
|
+
walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
|
|
99
|
+
walkSourceContents(fn: (file: string, content: string) => void): void;
|
|
100
|
+
join(sep: string): SourceNode;
|
|
101
|
+
replaceRight(pattern: string, replacement: string): SourceNode;
|
|
102
|
+
toString(): string;
|
|
103
|
+
toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
|
|
104
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2009-2011 Mozilla Foundation and contributors
|
|
3
|
+
* Licensed under the New BSD license. See LICENSE.txt or:
|
|
4
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
|
|
7
|
+
exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
|
|
8
|
+
exports.SourceNode = require('./lib/source-node').SourceNode;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Madeline Gurriarán
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# tinyglobby
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.com/package/tinyglobby)
|
|
4
|
+
[](https://npmjs.com/package/tinyglobby)
|
|
5
|
+
|
|
6
|
+
A fast and minimal alternative to globby and fast-glob, meant to behave the same way.
|
|
7
|
+
|
|
8
|
+
Both globby and fast-glob present some behavior no other globbing lib has,
|
|
9
|
+
which makes it hard to manually replace with something smaller and better.
|
|
10
|
+
|
|
11
|
+
This library uses only two subdependencies, compared to `globby`'s [23](https://npmgraph.js.org/?q=globby@16.2.0)
|
|
12
|
+
and `fast-glob`'s [17](https://npmgraph.js.org/?q=fast-glob@3.3.3).
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import { glob, globSync } from 'tinyglobby';
|
|
18
|
+
|
|
19
|
+
await glob(['files/*.ts', '!**/*.d.ts'], { cwd: 'src' });
|
|
20
|
+
globSync('src/**/*.ts', { ignore: '**/*.d.ts' });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
Visit https://superchupu.dev/tinyglobby to read the full documentation.
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
let fs = require("fs");
|
|
25
|
+
let path = require("path");
|
|
26
|
+
let url = require("url");
|
|
27
|
+
let fdir = require("fdir");
|
|
28
|
+
let picomatch = require("picomatch");
|
|
29
|
+
picomatch = __toESM(picomatch);
|
|
30
|
+
//#region src/utils.ts
|
|
31
|
+
const isReadonlyArray = Array.isArray;
|
|
32
|
+
const BACKSLASHES = /\\/g;
|
|
33
|
+
const isWin = process.platform === "win32";
|
|
34
|
+
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
35
|
+
function getPartialMatcher(patterns, options = {}) {
|
|
36
|
+
const patternsCount = patterns.length;
|
|
37
|
+
const patternsParts = Array(patternsCount);
|
|
38
|
+
const matchers = Array(patternsCount);
|
|
39
|
+
let i, j;
|
|
40
|
+
for (i = 0; i < patternsCount; i++) {
|
|
41
|
+
const parts = splitPattern(patterns[i]);
|
|
42
|
+
patternsParts[i] = parts;
|
|
43
|
+
const partsCount = parts.length;
|
|
44
|
+
const partMatchers = Array(partsCount);
|
|
45
|
+
for (j = 0; j < partsCount; j++) partMatchers[j] = (0, picomatch.default)(parts[j], options);
|
|
46
|
+
matchers[i] = partMatchers;
|
|
47
|
+
}
|
|
48
|
+
return (input) => {
|
|
49
|
+
const inputParts = input.split("/");
|
|
50
|
+
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
51
|
+
for (i = 0; i < patternsCount; i++) {
|
|
52
|
+
const patternParts = patternsParts[i];
|
|
53
|
+
const matcher = matchers[i];
|
|
54
|
+
const inputPatternCount = inputParts.length;
|
|
55
|
+
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
56
|
+
j = 0;
|
|
57
|
+
while (j < minParts) {
|
|
58
|
+
const part = patternParts[j];
|
|
59
|
+
if (part.includes("/")) return true;
|
|
60
|
+
if (!matcher[j](inputParts[j])) break;
|
|
61
|
+
if (!options.noglobstar && part === "**") return true;
|
|
62
|
+
j++;
|
|
63
|
+
}
|
|
64
|
+
if (j === inputPatternCount) return true;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/* node:coverage ignore next 2 */
|
|
70
|
+
const WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
|
|
71
|
+
const isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === "/";
|
|
72
|
+
function buildFormat(cwd, root, absolute) {
|
|
73
|
+
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
74
|
+
if (absolute) {
|
|
75
|
+
const start = cwd.length + +!isRoot(cwd);
|
|
76
|
+
return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
|
|
77
|
+
}
|
|
78
|
+
const prefix = root.slice(cwd.length + 1);
|
|
79
|
+
if (prefix) return (p, isDir) => {
|
|
80
|
+
if (p === ".") return prefix;
|
|
81
|
+
const result = `${prefix}/${p}`;
|
|
82
|
+
return isDir ? result.slice(0, -1) : result;
|
|
83
|
+
};
|
|
84
|
+
return (p, isDir) => isDir && p !== "." ? p.slice(0, -1) : p;
|
|
85
|
+
}
|
|
86
|
+
if (absolute) return (p) => path.posix.relative(cwd, p) || ".";
|
|
87
|
+
return (p) => path.posix.relative(cwd, `${root}/${p}`) || ".";
|
|
88
|
+
}
|
|
89
|
+
function buildRelative(cwd, root) {
|
|
90
|
+
if (root.startsWith(`${cwd}/`)) {
|
|
91
|
+
const prefix = root.slice(cwd.length + 1);
|
|
92
|
+
return (p) => `${prefix}/${p}`;
|
|
93
|
+
}
|
|
94
|
+
return (p) => {
|
|
95
|
+
const result = path.posix.relative(cwd, `${root}/${p}`);
|
|
96
|
+
return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const splitPatternOptions = { parts: true };
|
|
100
|
+
function splitPattern(path$1) {
|
|
101
|
+
var _result$parts;
|
|
102
|
+
const result = picomatch.default.scan(path$1, splitPatternOptions);
|
|
103
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
|
|
104
|
+
}
|
|
105
|
+
const ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
|
|
106
|
+
function convertPosixPathToPattern(path$2) {
|
|
107
|
+
return escapePosixPath(path$2);
|
|
108
|
+
}
|
|
109
|
+
function convertWin32PathToPattern(path$3) {
|
|
110
|
+
return escapeWin32Path(path$3).replace(ESCAPED_WIN32_BACKSLASHES, "/");
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Converts a path to a pattern depending on the platform.
|
|
114
|
+
* Identical to {@link escapePath} on POSIX systems.
|
|
115
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#convertPathToPattern}
|
|
116
|
+
*/
|
|
117
|
+
/* node:coverage ignore next 3 */
|
|
118
|
+
const convertPathToPattern = isWin ? convertWin32PathToPattern : convertPosixPathToPattern;
|
|
119
|
+
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
120
|
+
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
121
|
+
const escapePosixPath = (path$4) => path$4.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
122
|
+
const escapeWin32Path = (path$5) => path$5.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
123
|
+
/**
|
|
124
|
+
* Escapes a path's special characters depending on the platform.
|
|
125
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
126
|
+
*/
|
|
127
|
+
/* node:coverage ignore next */
|
|
128
|
+
const escapePath = isWin ? escapeWin32Path : escapePosixPath;
|
|
129
|
+
/**
|
|
130
|
+
* Checks if a pattern has dynamic parts.
|
|
131
|
+
*
|
|
132
|
+
* Has a few minor differences with [`fast-glob`](https://github.com/mrmlnc/fast-glob) for better accuracy:
|
|
133
|
+
*
|
|
134
|
+
* - Doesn't necessarily return `false` on patterns that include `\`.
|
|
135
|
+
* - Returns `true` if the pattern includes parentheses, regardless of them representing one single pattern or not.
|
|
136
|
+
* - Returns `true` for unfinished glob extensions i.e. `(h`, `+(h`.
|
|
137
|
+
* - Returns `true` for unfinished brace expansions as long as they include `,` or `..`.
|
|
138
|
+
*
|
|
139
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#isDynamicPattern}
|
|
140
|
+
*/
|
|
141
|
+
function isDynamicPattern(pattern, options) {
|
|
142
|
+
if ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;
|
|
143
|
+
const scan = picomatch.default.scan(pattern);
|
|
144
|
+
return scan.isGlob || scan.negated;
|
|
145
|
+
}
|
|
146
|
+
function log(...tasks) {
|
|
147
|
+
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
|
|
148
|
+
}
|
|
149
|
+
function ensureStringArray(value) {
|
|
150
|
+
return typeof value === "string" ? [value] : value !== null && value !== void 0 ? value : [];
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/patterns.ts
|
|
154
|
+
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
155
|
+
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
156
|
+
function normalizePattern(pattern, opts, props, isIgnore) {
|
|
157
|
+
var _PARENT_DIRECTORY$exe;
|
|
158
|
+
const cwd = opts.cwd;
|
|
159
|
+
let result = pattern;
|
|
160
|
+
if (pattern[pattern.length - 1] === "/") result = pattern.slice(0, -1);
|
|
161
|
+
if (result[result.length - 1] !== "*" && opts.expandDirectories) result += "/**";
|
|
162
|
+
const escapedCwd = escapePath(cwd);
|
|
163
|
+
result = (0, path.isAbsolute)(result.replace(ESCAPING_BACKSLASHES, "")) ? path.posix.relative(escapedCwd, result) : path.posix.normalize(result);
|
|
164
|
+
const parentDir = (_PARENT_DIRECTORY$exe = PARENT_DIRECTORY.exec(result)) === null || _PARENT_DIRECTORY$exe === void 0 ? void 0 : _PARENT_DIRECTORY$exe[0];
|
|
165
|
+
const parts = splitPattern(result);
|
|
166
|
+
if (parentDir) {
|
|
167
|
+
const n = (parentDir.length + 1) / 3;
|
|
168
|
+
let i = 0;
|
|
169
|
+
const cwdParts = escapedCwd.split("/");
|
|
170
|
+
while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
|
|
171
|
+
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
172
|
+
i++;
|
|
173
|
+
}
|
|
174
|
+
const potentialRoot = path.posix.join(cwd, parentDir.slice(i * 3));
|
|
175
|
+
if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
|
|
176
|
+
props.root = potentialRoot;
|
|
177
|
+
props.depthOffset = -n + i;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (!isIgnore && props.depthOffset >= 0) {
|
|
181
|
+
var _props$commonPath;
|
|
182
|
+
(_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
|
|
183
|
+
const newCommonPath = [];
|
|
184
|
+
const length = Math.min(props.commonPath.length, parts.length);
|
|
185
|
+
for (let i = 0; i < length; i++) {
|
|
186
|
+
const part = parts[i];
|
|
187
|
+
if (part === "**" && !parts[i + 1]) {
|
|
188
|
+
newCommonPath.pop();
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
if (i === parts.length - 1 || part !== props.commonPath[i] || isDynamicPattern(part)) break;
|
|
192
|
+
newCommonPath.push(part);
|
|
193
|
+
}
|
|
194
|
+
props.depthOffset = newCommonPath.length;
|
|
195
|
+
props.commonPath = newCommonPath;
|
|
196
|
+
props.root = newCommonPath.length > 0 ? path.posix.join(cwd, ...newCommonPath) : cwd;
|
|
197
|
+
}
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
function processPatterns(options, patterns, props) {
|
|
201
|
+
const matchPatterns = [];
|
|
202
|
+
const ignorePatterns = [];
|
|
203
|
+
for (const pattern of options.ignore) {
|
|
204
|
+
if (!pattern) continue;
|
|
205
|
+
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, options, props, true));
|
|
206
|
+
}
|
|
207
|
+
for (const pattern of patterns) {
|
|
208
|
+
if (!pattern) continue;
|
|
209
|
+
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, options, props, false));
|
|
210
|
+
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), options, props, true));
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
match: matchPatterns,
|
|
214
|
+
ignore: ignorePatterns
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/crawler.ts
|
|
219
|
+
function buildCrawler(options, patterns) {
|
|
220
|
+
const cwd = options.cwd;
|
|
221
|
+
const props = {
|
|
222
|
+
root: cwd,
|
|
223
|
+
depthOffset: 0
|
|
224
|
+
};
|
|
225
|
+
const processed = processPatterns(options, patterns, props);
|
|
226
|
+
if (options.debug) log("internal processing patterns:", processed);
|
|
227
|
+
const { absolute, caseSensitiveMatch, debug, dot, followSymbolicLinks, onlyDirectories } = options;
|
|
228
|
+
const root = props.root.replace(BACKSLASHES, "");
|
|
229
|
+
const matchOptions = {
|
|
230
|
+
dot,
|
|
231
|
+
nobrace: options.braceExpansion === false,
|
|
232
|
+
nocase: !caseSensitiveMatch,
|
|
233
|
+
noextglob: options.extglob === false,
|
|
234
|
+
noglobstar: options.globstar === false,
|
|
235
|
+
posix: true
|
|
236
|
+
};
|
|
237
|
+
const matcher = (0, picomatch.default)(processed.match, matchOptions);
|
|
238
|
+
const ignore = (0, picomatch.default)(processed.ignore, matchOptions);
|
|
239
|
+
const partialMatcher = getPartialMatcher(processed.match, matchOptions);
|
|
240
|
+
const format = buildFormat(cwd, root, absolute);
|
|
241
|
+
const excludeFormatter = absolute ? format : buildFormat(cwd, root, true);
|
|
242
|
+
const excludePredicate = (_, p) => {
|
|
243
|
+
const relativePath = excludeFormatter(p, true);
|
|
244
|
+
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
245
|
+
};
|
|
246
|
+
let maxDepth;
|
|
247
|
+
if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
|
|
248
|
+
const crawler = new fdir.fdir({
|
|
249
|
+
filters: [debug ? (p, isDirectory) => {
|
|
250
|
+
const path = format(p, isDirectory);
|
|
251
|
+
const matches = matcher(path) && !ignore(path);
|
|
252
|
+
if (matches) log(`matched ${path}`);
|
|
253
|
+
return matches;
|
|
254
|
+
} : (p, isDirectory) => {
|
|
255
|
+
const path = format(p, isDirectory);
|
|
256
|
+
return matcher(path) && !ignore(path);
|
|
257
|
+
}],
|
|
258
|
+
exclude: debug ? (_, p) => {
|
|
259
|
+
const skipped = excludePredicate(_, p);
|
|
260
|
+
log(`${skipped ? "skipped" : "crawling"} ${p}`);
|
|
261
|
+
return skipped;
|
|
262
|
+
} : excludePredicate,
|
|
263
|
+
fs: options.fs,
|
|
264
|
+
pathSeparator: "/",
|
|
265
|
+
relativePaths: !absolute,
|
|
266
|
+
resolvePaths: absolute,
|
|
267
|
+
includeBasePath: absolute,
|
|
268
|
+
resolveSymlinks: followSymbolicLinks,
|
|
269
|
+
excludeSymlinks: !followSymbolicLinks,
|
|
270
|
+
excludeFiles: onlyDirectories,
|
|
271
|
+
includeDirs: onlyDirectories || !options.onlyFiles,
|
|
272
|
+
maxDepth,
|
|
273
|
+
signal: options.signal
|
|
274
|
+
}).crawl(root);
|
|
275
|
+
if (options.debug) log("internal properties:", {
|
|
276
|
+
...props,
|
|
277
|
+
root
|
|
278
|
+
});
|
|
279
|
+
return [crawler, cwd !== root && !absolute && buildRelative(cwd, root)];
|
|
280
|
+
}
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/index.ts
|
|
283
|
+
function formatPaths(paths, mapper) {
|
|
284
|
+
if (mapper) for (let i = paths.length - 1; i >= 0; i--) paths[i] = mapper(paths[i]);
|
|
285
|
+
return paths;
|
|
286
|
+
}
|
|
287
|
+
const defaultOptions = {
|
|
288
|
+
caseSensitiveMatch: true,
|
|
289
|
+
cwd: process.cwd(),
|
|
290
|
+
debug: !!process.env.TINYGLOBBY_DEBUG,
|
|
291
|
+
expandDirectories: true,
|
|
292
|
+
followSymbolicLinks: true,
|
|
293
|
+
onlyFiles: true
|
|
294
|
+
};
|
|
295
|
+
function getOptions(options) {
|
|
296
|
+
const opts = {
|
|
297
|
+
...defaultOptions,
|
|
298
|
+
...options
|
|
299
|
+
};
|
|
300
|
+
opts.cwd = (opts.cwd instanceof URL ? (0, url.fileURLToPath)(opts.cwd) : (0, path.resolve)(opts.cwd)).replace(BACKSLASHES, "/");
|
|
301
|
+
opts.ignore = ensureStringArray(opts.ignore);
|
|
302
|
+
opts.fs && (opts.fs = {
|
|
303
|
+
readdir: opts.fs.readdir || fs.readdir,
|
|
304
|
+
readdirSync: opts.fs.readdirSync || fs.readdirSync,
|
|
305
|
+
realpath: opts.fs.realpath || fs.realpath,
|
|
306
|
+
realpathSync: opts.fs.realpathSync || fs.realpathSync,
|
|
307
|
+
stat: opts.fs.stat || fs.stat,
|
|
308
|
+
statSync: opts.fs.statSync || fs.statSync
|
|
309
|
+
});
|
|
310
|
+
if (opts.debug) log("globbing with options:", opts);
|
|
311
|
+
return opts;
|
|
312
|
+
}
|
|
313
|
+
function getCrawler(globInput, inputOptions = {}) {
|
|
314
|
+
var _ref;
|
|
315
|
+
if (globInput && (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
316
|
+
const isModern = isReadonlyArray(globInput) || typeof globInput === "string";
|
|
317
|
+
const patterns = ensureStringArray((_ref = isModern ? globInput : globInput.patterns) !== null && _ref !== void 0 ? _ref : "**/*");
|
|
318
|
+
const options = getOptions(isModern ? inputOptions : globInput);
|
|
319
|
+
return patterns.length > 0 ? buildCrawler(options, patterns) : [];
|
|
320
|
+
}
|
|
321
|
+
async function glob(globInput, options) {
|
|
322
|
+
const [crawler, relative] = getCrawler(globInput, options);
|
|
323
|
+
return crawler ? formatPaths(await crawler.withPromise(), relative) : [];
|
|
324
|
+
}
|
|
325
|
+
function globSync(globInput, options) {
|
|
326
|
+
const [crawler, relative] = getCrawler(globInput, options);
|
|
327
|
+
return crawler ? formatPaths(crawler.sync(), relative) : [];
|
|
328
|
+
}
|
|
329
|
+
//#endregion
|
|
330
|
+
exports.convertPathToPattern = convertPathToPattern;
|
|
331
|
+
exports.escapePath = escapePath;
|
|
332
|
+
exports.glob = glob;
|
|
333
|
+
exports.globSync = globSync;
|
|
334
|
+
exports.isDynamicPattern = isDynamicPattern;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FSLike } from "fdir";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
type FileSystemAdapter = Partial<FSLike>;
|
|
5
|
+
interface GlobOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Whether to return absolute paths. Disable to have relative paths.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
absolute?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Enables support for brace expansion syntax, like `{a,b}` or `{1..9}`.
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
braceExpansion?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to match in case-sensitive mode.
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
caseSensitiveMatch?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The working directory in which to search. Results will be returned relative to this directory, unless
|
|
23
|
+
* {@link absolute} is set.
|
|
24
|
+
*
|
|
25
|
+
* It is important to avoid globbing outside this directory when possible, even with absolute paths enabled,
|
|
26
|
+
* as doing so can harm performance due to having to recalculate relative paths.
|
|
27
|
+
* @default process.cwd()
|
|
28
|
+
*/
|
|
29
|
+
cwd?: string | URL;
|
|
30
|
+
/**
|
|
31
|
+
* Logs useful debug information. Meant for development purposes. Logs can change at any time.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
debug?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Maximum directory depth to crawl.
|
|
37
|
+
* @default Infinity
|
|
38
|
+
*/
|
|
39
|
+
deep?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to return entries that start with a dot, like `.gitignore` or `.prettierrc`.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
dot?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to automatically expand directory patterns.
|
|
47
|
+
*
|
|
48
|
+
* Important to disable if migrating from [`fast-glob`](https://github.com/mrmlnc/fast-glob).
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
expandDirectories?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Enables support for extglobs, like `+(pattern)`.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
extglob?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to traverse and include symbolic links. Can slightly affect performance.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
followSymbolicLinks?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* An object that overrides `node:fs` functions.
|
|
64
|
+
* @default import('node:fs')
|
|
65
|
+
*/
|
|
66
|
+
fs?: FileSystemAdapter;
|
|
67
|
+
/**
|
|
68
|
+
* Enables support for matching nested directories with globstars (`**`).
|
|
69
|
+
* If `false`, `**` behaves exactly like `*`.
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
globstar?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Glob patterns to exclude from the results.
|
|
75
|
+
* @default []
|
|
76
|
+
*/
|
|
77
|
+
ignore?: string | readonly string[];
|
|
78
|
+
/**
|
|
79
|
+
* Enable to only return directories.
|
|
80
|
+
* If `true`, disables {@link onlyFiles}.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
onlyDirectories?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Enable to only return files.
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
onlyFiles?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated Provide patterns as the first argument instead.
|
|
91
|
+
*/
|
|
92
|
+
patterns?: string | readonly string[];
|
|
93
|
+
/**
|
|
94
|
+
* An `AbortSignal` to abort crawling the file system.
|
|
95
|
+
* @default undefined
|
|
96
|
+
*/
|
|
97
|
+
signal?: AbortSignal;
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/utils.d.ts
|
|
101
|
+
/**
|
|
102
|
+
* Converts a path to a pattern depending on the platform.
|
|
103
|
+
* Identical to {@link escapePath} on POSIX systems.
|
|
104
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#convertPathToPattern}
|
|
105
|
+
*/
|
|
106
|
+
declare const convertPathToPattern: (path: string) => string;
|
|
107
|
+
/**
|
|
108
|
+
* Escapes a path's special characters depending on the platform.
|
|
109
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
110
|
+
*/
|
|
111
|
+
declare const escapePath: (path: string) => string;
|
|
112
|
+
/**
|
|
113
|
+
* Checks if a pattern has dynamic parts.
|
|
114
|
+
*
|
|
115
|
+
* Has a few minor differences with [`fast-glob`](https://github.com/mrmlnc/fast-glob) for better accuracy:
|
|
116
|
+
*
|
|
117
|
+
* - Doesn't necessarily return `false` on patterns that include `\`.
|
|
118
|
+
* - Returns `true` if the pattern includes parentheses, regardless of them representing one single pattern or not.
|
|
119
|
+
* - Returns `true` for unfinished glob extensions i.e. `(h`, `+(h`.
|
|
120
|
+
* - Returns `true` for unfinished brace expansions as long as they include `,` or `..`.
|
|
121
|
+
*
|
|
122
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#isDynamicPattern}
|
|
123
|
+
*/
|
|
124
|
+
declare function isDynamicPattern(pattern: string, options?: {
|
|
125
|
+
caseSensitiveMatch: boolean;
|
|
126
|
+
}): boolean;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/index.d.ts
|
|
129
|
+
/**
|
|
130
|
+
* Asynchronously match files following a glob pattern.
|
|
131
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#glob}
|
|
132
|
+
*/
|
|
133
|
+
declare function glob(patterns: string | readonly string[], options?: Omit<GlobOptions, "patterns">): Promise<string[]>;
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated Provide patterns as the first argument instead.
|
|
136
|
+
*/
|
|
137
|
+
declare function glob(options: GlobOptions): Promise<string[]>;
|
|
138
|
+
/**
|
|
139
|
+
* Synchronously match files following a glob pattern.
|
|
140
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#globSync}
|
|
141
|
+
*/
|
|
142
|
+
declare function globSync(patterns: string | readonly string[], options?: Omit<GlobOptions, "patterns">): string[];
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated Provide patterns as the first argument instead.
|
|
145
|
+
*/
|
|
146
|
+
declare function globSync(options: GlobOptions): string[];
|
|
147
|
+
//#endregion
|
|
148
|
+
export { type GlobOptions, convertPathToPattern, escapePath, glob, globSync, isDynamicPattern };
|