@better-t-stack/template-generator 3.13.2-dev.6c6cffb
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/dist/fs-writer.d.mts +8 -0
- package/dist/fs-writer.d.mts.map +1 -0
- package/dist/fs-writer.mjs +50 -0
- package/dist/fs-writer.mjs.map +1 -0
- package/dist/index.d.mts +182 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +26727 -0
- package/dist/index.mjs.map +1 -0
- package/dist/template-reader.d.mts +30 -0
- package/dist/template-reader.d.mts.map +1 -0
- package/dist/template-reader.mjs +2860 -0
- package/dist/template-reader.mjs.map +1 -0
- package/dist/types-BubFnV2d.d.mts +36 -0
- package/dist/types-BubFnV2d.d.mts.map +1 -0
- package/package.json +66 -0
- package/scripts/generate-templates.ts +97 -0
- package/templates/addons/biome/biome.json.hbs +96 -0
- package/templates/addons/husky/.husky/pre-commit +1 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/apple-touch-icon.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/favicon-96x96.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/favicon.svg +6 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/site.webmanifest.hbs +21 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/web-app-manifest-192x192.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/web-app-manifest-512x512.png +0 -0
- package/templates/addons/pwa/apps/web/next/src/app/manifest.ts.hbs +26 -0
- package/templates/addons/pwa/apps/web/vite/public/logo.png +0 -0
- package/templates/addons/pwa/apps/web/vite/pwa-assets.config.ts.hbs +12 -0
- package/templates/addons/ruler/.ruler/bts.md.hbs +142 -0
- package/templates/addons/ruler/.ruler/ruler.toml.hbs +80 -0
- package/templates/addons/turborepo/turbo.json.hbs +74 -0
- package/templates/addons/ultracite/biome.json.hbs +26 -0
- package/templates/api/orpc/fullstack/next/src/app/api/rpc/[[...rest]]/route.ts.hbs +50 -0
- package/templates/api/orpc/fullstack/tanstack-start/src/routes/api/rpc/$.ts.hbs +58 -0
- package/templates/api/orpc/native/utils/orpc.ts.hbs +39 -0
- package/templates/api/orpc/server/_gitignore +34 -0
- package/templates/api/orpc/server/package.json.hbs +15 -0
- package/templates/api/orpc/server/src/context.ts.hbs +148 -0
- package/templates/api/orpc/server/src/index.ts.hbs +21 -0
- package/templates/api/orpc/server/src/routers/index.ts.hbs +55 -0
- package/templates/api/orpc/server/tsconfig.json.hbs +10 -0
- package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +32 -0
- package/templates/api/orpc/web/nuxt/app/plugins/vue-query.ts.hbs +44 -0
- package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +113 -0
- package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +30 -0
- package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +30 -0
- package/templates/api/trpc/fullstack/next/src/app/api/trpc/[trpc]/route.ts.hbs +14 -0
- package/templates/api/trpc/fullstack/tanstack-start/src/routes/api/trpc/$.ts.hbs +22 -0
- package/templates/api/trpc/native/utils/trpc.ts.hbs +37 -0
- package/templates/api/trpc/server/_gitignore +34 -0
- package/templates/api/trpc/server/package.json.hbs +14 -0
- package/templates/api/trpc/server/src/context.ts.hbs +148 -0
- package/templates/api/trpc/server/src/index.ts.hbs +26 -0
- package/templates/api/trpc/server/src/routers/index.ts.hbs +55 -0
- package/templates/api/trpc/server/tsconfig.json.hbs +10 -0
- package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +97 -0
- package/templates/auth/better-auth/convex/backend/convex/auth.config.ts.hbs +6 -0
- package/templates/auth/better-auth/convex/backend/convex/auth.ts.hbs +68 -0
- package/templates/auth/better-auth/convex/backend/convex/http.ts.hbs +12 -0
- package/templates/auth/better-auth/convex/backend/convex/privateData.ts.hbs +17 -0
- package/templates/auth/better-auth/convex/native/bare/components/sign-in.tsx.hbs +127 -0
- package/templates/auth/better-auth/convex/native/bare/components/sign-up.tsx.hbs +138 -0
- package/templates/auth/better-auth/convex/native/base/lib/auth-client.ts.hbs +18 -0
- package/templates/auth/better-auth/convex/native/unistyles/components/sign-in.tsx.hbs +127 -0
- package/templates/auth/better-auth/convex/native/unistyles/components/sign-up.tsx.hbs +145 -0
- package/templates/auth/better-auth/convex/native/uniwind/components/sign-in.tsx.hbs +73 -0
- package/templates/auth/better-auth/convex/native/uniwind/components/sign-up.tsx.hbs +85 -0
- package/templates/auth/better-auth/convex/web/react/next/src/app/api/auth/[...all]/route.ts.hbs +3 -0
- package/templates/auth/better-auth/convex/web/react/next/src/app/dashboard/page.tsx.hbs +40 -0
- package/templates/auth/better-auth/convex/web/react/next/src/components/sign-in-form.tsx.hbs +129 -0
- package/templates/auth/better-auth/convex/web/react/next/src/components/sign-up-form.tsx.hbs +154 -0
- package/templates/auth/better-auth/convex/web/react/next/src/components/user-menu.tsx.hbs +48 -0
- package/templates/auth/better-auth/convex/web/react/next/src/lib/auth-client.ts.hbs +6 -0
- package/templates/auth/better-auth/convex/web/react/next/src/lib/auth-server.ts.hbs +16 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/components/sign-in-form.tsx.hbs +133 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/components/sign-up-form.tsx.hbs +158 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/components/user-menu.tsx.hbs +52 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/lib/auth-client.ts.hbs +11 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/routes/dashboard.tsx.hbs +43 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/components/sign-in-form.tsx.hbs +133 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/components/sign-up-form.tsx.hbs +158 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/components/user-menu.tsx.hbs +47 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/lib/auth-client.ts.hbs +6 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/lib/auth-server.ts.hbs +13 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/routes/api/auth/$.ts.hbs +11 -0
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +43 -0
- package/templates/auth/better-auth/fullstack/next/src/app/api/auth/[...all]/route.ts.hbs +4 -0
- package/templates/auth/better-auth/fullstack/tanstack-start/src/routes/api/auth/$.ts.hbs +15 -0
- package/templates/auth/better-auth/native/bare/app/(drawer)/index.tsx.hbs +186 -0
- package/templates/auth/better-auth/native/bare/components/sign-in.tsx.hbs +131 -0
- package/templates/auth/better-auth/native/bare/components/sign-up.tsx.hbs +150 -0
- package/templates/auth/better-auth/native/base/lib/auth-client.ts.hbs +16 -0
- package/templates/auth/better-auth/native/unistyles/app/(drawer)/index.tsx.hbs +187 -0
- package/templates/auth/better-auth/native/unistyles/components/sign-in.tsx.hbs +139 -0
- package/templates/auth/better-auth/native/unistyles/components/sign-up.tsx.hbs +157 -0
- package/templates/auth/better-auth/native/uniwind/app/(drawer)/index.tsx.hbs +123 -0
- package/templates/auth/better-auth/native/uniwind/components/sign-in.tsx.hbs +87 -0
- package/templates/auth/better-auth/native/uniwind/components/sign-up.tsx.hbs +128 -0
- package/templates/auth/better-auth/server/base/_gitignore +34 -0
- package/templates/auth/better-auth/server/base/package.json.hbs +14 -0
- package/templates/auth/better-auth/server/base/src/index.ts.hbs +304 -0
- package/templates/auth/better-auth/server/base/tsconfig.json.hbs +10 -0
- package/templates/auth/better-auth/server/db/drizzle/mysql/src/schema/auth.ts.hbs +100 -0
- package/templates/auth/better-auth/server/db/drizzle/postgres/src/schema/auth.ts.hbs +93 -0
- package/templates/auth/better-auth/server/db/drizzle/sqlite/src/schema/auth.ts.hbs +107 -0
- package/templates/auth/better-auth/server/db/mongoose/mongodb/src/models/auth.model.ts.hbs +68 -0
- package/templates/auth/better-auth/server/db/prisma/mongodb/prisma/schema/auth.prisma.hbs +62 -0
- package/templates/auth/better-auth/server/db/prisma/mysql/prisma/schema/auth.prisma.hbs +62 -0
- package/templates/auth/better-auth/server/db/prisma/postgres/prisma/schema/auth.prisma.hbs +62 -0
- package/templates/auth/better-auth/server/db/prisma/sqlite/prisma/schema/auth.prisma.hbs +62 -0
- package/templates/auth/better-auth/web/nuxt/app/components/SignInForm.vue.hbs +82 -0
- package/templates/auth/better-auth/web/nuxt/app/components/SignUpForm.vue.hbs +91 -0
- package/templates/auth/better-auth/web/nuxt/app/components/UserMenu.vue.hbs +42 -0
- package/templates/auth/better-auth/web/nuxt/app/middleware/auth.ts.hbs +14 -0
- package/templates/auth/better-auth/web/nuxt/app/pages/dashboard.vue.hbs +99 -0
- package/templates/auth/better-auth/web/nuxt/app/pages/login.vue.hbs +27 -0
- package/templates/auth/better-auth/web/nuxt/app/plugins/auth-client.ts.hbs +21 -0
- package/templates/auth/better-auth/web/react/base/src/lib/auth-client.ts.hbs +16 -0
- package/templates/auth/better-auth/web/react/next/src/app/dashboard/dashboard.tsx.hbs +60 -0
- package/templates/auth/better-auth/web/react/next/src/app/dashboard/page.tsx.hbs +42 -0
- package/templates/auth/better-auth/web/react/next/src/app/login/page.tsx.hbs +16 -0
- package/templates/auth/better-auth/web/react/next/src/components/sign-in-form.tsx.hbs +135 -0
- package/templates/auth/better-auth/web/react/next/src/components/sign-up-form.tsx.hbs +160 -0
- package/templates/auth/better-auth/web/react/next/src/components/user-menu.tsx.hbs +62 -0
- package/templates/auth/better-auth/web/react/react-router/src/components/sign-in-form.tsx.hbs +135 -0
- package/templates/auth/better-auth/web/react/react-router/src/components/sign-up-form.tsx.hbs +160 -0
- package/templates/auth/better-auth/web/react/react-router/src/components/user-menu.tsx.hbs +61 -0
- package/templates/auth/better-auth/web/react/react-router/src/routes/dashboard.tsx.hbs +80 -0
- package/templates/auth/better-auth/web/react/react-router/src/routes/login.tsx.hbs +13 -0
- package/templates/auth/better-auth/web/react/tanstack-router/src/components/sign-in-form.tsx.hbs +135 -0
- package/templates/auth/better-auth/web/react/tanstack-router/src/components/sign-up-form.tsx.hbs +160 -0
- package/templates/auth/better-auth/web/react/tanstack-router/src/components/user-menu.tsx.hbs +63 -0
- package/templates/auth/better-auth/web/react/tanstack-router/src/routes/dashboard.tsx.hbs +71 -0
- package/templates/auth/better-auth/web/react/tanstack-router/src/routes/login.tsx.hbs +18 -0
- package/templates/auth/better-auth/web/react/tanstack-start/src/components/sign-in-form.tsx.hbs +135 -0
- package/templates/auth/better-auth/web/react/tanstack-start/src/components/sign-up-form.tsx.hbs +160 -0
- package/templates/auth/better-auth/web/react/tanstack-start/src/components/user-menu.tsx.hbs +63 -0
- package/templates/auth/better-auth/web/react/tanstack-start/src/functions/get-user.ts.hbs +6 -0
- package/templates/auth/better-auth/web/react/tanstack-start/src/middleware/auth.ts.hbs +31 -0
- package/templates/auth/better-auth/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +84 -0
- package/templates/auth/better-auth/web/react/tanstack-start/src/routes/login.tsx.hbs +18 -0
- package/templates/auth/better-auth/web/solid/src/components/sign-in-form.tsx.hbs +124 -0
- package/templates/auth/better-auth/web/solid/src/components/sign-up-form.tsx.hbs +148 -0
- package/templates/auth/better-auth/web/solid/src/components/user-menu.tsx.hbs +55 -0
- package/templates/auth/better-auth/web/solid/src/lib/auth-client.ts.hbs +12 -0
- package/templates/auth/better-auth/web/solid/src/routes/dashboard.tsx.hbs +67 -0
- package/templates/auth/better-auth/web/solid/src/routes/login.tsx.hbs +23 -0
- package/templates/auth/better-auth/web/svelte/src/components/SignInForm.svelte.hbs +109 -0
- package/templates/auth/better-auth/web/svelte/src/components/SignUpForm.svelte.hbs +142 -0
- package/templates/auth/better-auth/web/svelte/src/components/UserMenu.svelte.hbs +52 -0
- package/templates/auth/better-auth/web/svelte/src/lib/auth-client.ts.hbs +12 -0
- package/templates/auth/better-auth/web/svelte/src/routes/dashboard/+page.svelte.hbs +59 -0
- package/templates/auth/better-auth/web/svelte/src/routes/login/+page.svelte.hbs +12 -0
- package/templates/auth/clerk/convex/backend/convex/auth.config.ts.hbs +12 -0
- package/templates/auth/clerk/convex/backend/convex/privateData.ts.hbs +16 -0
- package/templates/auth/clerk/convex/native/base/app/(auth)/_layout.tsx.hbs +12 -0
- package/templates/auth/clerk/convex/native/base/app/(auth)/sign-in.tsx.hbs +67 -0
- package/templates/auth/clerk/convex/native/base/app/(auth)/sign-up.tsx.hbs +110 -0
- package/templates/auth/clerk/convex/native/base/components/sign-out-button.tsx.hbs +27 -0
- package/templates/auth/clerk/convex/web/react/next/src/app/dashboard/page.tsx.hbs +29 -0
- package/templates/auth/clerk/convex/web/react/next/src/middleware.ts.hbs +12 -0
- package/templates/auth/clerk/convex/web/react/react-router/src/routes/dashboard.tsx.hbs +32 -0
- package/templates/auth/clerk/convex/web/react/tanstack-router/src/routes/dashboard.tsx.hbs +37 -0
- package/templates/auth/clerk/convex/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +37 -0
- package/templates/auth/clerk/convex/web/react/tanstack-start/src/start.ts.hbs +8 -0
- package/templates/backend/convex/packages/backend/_gitignore +2 -0
- package/templates/backend/convex/packages/backend/convex/README.md +90 -0
- package/templates/backend/convex/packages/backend/convex/convex.config.ts.hbs +17 -0
- package/templates/backend/convex/packages/backend/convex/healthCheck.ts.hbs +7 -0
- package/templates/backend/convex/packages/backend/convex/schema.ts.hbs +11 -0
- package/templates/backend/convex/packages/backend/convex/tsconfig.json.hbs +25 -0
- package/templates/backend/convex/packages/backend/package.json.hbs +15 -0
- package/templates/backend/server/base/_gitignore +55 -0
- package/templates/backend/server/base/package.json.hbs +17 -0
- package/templates/backend/server/base/tsconfig.json.hbs +13 -0
- package/templates/backend/server/base/tsdown.config.ts.hbs +9 -0
- package/templates/backend/server/elysia/src/index.ts.hbs +122 -0
- package/templates/backend/server/express/src/index.ts.hbs +126 -0
- package/templates/backend/server/fastify/src/index.ts.hbs +187 -0
- package/templates/backend/server/hono/src/index.ts.hbs +171 -0
- package/templates/base/_gitignore +50 -0
- package/templates/base/package.json.hbs +10 -0
- package/templates/base/tsconfig.json.hbs +3 -0
- package/templates/db/base/_gitignore +35 -0
- package/templates/db/base/package.json.hbs +14 -0
- package/templates/db/base/tsconfig.json.hbs +10 -0
- package/templates/db/drizzle/base/src/schema/index.ts.hbs +7 -0
- package/templates/db/drizzle/mysql/drizzle.config.ts.hbs +19 -0
- package/templates/db/drizzle/mysql/src/index.ts.hbs +54 -0
- package/templates/db/drizzle/postgres/drizzle.config.ts.hbs +19 -0
- package/templates/db/drizzle/postgres/src/index.ts.hbs +44 -0
- package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +28 -0
- package/templates/db/drizzle/sqlite/src/index.ts.hbs +39 -0
- package/templates/db/mongoose/mongodb/src/index.ts.hbs +10 -0
- package/templates/db/prisma/mongodb/prisma/schema/schema.prisma.hbs +19 -0
- package/templates/db/prisma/mongodb/prisma.config.ts.hbs +18 -0
- package/templates/db/prisma/mongodb/src/index.ts.hbs +5 -0
- package/templates/db/prisma/mysql/prisma/schema/schema.prisma.hbs +21 -0
- package/templates/db/prisma/mysql/prisma.config.ts.hbs +21 -0
- package/templates/db/prisma/mysql/src/index.ts.hbs +55 -0
- package/templates/db/prisma/postgres/prisma/schema/schema.prisma.hbs +21 -0
- package/templates/db/prisma/postgres/prisma.config.ts.hbs +21 -0
- package/templates/db/prisma/postgres/src/index.ts.hbs +69 -0
- package/templates/db/prisma/sqlite/prisma/schema/schema.prisma.hbs +18 -0
- package/templates/db/prisma/sqlite/prisma.config.ts.hbs +25 -0
- package/templates/db/prisma/sqlite/src/index.ts.hbs +25 -0
- package/templates/db-setup/docker-compose/mongodb/docker-compose.yml.hbs +23 -0
- package/templates/db-setup/docker-compose/mysql/docker-compose.yml.hbs +24 -0
- package/templates/db-setup/docker-compose/postgres/docker-compose.yml.hbs +23 -0
- package/templates/examples/ai/convex/packages/backend/convex/agent.ts.hbs +9 -0
- package/templates/examples/ai/convex/packages/backend/convex/chat.ts.hbs +67 -0
- package/templates/examples/ai/fullstack/next/src/app/api/ai/route.ts.hbs +20 -0
- package/templates/examples/ai/fullstack/tanstack-start/src/routes/api/ai/$.ts.hbs +36 -0
- package/templates/examples/ai/native/bare/app/(drawer)/ai.tsx.hbs +586 -0
- package/templates/examples/ai/native/bare/polyfills.js +22 -0
- package/templates/examples/ai/native/unistyles/app/(drawer)/ai.tsx.hbs +588 -0
- package/templates/examples/ai/native/unistyles/polyfills.js +22 -0
- package/templates/examples/ai/native/uniwind/app/(drawer)/ai.tsx.hbs +331 -0
- package/templates/examples/ai/native/uniwind/polyfills.js +22 -0
- package/templates/examples/ai/web/nuxt/app/pages/ai.vue.hbs +54 -0
- package/templates/examples/ai/web/react/next/src/app/ai/page.tsx.hbs +267 -0
- package/templates/examples/ai/web/react/react-router/src/routes/ai.tsx.hbs +235 -0
- package/templates/examples/ai/web/react/tanstack-router/src/routes/ai.tsx.hbs +242 -0
- package/templates/examples/ai/web/react/tanstack-start/src/routes/ai.tsx.hbs +243 -0
- package/templates/examples/ai/web/svelte/src/routes/ai/+page.svelte.hbs +107 -0
- package/templates/examples/todo/convex/packages/backend/convex/todos.ts.hbs +42 -0
- package/templates/examples/todo/native/bare/app/(drawer)/todos.tsx.hbs +521 -0
- package/templates/examples/todo/native/unistyles/app/(drawer)/todos.tsx.hbs +340 -0
- package/templates/examples/todo/native/uniwind/app/(drawer)/todos.tsx.hbs +282 -0
- package/templates/examples/todo/server/drizzle/base/src/routers/todo.ts.hbs +75 -0
- package/templates/examples/todo/server/drizzle/mysql/src/schema/todo.ts +7 -0
- package/templates/examples/todo/server/drizzle/postgres/src/schema/todo.ts +7 -0
- package/templates/examples/todo/server/drizzle/sqlite/src/schema/todo.ts +7 -0
- package/templates/examples/todo/server/mongoose/base/src/routers/todo.ts.hbs +66 -0
- package/templates/examples/todo/server/mongoose/mongodb/src/models/todo.model.ts.hbs +24 -0
- package/templates/examples/todo/server/prisma/base/src/routers/todo.ts.hbs +116 -0
- package/templates/examples/todo/server/prisma/mongodb/prisma/schema/todo.prisma.hbs +7 -0
- package/templates/examples/todo/server/prisma/mysql/prisma/schema/todo.prisma.hbs +7 -0
- package/templates/examples/todo/server/prisma/postgres/prisma/schema/todo.prisma.hbs +7 -0
- package/templates/examples/todo/server/prisma/sqlite/prisma/schema/todo.prisma.hbs +7 -0
- package/templates/examples/todo/web/nuxt/app/pages/todos.vue.hbs +220 -0
- package/templates/examples/todo/web/react/next/src/app/todos/page.tsx.hbs +245 -0
- package/templates/examples/todo/web/react/react-router/src/routes/todos.tsx.hbs +242 -0
- package/templates/examples/todo/web/react/tanstack-router/src/routes/todos.tsx.hbs +247 -0
- package/templates/examples/todo/web/react/tanstack-start/src/routes/todos.tsx.hbs +272 -0
- package/templates/examples/todo/web/solid/src/routes/todos.tsx.hbs +132 -0
- package/templates/examples/todo/web/svelte/src/routes/todos/+page.svelte.hbs +317 -0
- package/templates/extras/_npmrc.hbs +5 -0
- package/templates/extras/bunfig.toml.hbs +6 -0
- package/templates/extras/pnpm-workspace.yaml +3 -0
- package/templates/frontend/native/bare/_gitignore +18 -0
- package/templates/frontend/native/bare/app/(drawer)/(tabs)/_layout.tsx.hbs +41 -0
- package/templates/frontend/native/bare/app/(drawer)/(tabs)/index.tsx.hbs +43 -0
- package/templates/frontend/native/bare/app/(drawer)/(tabs)/two.tsx.hbs +43 -0
- package/templates/frontend/native/bare/app/(drawer)/_layout.tsx.hbs +90 -0
- package/templates/frontend/native/bare/app/(drawer)/index.tsx.hbs +234 -0
- package/templates/frontend/native/bare/app/+not-found.tsx.hbs +65 -0
- package/templates/frontend/native/bare/app/_layout.tsx.hbs +165 -0
- package/templates/frontend/native/bare/app/modal.tsx.hbs +34 -0
- package/templates/frontend/native/bare/app.json.hbs +50 -0
- package/templates/frontend/native/bare/components/container.tsx.hbs +25 -0
- package/templates/frontend/native/bare/components/header-button.tsx.hbs +47 -0
- package/templates/frontend/native/bare/components/tabbar-icon.tsx.hbs +9 -0
- package/templates/frontend/native/bare/lib/android-navigation-bar.tsx.hbs +12 -0
- package/templates/frontend/native/bare/lib/constants.ts.hbs +19 -0
- package/templates/frontend/native/bare/lib/use-color-scheme.ts.hbs +20 -0
- package/templates/frontend/native/bare/metro.config.js.hbs +9 -0
- package/templates/frontend/native/bare/package.json.hbs +51 -0
- package/templates/frontend/native/bare/tsconfig.json.hbs +11 -0
- package/templates/frontend/native/base/assets/images/android-icon-background.png +0 -0
- package/templates/frontend/native/base/assets/images/android-icon-foreground.png +0 -0
- package/templates/frontend/native/base/assets/images/android-icon-monochrome.png +0 -0
- package/templates/frontend/native/base/assets/images/favicon.png +0 -0
- package/templates/frontend/native/base/assets/images/icon.png +0 -0
- package/templates/frontend/native/base/assets/images/partial-react-logo.png +0 -0
- package/templates/frontend/native/base/assets/images/react-logo.png +0 -0
- package/templates/frontend/native/base/assets/images/react-logo@2x.png +0 -0
- package/templates/frontend/native/base/assets/images/react-logo@3x.png +0 -0
- package/templates/frontend/native/base/assets/images/splash-icon.png +0 -0
- package/templates/frontend/native/unistyles/_gitignore +24 -0
- package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/_layout.tsx.hbs +39 -0
- package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/index.tsx.hbs +37 -0
- package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/two.tsx.hbs +37 -0
- package/templates/frontend/native/unistyles/app/(drawer)/_layout.tsx.hbs +87 -0
- package/templates/frontend/native/unistyles/app/(drawer)/index.tsx.hbs +333 -0
- package/templates/frontend/native/unistyles/app/+not-found.tsx.hbs +65 -0
- package/templates/frontend/native/unistyles/app/_layout.tsx.hbs +169 -0
- package/templates/frontend/native/unistyles/app/modal.tsx.hbs +33 -0
- package/templates/frontend/native/unistyles/app.json.hbs +49 -0
- package/templates/frontend/native/unistyles/babel.config.js.hbs +21 -0
- package/templates/frontend/native/unistyles/breakpoints.ts.hbs +9 -0
- package/templates/frontend/native/unistyles/components/container.tsx.hbs +15 -0
- package/templates/frontend/native/unistyles/components/header-button.tsx.hbs +36 -0
- package/templates/frontend/native/unistyles/components/tabbar-icon.tsx.hbs +8 -0
- package/templates/frontend/native/unistyles/index.js.hbs +2 -0
- package/templates/frontend/native/unistyles/metro.config.js.hbs +5 -0
- package/templates/frontend/native/unistyles/package.json.hbs +51 -0
- package/templates/frontend/native/unistyles/theme.ts.hbs +98 -0
- package/templates/frontend/native/unistyles/tsconfig.json.hbs +12 -0
- package/templates/frontend/native/unistyles/unistyles.ts.hbs +27 -0
- package/templates/frontend/native/uniwind/_gitignore +21 -0
- package/templates/frontend/native/uniwind/app/(drawer)/(tabs)/_layout.tsx.hbs +46 -0
- package/templates/frontend/native/uniwind/app/(drawer)/(tabs)/index.tsx.hbs +15 -0
- package/templates/frontend/native/uniwind/app/(drawer)/(tabs)/two.tsx.hbs +15 -0
- package/templates/frontend/native/uniwind/app/(drawer)/_layout.tsx.hbs +91 -0
- package/templates/frontend/native/uniwind/app/(drawer)/index.tsx.hbs +191 -0
- package/templates/frontend/native/uniwind/app/+not-found.tsx.hbs +27 -0
- package/templates/frontend/native/uniwind/app/_layout.tsx.hbs +132 -0
- package/templates/frontend/native/uniwind/app/modal.tsx.hbs +37 -0
- package/templates/frontend/native/uniwind/app.json.hbs +19 -0
- package/templates/frontend/native/uniwind/components/container.tsx.hbs +33 -0
- package/templates/frontend/native/uniwind/components/theme-toggle.tsx.hbs +35 -0
- package/templates/frontend/native/uniwind/contexts/app-theme-context.tsx.hbs +62 -0
- package/templates/frontend/native/uniwind/global.css +5 -0
- package/templates/frontend/native/uniwind/metro.config.js.hbs +13 -0
- package/templates/frontend/native/uniwind/package.json.hbs +54 -0
- package/templates/frontend/native/uniwind/tsconfig.json.hbs +14 -0
- package/templates/frontend/nuxt/_gitignore +27 -0
- package/templates/frontend/nuxt/app/app.config.ts.hbs +15 -0
- package/templates/frontend/nuxt/app/app.vue.hbs +17 -0
- package/templates/frontend/nuxt/app/assets/css/main.css +2 -0
- package/templates/frontend/nuxt/app/components/Header.vue.hbs +40 -0
- package/templates/frontend/nuxt/app/layouts/default.vue.hbs +10 -0
- package/templates/frontend/nuxt/app/pages/index.vue.hbs +97 -0
- package/templates/frontend/nuxt/nuxt.config.ts.hbs +29 -0
- package/templates/frontend/nuxt/package.json.hbs +24 -0
- package/templates/frontend/nuxt/public/favicon.ico +0 -0
- package/templates/frontend/nuxt/public/robots.txt +2 -0
- package/templates/frontend/nuxt/server/tsconfig.json +3 -0
- package/templates/frontend/nuxt/tsconfig.json.hbs +18 -0
- package/templates/frontend/react/next/next-env.d.ts.hbs +5 -0
- package/templates/frontend/react/next/next.config.ts.hbs +22 -0
- package/templates/frontend/react/next/package.json.hbs +34 -0
- package/templates/frontend/react/next/postcss.config.mjs.hbs +5 -0
- package/templates/frontend/react/next/src/app/favicon.ico +0 -0
- package/templates/frontend/react/next/src/app/layout.tsx.hbs +76 -0
- package/templates/frontend/react/next/src/app/page.tsx.hbs +79 -0
- package/templates/frontend/react/next/src/components/mode-toggle.tsx.hbs +37 -0
- package/templates/frontend/react/next/src/components/providers.tsx.hbs +89 -0
- package/templates/frontend/react/next/src/components/theme-provider.tsx.hbs +11 -0
- package/templates/frontend/react/next/tsconfig.json.hbs +41 -0
- package/templates/frontend/react/react-router/package.json.hbs +42 -0
- package/templates/frontend/react/react-router/public/favicon.ico +0 -0
- package/templates/frontend/react/react-router/react-router.config.ts +6 -0
- package/templates/frontend/react/react-router/src/components/mode-toggle.tsx.hbs +29 -0
- package/templates/frontend/react/react-router/src/components/theme-provider.tsx.hbs +11 -0
- package/templates/frontend/react/react-router/src/root.tsx.hbs +190 -0
- package/templates/frontend/react/react-router/src/routes/_index.tsx.hbs +85 -0
- package/templates/frontend/react/react-router/src/routes.ts +4 -0
- package/templates/frontend/react/react-router/tsconfig.json.hbs +27 -0
- package/templates/frontend/react/react-router/vite.config.ts.hbs +12 -0
- package/templates/frontend/react/tanstack-router/index.html.hbs +13 -0
- package/templates/frontend/react/tanstack-router/package.json.hbs +41 -0
- package/templates/frontend/react/tanstack-router/src/components/mode-toggle.tsx.hbs +29 -0
- package/templates/frontend/react/tanstack-router/src/components/theme-provider.tsx.hbs +11 -0
- package/templates/frontend/react/tanstack-router/src/main.tsx.hbs +90 -0
- package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +103 -0
- package/templates/frontend/react/tanstack-router/src/routes/index.tsx.hbs +85 -0
- package/templates/frontend/react/tanstack-router/tsconfig.json.hbs +18 -0
- package/templates/frontend/react/tanstack-router/vite.config.ts.hbs +21 -0
- package/templates/frontend/react/tanstack-start/package.json.hbs +43 -0
- package/templates/frontend/react/tanstack-start/public/robots.txt +3 -0
- package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +144 -0
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +208 -0
- package/templates/frontend/react/tanstack-start/src/routes/index.tsx.hbs +85 -0
- package/templates/frontend/react/tanstack-start/tsconfig.json.hbs +28 -0
- package/templates/frontend/react/tanstack-start/vite.config.ts.hbs +22 -0
- package/templates/frontend/react/web-base/_gitignore +60 -0
- package/templates/frontend/react/web-base/components.json +24 -0
- package/templates/frontend/react/web-base/src/components/header.tsx.hbs +78 -0
- package/templates/frontend/react/web-base/src/components/loader.tsx.hbs +9 -0
- package/templates/frontend/react/web-base/src/components/ui/button.tsx.hbs +57 -0
- package/templates/frontend/react/web-base/src/components/ui/card.tsx.hbs +103 -0
- package/templates/frontend/react/web-base/src/components/ui/checkbox.tsx.hbs +26 -0
- package/templates/frontend/react/web-base/src/components/ui/dropdown-menu.tsx.hbs +262 -0
- package/templates/frontend/react/web-base/src/components/ui/input.tsx.hbs +20 -0
- package/templates/frontend/react/web-base/src/components/ui/label.tsx.hbs +20 -0
- package/templates/frontend/react/web-base/src/components/ui/skeleton.tsx.hbs +13 -0
- package/templates/frontend/react/web-base/src/components/ui/sonner.tsx.hbs +44 -0
- package/templates/frontend/react/web-base/src/index.css.hbs +131 -0
- package/templates/frontend/react/web-base/src/lib/utils.ts.hbs +6 -0
- package/templates/frontend/solid/_gitignore +11 -0
- package/templates/frontend/solid/index.html +13 -0
- package/templates/frontend/solid/package.json.hbs +24 -0
- package/templates/frontend/solid/public/robots.txt +3 -0
- package/templates/frontend/solid/src/components/header.tsx.hbs +38 -0
- package/templates/frontend/solid/src/components/loader.tsx +9 -0
- package/templates/frontend/solid/src/main.tsx.hbs +41 -0
- package/templates/frontend/solid/src/routes/__root.tsx.hbs +34 -0
- package/templates/frontend/solid/src/routes/index.tsx.hbs +72 -0
- package/templates/frontend/solid/src/styles.css +5 -0
- package/templates/frontend/solid/tsconfig.json.hbs +29 -0
- package/templates/frontend/solid/vite.config.ts.hbs +21 -0
- package/templates/frontend/svelte/_gitignore +24 -0
- package/templates/frontend/svelte/_npmrc +1 -0
- package/templates/frontend/svelte/package.json.hbs +27 -0
- package/templates/frontend/svelte/src/app.css +5 -0
- package/templates/frontend/svelte/src/app.d.ts +13 -0
- package/templates/frontend/svelte/src/app.html +12 -0
- package/templates/frontend/svelte/src/components/Header.svelte.hbs +40 -0
- package/templates/frontend/svelte/src/lib/index.ts +2 -0
- package/templates/frontend/svelte/src/routes/+layout.svelte.hbs +54 -0
- package/templates/frontend/svelte/src/routes/+page.svelte.hbs +92 -0
- package/templates/frontend/svelte/static/favicon.png +0 -0
- package/templates/frontend/svelte/svelte.config.js.hbs +18 -0
- package/templates/frontend/svelte/tsconfig.json.hbs +19 -0
- package/templates/frontend/svelte/vite.config.ts.hbs +7 -0
- package/templates/packages/config/package.json.hbs +5 -0
- package/templates/packages/config/tsconfig.base.json.hbs +33 -0
- package/templates/packages/env/env.d.ts.hbs +16 -0
- package/templates/packages/env/package.json.hbs +7 -0
- package/templates/packages/env/src/native.ts.hbs +21 -0
- package/templates/packages/env/src/server.ts.hbs +39 -0
- package/templates/packages/env/src/web.ts.hbs +98 -0
- package/templates/packages/env/tsconfig.json.hbs +3 -0
- package/templates/packages/infra/alchemy.run.ts.hbs +271 -0
- package/templates/packages/infra/package.json.hbs +10 -0
- package/templates/payments/polar/server/base/src/lib/payments.ts.hbs +7 -0
- package/templates/payments/polar/web/nuxt/app/pages/success.vue.hbs +11 -0
- package/templates/payments/polar/web/react/next/src/app/success/page.tsx.hbs +15 -0
- package/templates/payments/polar/web/react/react-router/src/routes/success.tsx.hbs +13 -0
- package/templates/payments/polar/web/react/tanstack-router/src/routes/success.tsx.hbs +19 -0
- package/templates/payments/polar/web/react/tanstack-start/src/functions/get-payment.ts.hbs +15 -0
- package/templates/payments/polar/web/react/tanstack-start/src/routes/success.tsx.hbs +19 -0
- package/templates/payments/polar/web/solid/src/routes/success.tsx.hbs +23 -0
- package/templates/payments/polar/web/svelte/src/routes/success/+page.svelte.hbs +12 -0
|
@@ -0,0 +1,2860 @@
|
|
|
1
|
+
import { dirname, extname, join } from "pathe";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import * as nativeFs$1 from "fs";
|
|
6
|
+
import nativeFs from "fs";
|
|
7
|
+
import path$1, { basename, dirname as dirname$1, normalize as normalize$1, posix, relative, resolve, sep } from "path";
|
|
8
|
+
import { fileURLToPath as fileURLToPath$1 } from "url";
|
|
9
|
+
import { createRequire } from "module";
|
|
10
|
+
|
|
11
|
+
//#region rolldown:runtime
|
|
12
|
+
var __create = Object.create;
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
17
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
22
|
+
key = keys[i];
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
24
|
+
__defProp(to, key, {
|
|
25
|
+
get: ((k) => from[k]).bind(null, key),
|
|
26
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
34
|
+
value: mod,
|
|
35
|
+
enumerable: true
|
|
36
|
+
}) : target, mod));
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region ../../node_modules/.bun/binary-extensions@3.1.0/node_modules/binary-extensions/binary-extensions.json
|
|
40
|
+
var binary_extensions_default$1 = [
|
|
41
|
+
"3dm",
|
|
42
|
+
"3ds",
|
|
43
|
+
"3g2",
|
|
44
|
+
"3gp",
|
|
45
|
+
"7z",
|
|
46
|
+
"a",
|
|
47
|
+
"aac",
|
|
48
|
+
"adp",
|
|
49
|
+
"afdesign",
|
|
50
|
+
"afphoto",
|
|
51
|
+
"afpub",
|
|
52
|
+
"ai",
|
|
53
|
+
"aif",
|
|
54
|
+
"aiff",
|
|
55
|
+
"alz",
|
|
56
|
+
"ape",
|
|
57
|
+
"apk",
|
|
58
|
+
"appimage",
|
|
59
|
+
"ar",
|
|
60
|
+
"arj",
|
|
61
|
+
"asf",
|
|
62
|
+
"au",
|
|
63
|
+
"avi",
|
|
64
|
+
"bak",
|
|
65
|
+
"baml",
|
|
66
|
+
"bh",
|
|
67
|
+
"bin",
|
|
68
|
+
"bk",
|
|
69
|
+
"bmp",
|
|
70
|
+
"btif",
|
|
71
|
+
"bz2",
|
|
72
|
+
"bzip2",
|
|
73
|
+
"cab",
|
|
74
|
+
"caf",
|
|
75
|
+
"cgm",
|
|
76
|
+
"class",
|
|
77
|
+
"cmx",
|
|
78
|
+
"cpio",
|
|
79
|
+
"cr2",
|
|
80
|
+
"cr3",
|
|
81
|
+
"cur",
|
|
82
|
+
"dat",
|
|
83
|
+
"dcm",
|
|
84
|
+
"deb",
|
|
85
|
+
"dex",
|
|
86
|
+
"djvu",
|
|
87
|
+
"dll",
|
|
88
|
+
"dmg",
|
|
89
|
+
"dng",
|
|
90
|
+
"doc",
|
|
91
|
+
"docm",
|
|
92
|
+
"docx",
|
|
93
|
+
"dot",
|
|
94
|
+
"dotm",
|
|
95
|
+
"dra",
|
|
96
|
+
"DS_Store",
|
|
97
|
+
"dsk",
|
|
98
|
+
"dts",
|
|
99
|
+
"dtshd",
|
|
100
|
+
"dvb",
|
|
101
|
+
"dwg",
|
|
102
|
+
"dxf",
|
|
103
|
+
"ecelp4800",
|
|
104
|
+
"ecelp7470",
|
|
105
|
+
"ecelp9600",
|
|
106
|
+
"egg",
|
|
107
|
+
"eol",
|
|
108
|
+
"eot",
|
|
109
|
+
"epub",
|
|
110
|
+
"exe",
|
|
111
|
+
"f4v",
|
|
112
|
+
"fbs",
|
|
113
|
+
"fh",
|
|
114
|
+
"fla",
|
|
115
|
+
"flac",
|
|
116
|
+
"flatpak",
|
|
117
|
+
"fli",
|
|
118
|
+
"flv",
|
|
119
|
+
"fpx",
|
|
120
|
+
"fst",
|
|
121
|
+
"fvt",
|
|
122
|
+
"g3",
|
|
123
|
+
"gh",
|
|
124
|
+
"gif",
|
|
125
|
+
"graffle",
|
|
126
|
+
"gz",
|
|
127
|
+
"gzip",
|
|
128
|
+
"h261",
|
|
129
|
+
"h263",
|
|
130
|
+
"h264",
|
|
131
|
+
"icns",
|
|
132
|
+
"ico",
|
|
133
|
+
"ief",
|
|
134
|
+
"img",
|
|
135
|
+
"ipa",
|
|
136
|
+
"iso",
|
|
137
|
+
"jar",
|
|
138
|
+
"jpeg",
|
|
139
|
+
"jpg",
|
|
140
|
+
"jpgv",
|
|
141
|
+
"jpm",
|
|
142
|
+
"jxr",
|
|
143
|
+
"key",
|
|
144
|
+
"ktx",
|
|
145
|
+
"lha",
|
|
146
|
+
"lib",
|
|
147
|
+
"lvp",
|
|
148
|
+
"lz",
|
|
149
|
+
"lzh",
|
|
150
|
+
"lzma",
|
|
151
|
+
"lzo",
|
|
152
|
+
"m3u",
|
|
153
|
+
"m4a",
|
|
154
|
+
"m4v",
|
|
155
|
+
"mar",
|
|
156
|
+
"mdi",
|
|
157
|
+
"mht",
|
|
158
|
+
"mid",
|
|
159
|
+
"midi",
|
|
160
|
+
"mj2",
|
|
161
|
+
"mka",
|
|
162
|
+
"mkv",
|
|
163
|
+
"mmr",
|
|
164
|
+
"mng",
|
|
165
|
+
"mobi",
|
|
166
|
+
"mov",
|
|
167
|
+
"movie",
|
|
168
|
+
"mp3",
|
|
169
|
+
"mp4",
|
|
170
|
+
"mp4a",
|
|
171
|
+
"mpeg",
|
|
172
|
+
"mpg",
|
|
173
|
+
"mpga",
|
|
174
|
+
"mxu",
|
|
175
|
+
"nef",
|
|
176
|
+
"npx",
|
|
177
|
+
"numbers",
|
|
178
|
+
"nupkg",
|
|
179
|
+
"o",
|
|
180
|
+
"odp",
|
|
181
|
+
"ods",
|
|
182
|
+
"odt",
|
|
183
|
+
"oga",
|
|
184
|
+
"ogg",
|
|
185
|
+
"ogv",
|
|
186
|
+
"otf",
|
|
187
|
+
"ott",
|
|
188
|
+
"pages",
|
|
189
|
+
"pbm",
|
|
190
|
+
"pcx",
|
|
191
|
+
"pdb",
|
|
192
|
+
"pdf",
|
|
193
|
+
"pea",
|
|
194
|
+
"pgm",
|
|
195
|
+
"pic",
|
|
196
|
+
"png",
|
|
197
|
+
"pnm",
|
|
198
|
+
"pot",
|
|
199
|
+
"potm",
|
|
200
|
+
"potx",
|
|
201
|
+
"ppa",
|
|
202
|
+
"ppam",
|
|
203
|
+
"ppm",
|
|
204
|
+
"pps",
|
|
205
|
+
"ppsm",
|
|
206
|
+
"ppsx",
|
|
207
|
+
"ppt",
|
|
208
|
+
"pptm",
|
|
209
|
+
"pptx",
|
|
210
|
+
"psd",
|
|
211
|
+
"pya",
|
|
212
|
+
"pyc",
|
|
213
|
+
"pyo",
|
|
214
|
+
"pyv",
|
|
215
|
+
"qt",
|
|
216
|
+
"rar",
|
|
217
|
+
"ras",
|
|
218
|
+
"raw",
|
|
219
|
+
"resources",
|
|
220
|
+
"rgb",
|
|
221
|
+
"rip",
|
|
222
|
+
"rlc",
|
|
223
|
+
"rmf",
|
|
224
|
+
"rmvb",
|
|
225
|
+
"rpm",
|
|
226
|
+
"rtf",
|
|
227
|
+
"rz",
|
|
228
|
+
"s3m",
|
|
229
|
+
"s7z",
|
|
230
|
+
"scpt",
|
|
231
|
+
"sgi",
|
|
232
|
+
"shar",
|
|
233
|
+
"snap",
|
|
234
|
+
"sil",
|
|
235
|
+
"sketch",
|
|
236
|
+
"slk",
|
|
237
|
+
"smv",
|
|
238
|
+
"snk",
|
|
239
|
+
"so",
|
|
240
|
+
"stl",
|
|
241
|
+
"suo",
|
|
242
|
+
"sub",
|
|
243
|
+
"swf",
|
|
244
|
+
"tar",
|
|
245
|
+
"tbz",
|
|
246
|
+
"tbz2",
|
|
247
|
+
"tga",
|
|
248
|
+
"tgz",
|
|
249
|
+
"thmx",
|
|
250
|
+
"tif",
|
|
251
|
+
"tiff",
|
|
252
|
+
"tlz",
|
|
253
|
+
"ttc",
|
|
254
|
+
"ttf",
|
|
255
|
+
"txz",
|
|
256
|
+
"udf",
|
|
257
|
+
"uvh",
|
|
258
|
+
"uvi",
|
|
259
|
+
"uvm",
|
|
260
|
+
"uvp",
|
|
261
|
+
"uvs",
|
|
262
|
+
"uvu",
|
|
263
|
+
"viv",
|
|
264
|
+
"vob",
|
|
265
|
+
"war",
|
|
266
|
+
"wav",
|
|
267
|
+
"wax",
|
|
268
|
+
"wbmp",
|
|
269
|
+
"wdp",
|
|
270
|
+
"weba",
|
|
271
|
+
"webm",
|
|
272
|
+
"webp",
|
|
273
|
+
"whl",
|
|
274
|
+
"wim",
|
|
275
|
+
"wm",
|
|
276
|
+
"wma",
|
|
277
|
+
"wmv",
|
|
278
|
+
"wmx",
|
|
279
|
+
"woff",
|
|
280
|
+
"woff2",
|
|
281
|
+
"wrm",
|
|
282
|
+
"wvx",
|
|
283
|
+
"xbm",
|
|
284
|
+
"xif",
|
|
285
|
+
"xla",
|
|
286
|
+
"xlam",
|
|
287
|
+
"xls",
|
|
288
|
+
"xlsb",
|
|
289
|
+
"xlsm",
|
|
290
|
+
"xlsx",
|
|
291
|
+
"xlt",
|
|
292
|
+
"xltm",
|
|
293
|
+
"xltx",
|
|
294
|
+
"xm",
|
|
295
|
+
"xmind",
|
|
296
|
+
"xpi",
|
|
297
|
+
"xpm",
|
|
298
|
+
"xwd",
|
|
299
|
+
"xz",
|
|
300
|
+
"z",
|
|
301
|
+
"zip",
|
|
302
|
+
"zipx"
|
|
303
|
+
];
|
|
304
|
+
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region ../../node_modules/.bun/binary-extensions@3.1.0/node_modules/binary-extensions/index.js
|
|
307
|
+
var binary_extensions_default = binary_extensions_default$1;
|
|
308
|
+
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region ../../node_modules/.bun/is-binary-path@3.0.0/node_modules/is-binary-path/index.js
|
|
311
|
+
const extensions = new Set(binary_extensions_default);
|
|
312
|
+
function isBinaryPath(filePath) {
|
|
313
|
+
return extensions.has(path.extname(filePath).slice(1).toLowerCase());
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region ../../node_modules/.bun/fdir@6.5.0+a185e370e160e74e/node_modules/fdir/dist/index.mjs
|
|
318
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
319
|
+
function cleanPath(path$2) {
|
|
320
|
+
let normalized = normalize$1(path$2);
|
|
321
|
+
if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
322
|
+
return normalized;
|
|
323
|
+
}
|
|
324
|
+
const SLASHES_REGEX = /[\\/]/g;
|
|
325
|
+
function convertSlashes(path$2, separator) {
|
|
326
|
+
return path$2.replace(SLASHES_REGEX, separator);
|
|
327
|
+
}
|
|
328
|
+
const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
329
|
+
function isRootDirectory(path$2) {
|
|
330
|
+
return path$2 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$2);
|
|
331
|
+
}
|
|
332
|
+
function normalizePath(path$2, options) {
|
|
333
|
+
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
|
|
334
|
+
const pathNeedsCleaning = process.platform === "win32" && path$2.includes("/") || path$2.startsWith(".");
|
|
335
|
+
if (resolvePaths) path$2 = resolve(path$2);
|
|
336
|
+
if (normalizePath$1 || pathNeedsCleaning) path$2 = cleanPath(path$2);
|
|
337
|
+
if (path$2 === ".") return "";
|
|
338
|
+
return convertSlashes(path$2[path$2.length - 1] !== pathSeparator ? path$2 + pathSeparator : path$2, pathSeparator);
|
|
339
|
+
}
|
|
340
|
+
function joinPathWithBasePath(filename, directoryPath) {
|
|
341
|
+
return directoryPath + filename;
|
|
342
|
+
}
|
|
343
|
+
function joinPathWithRelativePath(root, options) {
|
|
344
|
+
return function(filename, directoryPath) {
|
|
345
|
+
if (directoryPath.startsWith(root)) return directoryPath.slice(root.length) + filename;
|
|
346
|
+
else return convertSlashes(relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function joinPath(filename) {
|
|
350
|
+
return filename;
|
|
351
|
+
}
|
|
352
|
+
function joinDirectoryPath(filename, directoryPath, separator) {
|
|
353
|
+
return directoryPath + filename + separator;
|
|
354
|
+
}
|
|
355
|
+
function build$7(root, options) {
|
|
356
|
+
const { relativePaths, includeBasePath } = options;
|
|
357
|
+
return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
|
|
358
|
+
}
|
|
359
|
+
function pushDirectoryWithRelativePath(root) {
|
|
360
|
+
return function(directoryPath, paths) {
|
|
361
|
+
paths.push(directoryPath.substring(root.length) || ".");
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function pushDirectoryFilterWithRelativePath(root) {
|
|
365
|
+
return function(directoryPath, paths, filters) {
|
|
366
|
+
const relativePath = directoryPath.substring(root.length) || ".";
|
|
367
|
+
if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath);
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
const pushDirectory = (directoryPath, paths) => {
|
|
371
|
+
paths.push(directoryPath || ".");
|
|
372
|
+
};
|
|
373
|
+
const pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
374
|
+
const path$2 = directoryPath || ".";
|
|
375
|
+
if (filters.every((filter) => filter(path$2, true))) paths.push(path$2);
|
|
376
|
+
};
|
|
377
|
+
const empty$2 = () => {};
|
|
378
|
+
function build$6(root, options) {
|
|
379
|
+
const { includeDirs, filters, relativePaths } = options;
|
|
380
|
+
if (!includeDirs) return empty$2;
|
|
381
|
+
if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
|
|
382
|
+
return filters && filters.length ? pushDirectoryFilter : pushDirectory;
|
|
383
|
+
}
|
|
384
|
+
const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
|
|
385
|
+
if (filters.every((filter) => filter(filename, false))) counts.files++;
|
|
386
|
+
};
|
|
387
|
+
const pushFileFilter = (filename, paths, _counts, filters) => {
|
|
388
|
+
if (filters.every((filter) => filter(filename, false))) paths.push(filename);
|
|
389
|
+
};
|
|
390
|
+
const pushFileCount = (_filename, _paths, counts, _filters) => {
|
|
391
|
+
counts.files++;
|
|
392
|
+
};
|
|
393
|
+
const pushFile = (filename, paths) => {
|
|
394
|
+
paths.push(filename);
|
|
395
|
+
};
|
|
396
|
+
const empty$1 = () => {};
|
|
397
|
+
function build$5(options) {
|
|
398
|
+
const { excludeFiles, filters, onlyCounts } = options;
|
|
399
|
+
if (excludeFiles) return empty$1;
|
|
400
|
+
if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
|
|
401
|
+
else if (onlyCounts) return pushFileCount;
|
|
402
|
+
else return pushFile;
|
|
403
|
+
}
|
|
404
|
+
const getArray = (paths) => {
|
|
405
|
+
return paths;
|
|
406
|
+
};
|
|
407
|
+
const getArrayGroup = () => {
|
|
408
|
+
return [""].slice(0, 0);
|
|
409
|
+
};
|
|
410
|
+
function build$4(options) {
|
|
411
|
+
return options.group ? getArrayGroup : getArray;
|
|
412
|
+
}
|
|
413
|
+
const groupFiles = (groups, directory, files) => {
|
|
414
|
+
groups.push({
|
|
415
|
+
directory,
|
|
416
|
+
files,
|
|
417
|
+
dir: directory
|
|
418
|
+
});
|
|
419
|
+
};
|
|
420
|
+
const empty = () => {};
|
|
421
|
+
function build$3(options) {
|
|
422
|
+
return options.group ? groupFiles : empty;
|
|
423
|
+
}
|
|
424
|
+
const resolveSymlinksAsync = function(path$2, state, callback$1) {
|
|
425
|
+
const { queue, fs: fs$1, options: { suppressErrors } } = state;
|
|
426
|
+
queue.enqueue();
|
|
427
|
+
fs$1.realpath(path$2, (error, resolvedPath) => {
|
|
428
|
+
if (error) return queue.dequeue(suppressErrors ? null : error, state);
|
|
429
|
+
fs$1.stat(resolvedPath, (error$1, stat) => {
|
|
430
|
+
if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
431
|
+
if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return queue.dequeue(null, state);
|
|
432
|
+
callback$1(stat, resolvedPath);
|
|
433
|
+
queue.dequeue(null, state);
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
const resolveSymlinks = function(path$2, state, callback$1) {
|
|
438
|
+
const { queue, fs: fs$1, options: { suppressErrors } } = state;
|
|
439
|
+
queue.enqueue();
|
|
440
|
+
try {
|
|
441
|
+
const resolvedPath = fs$1.realpathSync(path$2);
|
|
442
|
+
const stat = fs$1.statSync(resolvedPath);
|
|
443
|
+
if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return;
|
|
444
|
+
callback$1(stat, resolvedPath);
|
|
445
|
+
} catch (e) {
|
|
446
|
+
if (!suppressErrors) throw e;
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
function build$2(options, isSynchronous) {
|
|
450
|
+
if (!options.resolveSymlinks || options.excludeSymlinks) return null;
|
|
451
|
+
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
452
|
+
}
|
|
453
|
+
function isRecursive(path$2, resolved, state) {
|
|
454
|
+
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
455
|
+
let parent = dirname$1(path$2);
|
|
456
|
+
let depth$1 = 1;
|
|
457
|
+
while (parent !== state.root && depth$1 < 2) {
|
|
458
|
+
const resolvedPath = state.symlinks.get(parent);
|
|
459
|
+
if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
|
|
460
|
+
else parent = dirname$1(parent);
|
|
461
|
+
}
|
|
462
|
+
state.symlinks.set(path$2, resolved);
|
|
463
|
+
return depth$1 > 1;
|
|
464
|
+
}
|
|
465
|
+
function isRecursiveUsingRealPaths(resolved, state) {
|
|
466
|
+
return state.visited.includes(resolved + state.options.pathSeparator);
|
|
467
|
+
}
|
|
468
|
+
const onlyCountsSync = (state) => {
|
|
469
|
+
return state.counts;
|
|
470
|
+
};
|
|
471
|
+
const groupsSync = (state) => {
|
|
472
|
+
return state.groups;
|
|
473
|
+
};
|
|
474
|
+
const defaultSync = (state) => {
|
|
475
|
+
return state.paths;
|
|
476
|
+
};
|
|
477
|
+
const limitFilesSync = (state) => {
|
|
478
|
+
return state.paths.slice(0, state.options.maxFiles);
|
|
479
|
+
};
|
|
480
|
+
const onlyCountsAsync = (state, error, callback$1) => {
|
|
481
|
+
report(error, callback$1, state.counts, state.options.suppressErrors);
|
|
482
|
+
return null;
|
|
483
|
+
};
|
|
484
|
+
const defaultAsync = (state, error, callback$1) => {
|
|
485
|
+
report(error, callback$1, state.paths, state.options.suppressErrors);
|
|
486
|
+
return null;
|
|
487
|
+
};
|
|
488
|
+
const limitFilesAsync = (state, error, callback$1) => {
|
|
489
|
+
report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
|
|
490
|
+
return null;
|
|
491
|
+
};
|
|
492
|
+
const groupsAsync = (state, error, callback$1) => {
|
|
493
|
+
report(error, callback$1, state.groups, state.options.suppressErrors);
|
|
494
|
+
return null;
|
|
495
|
+
};
|
|
496
|
+
function report(error, callback$1, output, suppressErrors) {
|
|
497
|
+
if (error && !suppressErrors) callback$1(error, output);
|
|
498
|
+
else callback$1(null, output);
|
|
499
|
+
}
|
|
500
|
+
function build$1(options, isSynchronous) {
|
|
501
|
+
const { onlyCounts, group, maxFiles } = options;
|
|
502
|
+
if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
|
|
503
|
+
else if (group) return isSynchronous ? groupsSync : groupsAsync;
|
|
504
|
+
else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
|
|
505
|
+
else return isSynchronous ? defaultSync : defaultAsync;
|
|
506
|
+
}
|
|
507
|
+
const readdirOpts = { withFileTypes: true };
|
|
508
|
+
const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
509
|
+
state.queue.enqueue();
|
|
510
|
+
if (currentDepth < 0) return state.queue.dequeue(null, state);
|
|
511
|
+
const { fs: fs$1 } = state;
|
|
512
|
+
state.visited.push(crawlPath);
|
|
513
|
+
state.counts.directories++;
|
|
514
|
+
fs$1.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
|
|
515
|
+
callback$1(entries, directoryPath, currentDepth);
|
|
516
|
+
state.queue.dequeue(state.options.suppressErrors ? null : error, state);
|
|
517
|
+
});
|
|
518
|
+
};
|
|
519
|
+
const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
520
|
+
const { fs: fs$1 } = state;
|
|
521
|
+
if (currentDepth < 0) return;
|
|
522
|
+
state.visited.push(crawlPath);
|
|
523
|
+
state.counts.directories++;
|
|
524
|
+
let entries = [];
|
|
525
|
+
try {
|
|
526
|
+
entries = fs$1.readdirSync(crawlPath || ".", readdirOpts);
|
|
527
|
+
} catch (e) {
|
|
528
|
+
if (!state.options.suppressErrors) throw e;
|
|
529
|
+
}
|
|
530
|
+
callback$1(entries, directoryPath, currentDepth);
|
|
531
|
+
};
|
|
532
|
+
function build(isSynchronous) {
|
|
533
|
+
return isSynchronous ? walkSync : walkAsync;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* This is a custom stateless queue to track concurrent async fs calls.
|
|
537
|
+
* It increments a counter whenever a call is queued and decrements it
|
|
538
|
+
* as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
|
|
539
|
+
*/
|
|
540
|
+
var Queue = class {
|
|
541
|
+
count = 0;
|
|
542
|
+
constructor(onQueueEmpty) {
|
|
543
|
+
this.onQueueEmpty = onQueueEmpty;
|
|
544
|
+
}
|
|
545
|
+
enqueue() {
|
|
546
|
+
this.count++;
|
|
547
|
+
return this.count;
|
|
548
|
+
}
|
|
549
|
+
dequeue(error, output) {
|
|
550
|
+
if (this.onQueueEmpty && (--this.count <= 0 || error)) {
|
|
551
|
+
this.onQueueEmpty(error, output);
|
|
552
|
+
if (error) {
|
|
553
|
+
output.controller.abort();
|
|
554
|
+
this.onQueueEmpty = void 0;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
var Counter = class {
|
|
560
|
+
_files = 0;
|
|
561
|
+
_directories = 0;
|
|
562
|
+
set files(num) {
|
|
563
|
+
this._files = num;
|
|
564
|
+
}
|
|
565
|
+
get files() {
|
|
566
|
+
return this._files;
|
|
567
|
+
}
|
|
568
|
+
set directories(num) {
|
|
569
|
+
this._directories = num;
|
|
570
|
+
}
|
|
571
|
+
get directories() {
|
|
572
|
+
return this._directories;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* @deprecated use `directories` instead
|
|
576
|
+
*/
|
|
577
|
+
/* c8 ignore next 3 */
|
|
578
|
+
get dirs() {
|
|
579
|
+
return this._directories;
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* AbortController is not supported on Node 14 so we use this until we can drop
|
|
584
|
+
* support for Node 14.
|
|
585
|
+
*/
|
|
586
|
+
var Aborter = class {
|
|
587
|
+
aborted = false;
|
|
588
|
+
abort() {
|
|
589
|
+
this.aborted = true;
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
var Walker = class {
|
|
593
|
+
root;
|
|
594
|
+
isSynchronous;
|
|
595
|
+
state;
|
|
596
|
+
joinPath;
|
|
597
|
+
pushDirectory;
|
|
598
|
+
pushFile;
|
|
599
|
+
getArray;
|
|
600
|
+
groupFiles;
|
|
601
|
+
resolveSymlink;
|
|
602
|
+
walkDirectory;
|
|
603
|
+
callbackInvoker;
|
|
604
|
+
constructor(root, options, callback$1) {
|
|
605
|
+
this.isSynchronous = !callback$1;
|
|
606
|
+
this.callbackInvoker = build$1(options, this.isSynchronous);
|
|
607
|
+
this.root = normalizePath(root, options);
|
|
608
|
+
this.state = {
|
|
609
|
+
root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
|
|
610
|
+
paths: [""].slice(0, 0),
|
|
611
|
+
groups: [],
|
|
612
|
+
counts: new Counter(),
|
|
613
|
+
options,
|
|
614
|
+
queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
|
|
615
|
+
symlinks: /* @__PURE__ */ new Map(),
|
|
616
|
+
visited: [""].slice(0, 0),
|
|
617
|
+
controller: new Aborter(),
|
|
618
|
+
fs: options.fs || nativeFs$1
|
|
619
|
+
};
|
|
620
|
+
this.joinPath = build$7(this.root, options);
|
|
621
|
+
this.pushDirectory = build$6(this.root, options);
|
|
622
|
+
this.pushFile = build$5(options);
|
|
623
|
+
this.getArray = build$4(options);
|
|
624
|
+
this.groupFiles = build$3(options);
|
|
625
|
+
this.resolveSymlink = build$2(options, this.isSynchronous);
|
|
626
|
+
this.walkDirectory = build(this.isSynchronous);
|
|
627
|
+
}
|
|
628
|
+
start() {
|
|
629
|
+
this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
|
|
630
|
+
this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
|
|
631
|
+
return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
|
|
632
|
+
}
|
|
633
|
+
walk = (entries, directoryPath, depth$1) => {
|
|
634
|
+
const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
|
|
635
|
+
if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
|
|
636
|
+
const files = this.getArray(this.state.paths);
|
|
637
|
+
for (let i = 0; i < entries.length; ++i) {
|
|
638
|
+
const entry = entries[i];
|
|
639
|
+
if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
|
|
640
|
+
const filename = this.joinPath(entry.name, directoryPath);
|
|
641
|
+
this.pushFile(filename, files, this.state.counts, filters);
|
|
642
|
+
} else if (entry.isDirectory()) {
|
|
643
|
+
let path$2 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
644
|
+
if (exclude && exclude(entry.name, path$2)) continue;
|
|
645
|
+
this.pushDirectory(path$2, paths, filters);
|
|
646
|
+
this.walkDirectory(this.state, path$2, path$2, depth$1 - 1, this.walk);
|
|
647
|
+
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
648
|
+
let path$2 = joinPathWithBasePath(entry.name, directoryPath);
|
|
649
|
+
this.resolveSymlink(path$2, this.state, (stat, resolvedPath) => {
|
|
650
|
+
if (stat.isDirectory()) {
|
|
651
|
+
resolvedPath = normalizePath(resolvedPath, this.state.options);
|
|
652
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$2 + pathSeparator)) return;
|
|
653
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$2 + pathSeparator, depth$1 - 1, this.walk);
|
|
654
|
+
} else {
|
|
655
|
+
resolvedPath = useRealPaths ? resolvedPath : path$2;
|
|
656
|
+
const filename = basename(resolvedPath);
|
|
657
|
+
const directoryPath$1 = normalizePath(dirname$1(resolvedPath), this.state.options);
|
|
658
|
+
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
659
|
+
this.pushFile(resolvedPath, files, this.state.counts, filters);
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
this.groupFiles(this.state.groups, directoryPath, files);
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
function promise(root, options) {
|
|
668
|
+
return new Promise((resolve$1, reject) => {
|
|
669
|
+
callback(root, options, (err, output) => {
|
|
670
|
+
if (err) return reject(err);
|
|
671
|
+
resolve$1(output);
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
function callback(root, options, callback$1) {
|
|
676
|
+
new Walker(root, options, callback$1).start();
|
|
677
|
+
}
|
|
678
|
+
function sync(root, options) {
|
|
679
|
+
return new Walker(root, options).start();
|
|
680
|
+
}
|
|
681
|
+
var APIBuilder = class {
|
|
682
|
+
constructor(root, options) {
|
|
683
|
+
this.root = root;
|
|
684
|
+
this.options = options;
|
|
685
|
+
}
|
|
686
|
+
withPromise() {
|
|
687
|
+
return promise(this.root, this.options);
|
|
688
|
+
}
|
|
689
|
+
withCallback(cb) {
|
|
690
|
+
callback(this.root, this.options, cb);
|
|
691
|
+
}
|
|
692
|
+
sync() {
|
|
693
|
+
return sync(this.root, this.options);
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
let pm = null;
|
|
697
|
+
/* c8 ignore next 6 */
|
|
698
|
+
try {
|
|
699
|
+
__require.resolve("picomatch");
|
|
700
|
+
pm = __require("picomatch");
|
|
701
|
+
} catch {}
|
|
702
|
+
var Builder = class {
|
|
703
|
+
globCache = {};
|
|
704
|
+
options = {
|
|
705
|
+
maxDepth: Infinity,
|
|
706
|
+
suppressErrors: true,
|
|
707
|
+
pathSeparator: sep,
|
|
708
|
+
filters: []
|
|
709
|
+
};
|
|
710
|
+
globFunction;
|
|
711
|
+
constructor(options) {
|
|
712
|
+
this.options = {
|
|
713
|
+
...this.options,
|
|
714
|
+
...options
|
|
715
|
+
};
|
|
716
|
+
this.globFunction = this.options.globFunction;
|
|
717
|
+
}
|
|
718
|
+
group() {
|
|
719
|
+
this.options.group = true;
|
|
720
|
+
return this;
|
|
721
|
+
}
|
|
722
|
+
withPathSeparator(separator) {
|
|
723
|
+
this.options.pathSeparator = separator;
|
|
724
|
+
return this;
|
|
725
|
+
}
|
|
726
|
+
withBasePath() {
|
|
727
|
+
this.options.includeBasePath = true;
|
|
728
|
+
return this;
|
|
729
|
+
}
|
|
730
|
+
withRelativePaths() {
|
|
731
|
+
this.options.relativePaths = true;
|
|
732
|
+
return this;
|
|
733
|
+
}
|
|
734
|
+
withDirs() {
|
|
735
|
+
this.options.includeDirs = true;
|
|
736
|
+
return this;
|
|
737
|
+
}
|
|
738
|
+
withMaxDepth(depth$1) {
|
|
739
|
+
this.options.maxDepth = depth$1;
|
|
740
|
+
return this;
|
|
741
|
+
}
|
|
742
|
+
withMaxFiles(limit) {
|
|
743
|
+
this.options.maxFiles = limit;
|
|
744
|
+
return this;
|
|
745
|
+
}
|
|
746
|
+
withFullPaths() {
|
|
747
|
+
this.options.resolvePaths = true;
|
|
748
|
+
this.options.includeBasePath = true;
|
|
749
|
+
return this;
|
|
750
|
+
}
|
|
751
|
+
withErrors() {
|
|
752
|
+
this.options.suppressErrors = false;
|
|
753
|
+
return this;
|
|
754
|
+
}
|
|
755
|
+
withSymlinks({ resolvePaths = true } = {}) {
|
|
756
|
+
this.options.resolveSymlinks = true;
|
|
757
|
+
this.options.useRealPaths = resolvePaths;
|
|
758
|
+
return this.withFullPaths();
|
|
759
|
+
}
|
|
760
|
+
withAbortSignal(signal) {
|
|
761
|
+
this.options.signal = signal;
|
|
762
|
+
return this;
|
|
763
|
+
}
|
|
764
|
+
normalize() {
|
|
765
|
+
this.options.normalizePath = true;
|
|
766
|
+
return this;
|
|
767
|
+
}
|
|
768
|
+
filter(predicate) {
|
|
769
|
+
this.options.filters.push(predicate);
|
|
770
|
+
return this;
|
|
771
|
+
}
|
|
772
|
+
onlyDirs() {
|
|
773
|
+
this.options.excludeFiles = true;
|
|
774
|
+
this.options.includeDirs = true;
|
|
775
|
+
return this;
|
|
776
|
+
}
|
|
777
|
+
exclude(predicate) {
|
|
778
|
+
this.options.exclude = predicate;
|
|
779
|
+
return this;
|
|
780
|
+
}
|
|
781
|
+
onlyCounts() {
|
|
782
|
+
this.options.onlyCounts = true;
|
|
783
|
+
return this;
|
|
784
|
+
}
|
|
785
|
+
crawl(root) {
|
|
786
|
+
return new APIBuilder(root || ".", this.options);
|
|
787
|
+
}
|
|
788
|
+
withGlobFunction(fn) {
|
|
789
|
+
this.globFunction = fn;
|
|
790
|
+
return this;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* @deprecated Pass options using the constructor instead:
|
|
794
|
+
* ```ts
|
|
795
|
+
* new fdir(options).crawl("/path/to/root");
|
|
796
|
+
* ```
|
|
797
|
+
* This method will be removed in v7.0
|
|
798
|
+
*/
|
|
799
|
+
/* c8 ignore next 4 */
|
|
800
|
+
crawlWithOptions(root, options) {
|
|
801
|
+
this.options = {
|
|
802
|
+
...this.options,
|
|
803
|
+
...options
|
|
804
|
+
};
|
|
805
|
+
return new APIBuilder(root || ".", this.options);
|
|
806
|
+
}
|
|
807
|
+
glob(...patterns) {
|
|
808
|
+
if (this.globFunction) return this.globWithOptions(patterns);
|
|
809
|
+
return this.globWithOptions(patterns, ...[{ dot: true }]);
|
|
810
|
+
}
|
|
811
|
+
globWithOptions(patterns, ...options) {
|
|
812
|
+
const globFn = this.globFunction || pm;
|
|
813
|
+
/* c8 ignore next 5 */
|
|
814
|
+
if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
|
|
815
|
+
var isMatch = this.globCache[patterns.join("\0")];
|
|
816
|
+
if (!isMatch) {
|
|
817
|
+
isMatch = globFn(patterns, ...options);
|
|
818
|
+
this.globCache[patterns.join("\0")] = isMatch;
|
|
819
|
+
}
|
|
820
|
+
this.options.filters.push((path$2) => isMatch(path$2));
|
|
821
|
+
return this;
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
//#endregion
|
|
826
|
+
//#region ../../node_modules/.bun/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
|
|
827
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
828
|
+
const WIN_SLASH = "\\\\/";
|
|
829
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
830
|
+
/**
|
|
831
|
+
* Posix glob regex
|
|
832
|
+
*/
|
|
833
|
+
const DOT_LITERAL = "\\.";
|
|
834
|
+
const PLUS_LITERAL = "\\+";
|
|
835
|
+
const QMARK_LITERAL = "\\?";
|
|
836
|
+
const SLASH_LITERAL = "\\/";
|
|
837
|
+
const ONE_CHAR = "(?=.)";
|
|
838
|
+
const QMARK = "[^/]";
|
|
839
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
840
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
841
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
842
|
+
const POSIX_CHARS = {
|
|
843
|
+
DOT_LITERAL,
|
|
844
|
+
PLUS_LITERAL,
|
|
845
|
+
QMARK_LITERAL,
|
|
846
|
+
SLASH_LITERAL,
|
|
847
|
+
ONE_CHAR,
|
|
848
|
+
QMARK,
|
|
849
|
+
END_ANCHOR,
|
|
850
|
+
DOTS_SLASH,
|
|
851
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
852
|
+
NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
|
|
853
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
|
|
854
|
+
NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
|
|
855
|
+
QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
|
|
856
|
+
STAR: `${QMARK}*?`,
|
|
857
|
+
START_ANCHOR,
|
|
858
|
+
SEP: "/"
|
|
859
|
+
};
|
|
860
|
+
/**
|
|
861
|
+
* Windows glob regex
|
|
862
|
+
*/
|
|
863
|
+
const WINDOWS_CHARS = {
|
|
864
|
+
...POSIX_CHARS,
|
|
865
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
866
|
+
QMARK: WIN_NO_SLASH,
|
|
867
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
868
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
869
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
870
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
871
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
872
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
873
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
874
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
875
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
876
|
+
SEP: "\\"
|
|
877
|
+
};
|
|
878
|
+
/**
|
|
879
|
+
* POSIX Bracket Regex
|
|
880
|
+
*/
|
|
881
|
+
const POSIX_REGEX_SOURCE$1 = {
|
|
882
|
+
alnum: "a-zA-Z0-9",
|
|
883
|
+
alpha: "a-zA-Z",
|
|
884
|
+
ascii: "\\x00-\\x7F",
|
|
885
|
+
blank: " \\t",
|
|
886
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
887
|
+
digit: "0-9",
|
|
888
|
+
graph: "\\x21-\\x7E",
|
|
889
|
+
lower: "a-z",
|
|
890
|
+
print: "\\x20-\\x7E ",
|
|
891
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
892
|
+
space: " \\t\\r\\n\\v\\f",
|
|
893
|
+
upper: "A-Z",
|
|
894
|
+
word: "A-Za-z0-9_",
|
|
895
|
+
xdigit: "A-Fa-f0-9"
|
|
896
|
+
};
|
|
897
|
+
module.exports = {
|
|
898
|
+
MAX_LENGTH: 1024 * 64,
|
|
899
|
+
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
900
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
901
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
902
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
903
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
904
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
905
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
906
|
+
REPLACEMENTS: {
|
|
907
|
+
__proto__: null,
|
|
908
|
+
"***": "*",
|
|
909
|
+
"**/**": "**",
|
|
910
|
+
"**/**/**": "**"
|
|
911
|
+
},
|
|
912
|
+
CHAR_0: 48,
|
|
913
|
+
CHAR_9: 57,
|
|
914
|
+
CHAR_UPPERCASE_A: 65,
|
|
915
|
+
CHAR_LOWERCASE_A: 97,
|
|
916
|
+
CHAR_UPPERCASE_Z: 90,
|
|
917
|
+
CHAR_LOWERCASE_Z: 122,
|
|
918
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
919
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
920
|
+
CHAR_ASTERISK: 42,
|
|
921
|
+
CHAR_AMPERSAND: 38,
|
|
922
|
+
CHAR_AT: 64,
|
|
923
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
924
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
925
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
926
|
+
CHAR_COLON: 58,
|
|
927
|
+
CHAR_COMMA: 44,
|
|
928
|
+
CHAR_DOT: 46,
|
|
929
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
930
|
+
CHAR_EQUAL: 61,
|
|
931
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
932
|
+
CHAR_FORM_FEED: 12,
|
|
933
|
+
CHAR_FORWARD_SLASH: 47,
|
|
934
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
935
|
+
CHAR_HASH: 35,
|
|
936
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
937
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
938
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
939
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
940
|
+
CHAR_LINE_FEED: 10,
|
|
941
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
942
|
+
CHAR_PERCENT: 37,
|
|
943
|
+
CHAR_PLUS: 43,
|
|
944
|
+
CHAR_QUESTION_MARK: 63,
|
|
945
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
946
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
947
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
948
|
+
CHAR_SEMICOLON: 59,
|
|
949
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
950
|
+
CHAR_SPACE: 32,
|
|
951
|
+
CHAR_TAB: 9,
|
|
952
|
+
CHAR_UNDERSCORE: 95,
|
|
953
|
+
CHAR_VERTICAL_LINE: 124,
|
|
954
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
955
|
+
extglobChars(chars) {
|
|
956
|
+
return {
|
|
957
|
+
"!": {
|
|
958
|
+
type: "negate",
|
|
959
|
+
open: "(?:(?!(?:",
|
|
960
|
+
close: `))${chars.STAR})`
|
|
961
|
+
},
|
|
962
|
+
"?": {
|
|
963
|
+
type: "qmark",
|
|
964
|
+
open: "(?:",
|
|
965
|
+
close: ")?"
|
|
966
|
+
},
|
|
967
|
+
"+": {
|
|
968
|
+
type: "plus",
|
|
969
|
+
open: "(?:",
|
|
970
|
+
close: ")+"
|
|
971
|
+
},
|
|
972
|
+
"*": {
|
|
973
|
+
type: "star",
|
|
974
|
+
open: "(?:",
|
|
975
|
+
close: ")*"
|
|
976
|
+
},
|
|
977
|
+
"@": {
|
|
978
|
+
type: "at",
|
|
979
|
+
open: "(?:",
|
|
980
|
+
close: ")"
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
},
|
|
984
|
+
globChars(win32) {
|
|
985
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
}));
|
|
989
|
+
|
|
990
|
+
//#endregion
|
|
991
|
+
//#region ../../node_modules/.bun/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
|
|
992
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
993
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
994
|
+
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
995
|
+
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
996
|
+
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
997
|
+
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
998
|
+
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
999
|
+
exports.isWindows = () => {
|
|
1000
|
+
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
1001
|
+
const platform = navigator.platform.toLowerCase();
|
|
1002
|
+
return platform === "win32" || platform === "windows";
|
|
1003
|
+
}
|
|
1004
|
+
if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
|
|
1005
|
+
return false;
|
|
1006
|
+
};
|
|
1007
|
+
exports.removeBackslashes = (str) => {
|
|
1008
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
1009
|
+
return match === "\\" ? "" : match;
|
|
1010
|
+
});
|
|
1011
|
+
};
|
|
1012
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
1013
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
1014
|
+
if (idx === -1) return input;
|
|
1015
|
+
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
1016
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
1017
|
+
};
|
|
1018
|
+
exports.removePrefix = (input, state = {}) => {
|
|
1019
|
+
let output = input;
|
|
1020
|
+
if (output.startsWith("./")) {
|
|
1021
|
+
output = output.slice(2);
|
|
1022
|
+
state.prefix = "./";
|
|
1023
|
+
}
|
|
1024
|
+
return output;
|
|
1025
|
+
};
|
|
1026
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
1027
|
+
let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
|
|
1028
|
+
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
|
1029
|
+
return output;
|
|
1030
|
+
};
|
|
1031
|
+
exports.basename = (path$2, { windows } = {}) => {
|
|
1032
|
+
const segs = path$2.split(windows ? /[\\/]/ : "/");
|
|
1033
|
+
const last = segs[segs.length - 1];
|
|
1034
|
+
if (last === "") return segs[segs.length - 2];
|
|
1035
|
+
return last;
|
|
1036
|
+
};
|
|
1037
|
+
}));
|
|
1038
|
+
|
|
1039
|
+
//#endregion
|
|
1040
|
+
//#region ../../node_modules/.bun/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
|
|
1041
|
+
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1042
|
+
const utils$3 = require_utils();
|
|
1043
|
+
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
1044
|
+
const isPathSeparator = (code) => {
|
|
1045
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
1046
|
+
};
|
|
1047
|
+
const depth = (token) => {
|
|
1048
|
+
if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
|
|
1049
|
+
};
|
|
1050
|
+
/**
|
|
1051
|
+
* Quickly scans a glob pattern and returns an object with a handful of
|
|
1052
|
+
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
1053
|
+
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
1054
|
+
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
1055
|
+
*
|
|
1056
|
+
* ```js
|
|
1057
|
+
* const pm = require('picomatch');
|
|
1058
|
+
* console.log(pm.scan('foo/bar/*.js'));
|
|
1059
|
+
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
1060
|
+
* ```
|
|
1061
|
+
* @param {String} `str`
|
|
1062
|
+
* @param {Object} `options`
|
|
1063
|
+
* @return {Object} Returns an object with tokens and regex source string.
|
|
1064
|
+
* @api public
|
|
1065
|
+
*/
|
|
1066
|
+
const scan$1 = (input, options) => {
|
|
1067
|
+
const opts = options || {};
|
|
1068
|
+
const length = input.length - 1;
|
|
1069
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
1070
|
+
const slashes = [];
|
|
1071
|
+
const tokens = [];
|
|
1072
|
+
const parts = [];
|
|
1073
|
+
let str = input;
|
|
1074
|
+
let index = -1;
|
|
1075
|
+
let start = 0;
|
|
1076
|
+
let lastIndex = 0;
|
|
1077
|
+
let isBrace = false;
|
|
1078
|
+
let isBracket = false;
|
|
1079
|
+
let isGlob = false;
|
|
1080
|
+
let isExtglob = false;
|
|
1081
|
+
let isGlobstar = false;
|
|
1082
|
+
let braceEscaped = false;
|
|
1083
|
+
let backslashes = false;
|
|
1084
|
+
let negated = false;
|
|
1085
|
+
let negatedExtglob = false;
|
|
1086
|
+
let finished = false;
|
|
1087
|
+
let braces = 0;
|
|
1088
|
+
let prev;
|
|
1089
|
+
let code;
|
|
1090
|
+
let token = {
|
|
1091
|
+
value: "",
|
|
1092
|
+
depth: 0,
|
|
1093
|
+
isGlob: false
|
|
1094
|
+
};
|
|
1095
|
+
const eos = () => index >= length;
|
|
1096
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
1097
|
+
const advance = () => {
|
|
1098
|
+
prev = code;
|
|
1099
|
+
return str.charCodeAt(++index);
|
|
1100
|
+
};
|
|
1101
|
+
while (index < length) {
|
|
1102
|
+
code = advance();
|
|
1103
|
+
let next;
|
|
1104
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1105
|
+
backslashes = token.backslashes = true;
|
|
1106
|
+
code = advance();
|
|
1107
|
+
if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
|
|
1108
|
+
continue;
|
|
1109
|
+
}
|
|
1110
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
1111
|
+
braces++;
|
|
1112
|
+
while (eos() !== true && (code = advance())) {
|
|
1113
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1114
|
+
backslashes = token.backslashes = true;
|
|
1115
|
+
advance();
|
|
1116
|
+
continue;
|
|
1117
|
+
}
|
|
1118
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1119
|
+
braces++;
|
|
1120
|
+
continue;
|
|
1121
|
+
}
|
|
1122
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
1123
|
+
isBrace = token.isBrace = true;
|
|
1124
|
+
isGlob = token.isGlob = true;
|
|
1125
|
+
finished = true;
|
|
1126
|
+
if (scanToEnd === true) continue;
|
|
1127
|
+
break;
|
|
1128
|
+
}
|
|
1129
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
1130
|
+
isBrace = token.isBrace = true;
|
|
1131
|
+
isGlob = token.isGlob = true;
|
|
1132
|
+
finished = true;
|
|
1133
|
+
if (scanToEnd === true) continue;
|
|
1134
|
+
break;
|
|
1135
|
+
}
|
|
1136
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
1137
|
+
braces--;
|
|
1138
|
+
if (braces === 0) {
|
|
1139
|
+
braceEscaped = false;
|
|
1140
|
+
isBrace = token.isBrace = true;
|
|
1141
|
+
finished = true;
|
|
1142
|
+
break;
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
if (scanToEnd === true) continue;
|
|
1147
|
+
break;
|
|
1148
|
+
}
|
|
1149
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
1150
|
+
slashes.push(index);
|
|
1151
|
+
tokens.push(token);
|
|
1152
|
+
token = {
|
|
1153
|
+
value: "",
|
|
1154
|
+
depth: 0,
|
|
1155
|
+
isGlob: false
|
|
1156
|
+
};
|
|
1157
|
+
if (finished === true) continue;
|
|
1158
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
1159
|
+
start += 2;
|
|
1160
|
+
continue;
|
|
1161
|
+
}
|
|
1162
|
+
lastIndex = index + 1;
|
|
1163
|
+
continue;
|
|
1164
|
+
}
|
|
1165
|
+
if (opts.noext !== true) {
|
|
1166
|
+
if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
1167
|
+
isGlob = token.isGlob = true;
|
|
1168
|
+
isExtglob = token.isExtglob = true;
|
|
1169
|
+
finished = true;
|
|
1170
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
|
1171
|
+
if (scanToEnd === true) {
|
|
1172
|
+
while (eos() !== true && (code = advance())) {
|
|
1173
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1174
|
+
backslashes = token.backslashes = true;
|
|
1175
|
+
code = advance();
|
|
1176
|
+
continue;
|
|
1177
|
+
}
|
|
1178
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1179
|
+
isGlob = token.isGlob = true;
|
|
1180
|
+
finished = true;
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
continue;
|
|
1185
|
+
}
|
|
1186
|
+
break;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
if (code === CHAR_ASTERISK) {
|
|
1190
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
1191
|
+
isGlob = token.isGlob = true;
|
|
1192
|
+
finished = true;
|
|
1193
|
+
if (scanToEnd === true) continue;
|
|
1194
|
+
break;
|
|
1195
|
+
}
|
|
1196
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
1197
|
+
isGlob = token.isGlob = true;
|
|
1198
|
+
finished = true;
|
|
1199
|
+
if (scanToEnd === true) continue;
|
|
1200
|
+
break;
|
|
1201
|
+
}
|
|
1202
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
1203
|
+
while (eos() !== true && (next = advance())) {
|
|
1204
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
1205
|
+
backslashes = token.backslashes = true;
|
|
1206
|
+
advance();
|
|
1207
|
+
continue;
|
|
1208
|
+
}
|
|
1209
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
1210
|
+
isBracket = token.isBracket = true;
|
|
1211
|
+
isGlob = token.isGlob = true;
|
|
1212
|
+
finished = true;
|
|
1213
|
+
break;
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
if (scanToEnd === true) continue;
|
|
1217
|
+
break;
|
|
1218
|
+
}
|
|
1219
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1220
|
+
negated = token.negated = true;
|
|
1221
|
+
start++;
|
|
1222
|
+
continue;
|
|
1223
|
+
}
|
|
1224
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
1225
|
+
isGlob = token.isGlob = true;
|
|
1226
|
+
if (scanToEnd === true) {
|
|
1227
|
+
while (eos() !== true && (code = advance())) {
|
|
1228
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1229
|
+
backslashes = token.backslashes = true;
|
|
1230
|
+
code = advance();
|
|
1231
|
+
continue;
|
|
1232
|
+
}
|
|
1233
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1234
|
+
finished = true;
|
|
1235
|
+
break;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
continue;
|
|
1239
|
+
}
|
|
1240
|
+
break;
|
|
1241
|
+
}
|
|
1242
|
+
if (isGlob === true) {
|
|
1243
|
+
finished = true;
|
|
1244
|
+
if (scanToEnd === true) continue;
|
|
1245
|
+
break;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
if (opts.noext === true) {
|
|
1249
|
+
isExtglob = false;
|
|
1250
|
+
isGlob = false;
|
|
1251
|
+
}
|
|
1252
|
+
let base = str;
|
|
1253
|
+
let prefix = "";
|
|
1254
|
+
let glob$1 = "";
|
|
1255
|
+
if (start > 0) {
|
|
1256
|
+
prefix = str.slice(0, start);
|
|
1257
|
+
str = str.slice(start);
|
|
1258
|
+
lastIndex -= start;
|
|
1259
|
+
}
|
|
1260
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
1261
|
+
base = str.slice(0, lastIndex);
|
|
1262
|
+
glob$1 = str.slice(lastIndex);
|
|
1263
|
+
} else if (isGlob === true) {
|
|
1264
|
+
base = "";
|
|
1265
|
+
glob$1 = str;
|
|
1266
|
+
} else base = str;
|
|
1267
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
1268
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
|
|
1269
|
+
}
|
|
1270
|
+
if (opts.unescape === true) {
|
|
1271
|
+
if (glob$1) glob$1 = utils$3.removeBackslashes(glob$1);
|
|
1272
|
+
if (base && backslashes === true) base = utils$3.removeBackslashes(base);
|
|
1273
|
+
}
|
|
1274
|
+
const state = {
|
|
1275
|
+
prefix,
|
|
1276
|
+
input,
|
|
1277
|
+
start,
|
|
1278
|
+
base,
|
|
1279
|
+
glob: glob$1,
|
|
1280
|
+
isBrace,
|
|
1281
|
+
isBracket,
|
|
1282
|
+
isGlob,
|
|
1283
|
+
isExtglob,
|
|
1284
|
+
isGlobstar,
|
|
1285
|
+
negated,
|
|
1286
|
+
negatedExtglob
|
|
1287
|
+
};
|
|
1288
|
+
if (opts.tokens === true) {
|
|
1289
|
+
state.maxDepth = 0;
|
|
1290
|
+
if (!isPathSeparator(code)) tokens.push(token);
|
|
1291
|
+
state.tokens = tokens;
|
|
1292
|
+
}
|
|
1293
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
1294
|
+
let prevIndex;
|
|
1295
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
1296
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
1297
|
+
const i = slashes[idx];
|
|
1298
|
+
const value = input.slice(n, i);
|
|
1299
|
+
if (opts.tokens) {
|
|
1300
|
+
if (idx === 0 && start !== 0) {
|
|
1301
|
+
tokens[idx].isPrefix = true;
|
|
1302
|
+
tokens[idx].value = prefix;
|
|
1303
|
+
} else tokens[idx].value = value;
|
|
1304
|
+
depth(tokens[idx]);
|
|
1305
|
+
state.maxDepth += tokens[idx].depth;
|
|
1306
|
+
}
|
|
1307
|
+
if (idx !== 0 || value !== "") parts.push(value);
|
|
1308
|
+
prevIndex = i;
|
|
1309
|
+
}
|
|
1310
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
1311
|
+
const value = input.slice(prevIndex + 1);
|
|
1312
|
+
parts.push(value);
|
|
1313
|
+
if (opts.tokens) {
|
|
1314
|
+
tokens[tokens.length - 1].value = value;
|
|
1315
|
+
depth(tokens[tokens.length - 1]);
|
|
1316
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
state.slashes = slashes;
|
|
1320
|
+
state.parts = parts;
|
|
1321
|
+
}
|
|
1322
|
+
return state;
|
|
1323
|
+
};
|
|
1324
|
+
module.exports = scan$1;
|
|
1325
|
+
}));
|
|
1326
|
+
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region ../../node_modules/.bun/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
|
|
1329
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1330
|
+
const constants$1 = require_constants();
|
|
1331
|
+
const utils$2 = require_utils();
|
|
1332
|
+
/**
|
|
1333
|
+
* Constants
|
|
1334
|
+
*/
|
|
1335
|
+
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1;
|
|
1336
|
+
/**
|
|
1337
|
+
* Helpers
|
|
1338
|
+
*/
|
|
1339
|
+
const expandRange = (args, options) => {
|
|
1340
|
+
if (typeof options.expandRange === "function") return options.expandRange(...args, options);
|
|
1341
|
+
args.sort();
|
|
1342
|
+
const value = `[${args.join("-")}]`;
|
|
1343
|
+
try {
|
|
1344
|
+
new RegExp(value);
|
|
1345
|
+
} catch (ex) {
|
|
1346
|
+
return args.map((v) => utils$2.escapeRegex(v)).join("..");
|
|
1347
|
+
}
|
|
1348
|
+
return value;
|
|
1349
|
+
};
|
|
1350
|
+
/**
|
|
1351
|
+
* Create the message for a syntax error
|
|
1352
|
+
*/
|
|
1353
|
+
const syntaxError = (type, char) => {
|
|
1354
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
1355
|
+
};
|
|
1356
|
+
/**
|
|
1357
|
+
* Parse the given input string.
|
|
1358
|
+
* @param {String} input
|
|
1359
|
+
* @param {Object} options
|
|
1360
|
+
* @return {Object}
|
|
1361
|
+
*/
|
|
1362
|
+
const parse$1 = (input, options) => {
|
|
1363
|
+
if (typeof input !== "string") throw new TypeError("Expected a string");
|
|
1364
|
+
input = REPLACEMENTS[input] || input;
|
|
1365
|
+
const opts = { ...options };
|
|
1366
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1367
|
+
let len = input.length;
|
|
1368
|
+
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1369
|
+
const bos = {
|
|
1370
|
+
type: "bos",
|
|
1371
|
+
value: "",
|
|
1372
|
+
output: opts.prepend || ""
|
|
1373
|
+
};
|
|
1374
|
+
const tokens = [bos];
|
|
1375
|
+
const capture = opts.capture ? "" : "?:";
|
|
1376
|
+
const PLATFORM_CHARS = constants$1.globChars(opts.windows);
|
|
1377
|
+
const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
|
|
1378
|
+
const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK: QMARK$1, QMARK_NO_DOT, STAR, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
|
|
1379
|
+
const globstar = (opts$1) => {
|
|
1380
|
+
return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
|
|
1381
|
+
};
|
|
1382
|
+
const nodot = opts.dot ? "" : NO_DOT;
|
|
1383
|
+
const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT;
|
|
1384
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
1385
|
+
if (opts.capture) star = `(${star})`;
|
|
1386
|
+
if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
|
|
1387
|
+
const state = {
|
|
1388
|
+
input,
|
|
1389
|
+
index: -1,
|
|
1390
|
+
start: 0,
|
|
1391
|
+
dot: opts.dot === true,
|
|
1392
|
+
consumed: "",
|
|
1393
|
+
output: "",
|
|
1394
|
+
prefix: "",
|
|
1395
|
+
backtrack: false,
|
|
1396
|
+
negated: false,
|
|
1397
|
+
brackets: 0,
|
|
1398
|
+
braces: 0,
|
|
1399
|
+
parens: 0,
|
|
1400
|
+
quotes: 0,
|
|
1401
|
+
globstar: false,
|
|
1402
|
+
tokens
|
|
1403
|
+
};
|
|
1404
|
+
input = utils$2.removePrefix(input, state);
|
|
1405
|
+
len = input.length;
|
|
1406
|
+
const extglobs = [];
|
|
1407
|
+
const braces = [];
|
|
1408
|
+
const stack = [];
|
|
1409
|
+
let prev = bos;
|
|
1410
|
+
let value;
|
|
1411
|
+
/**
|
|
1412
|
+
* Tokenizing helpers
|
|
1413
|
+
*/
|
|
1414
|
+
const eos = () => state.index === len - 1;
|
|
1415
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
1416
|
+
const advance = state.advance = () => input[++state.index] || "";
|
|
1417
|
+
const remaining = () => input.slice(state.index + 1);
|
|
1418
|
+
const consume = (value$1 = "", num = 0) => {
|
|
1419
|
+
state.consumed += value$1;
|
|
1420
|
+
state.index += num;
|
|
1421
|
+
};
|
|
1422
|
+
const append = (token) => {
|
|
1423
|
+
state.output += token.output != null ? token.output : token.value;
|
|
1424
|
+
consume(token.value);
|
|
1425
|
+
};
|
|
1426
|
+
const negate = () => {
|
|
1427
|
+
let count = 1;
|
|
1428
|
+
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
1429
|
+
advance();
|
|
1430
|
+
state.start++;
|
|
1431
|
+
count++;
|
|
1432
|
+
}
|
|
1433
|
+
if (count % 2 === 0) return false;
|
|
1434
|
+
state.negated = true;
|
|
1435
|
+
state.start++;
|
|
1436
|
+
return true;
|
|
1437
|
+
};
|
|
1438
|
+
const increment = (type) => {
|
|
1439
|
+
state[type]++;
|
|
1440
|
+
stack.push(type);
|
|
1441
|
+
};
|
|
1442
|
+
const decrement = (type) => {
|
|
1443
|
+
state[type]--;
|
|
1444
|
+
stack.pop();
|
|
1445
|
+
};
|
|
1446
|
+
/**
|
|
1447
|
+
* Push tokens onto the tokens array. This helper speeds up
|
|
1448
|
+
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
1449
|
+
* and 2) helping us avoid creating extra tokens when consecutive
|
|
1450
|
+
* characters are plain text. This improves performance and simplifies
|
|
1451
|
+
* lookbehinds.
|
|
1452
|
+
*/
|
|
1453
|
+
const push = (tok) => {
|
|
1454
|
+
if (prev.type === "globstar") {
|
|
1455
|
+
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
1456
|
+
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
1457
|
+
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
1458
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
1459
|
+
prev.type = "star";
|
|
1460
|
+
prev.value = "*";
|
|
1461
|
+
prev.output = star;
|
|
1462
|
+
state.output += prev.output;
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
|
|
1466
|
+
if (tok.value || tok.output) append(tok);
|
|
1467
|
+
if (prev && prev.type === "text" && tok.type === "text") {
|
|
1468
|
+
prev.output = (prev.output || prev.value) + tok.value;
|
|
1469
|
+
prev.value += tok.value;
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
tok.prev = prev;
|
|
1473
|
+
tokens.push(tok);
|
|
1474
|
+
prev = tok;
|
|
1475
|
+
};
|
|
1476
|
+
const extglobOpen = (type, value$1) => {
|
|
1477
|
+
const token = {
|
|
1478
|
+
...EXTGLOB_CHARS[value$1],
|
|
1479
|
+
conditions: 1,
|
|
1480
|
+
inner: ""
|
|
1481
|
+
};
|
|
1482
|
+
token.prev = prev;
|
|
1483
|
+
token.parens = state.parens;
|
|
1484
|
+
token.output = state.output;
|
|
1485
|
+
const output = (opts.capture ? "(" : "") + token.open;
|
|
1486
|
+
increment("parens");
|
|
1487
|
+
push({
|
|
1488
|
+
type,
|
|
1489
|
+
value: value$1,
|
|
1490
|
+
output: state.output ? "" : ONE_CHAR$1
|
|
1491
|
+
});
|
|
1492
|
+
push({
|
|
1493
|
+
type: "paren",
|
|
1494
|
+
extglob: true,
|
|
1495
|
+
value: advance(),
|
|
1496
|
+
output
|
|
1497
|
+
});
|
|
1498
|
+
extglobs.push(token);
|
|
1499
|
+
};
|
|
1500
|
+
const extglobClose = (token) => {
|
|
1501
|
+
let output = token.close + (opts.capture ? ")" : "");
|
|
1502
|
+
let rest;
|
|
1503
|
+
if (token.type === "negate") {
|
|
1504
|
+
let extglobStar = star;
|
|
1505
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
|
|
1506
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
|
|
1507
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse$1(rest, {
|
|
1508
|
+
...options,
|
|
1509
|
+
fastpaths: false
|
|
1510
|
+
}).output})${extglobStar})`;
|
|
1511
|
+
if (token.prev.type === "bos") state.negatedExtglob = true;
|
|
1512
|
+
}
|
|
1513
|
+
push({
|
|
1514
|
+
type: "paren",
|
|
1515
|
+
extglob: true,
|
|
1516
|
+
value,
|
|
1517
|
+
output
|
|
1518
|
+
});
|
|
1519
|
+
decrement("parens");
|
|
1520
|
+
};
|
|
1521
|
+
/**
|
|
1522
|
+
* Fast paths
|
|
1523
|
+
*/
|
|
1524
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
1525
|
+
let backslashes = false;
|
|
1526
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
1527
|
+
if (first === "\\") {
|
|
1528
|
+
backslashes = true;
|
|
1529
|
+
return m;
|
|
1530
|
+
}
|
|
1531
|
+
if (first === "?") {
|
|
1532
|
+
if (esc) return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
|
|
1533
|
+
if (index === 0) return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
|
|
1534
|
+
return QMARK$1.repeat(chars.length);
|
|
1535
|
+
}
|
|
1536
|
+
if (first === ".") return DOT_LITERAL$1.repeat(chars.length);
|
|
1537
|
+
if (first === "*") {
|
|
1538
|
+
if (esc) return esc + first + (rest ? star : "");
|
|
1539
|
+
return star;
|
|
1540
|
+
}
|
|
1541
|
+
return esc ? m : `\\${m}`;
|
|
1542
|
+
});
|
|
1543
|
+
if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
|
|
1544
|
+
else output = output.replace(/\\+/g, (m) => {
|
|
1545
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
1546
|
+
});
|
|
1547
|
+
if (output === input && opts.contains === true) {
|
|
1548
|
+
state.output = input;
|
|
1549
|
+
return state;
|
|
1550
|
+
}
|
|
1551
|
+
state.output = utils$2.wrapOutput(output, state, options);
|
|
1552
|
+
return state;
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Tokenize input until we reach end-of-string
|
|
1556
|
+
*/
|
|
1557
|
+
while (!eos()) {
|
|
1558
|
+
value = advance();
|
|
1559
|
+
if (value === "\0") continue;
|
|
1560
|
+
/**
|
|
1561
|
+
* Escaped characters
|
|
1562
|
+
*/
|
|
1563
|
+
if (value === "\\") {
|
|
1564
|
+
const next = peek();
|
|
1565
|
+
if (next === "/" && opts.bash !== true) continue;
|
|
1566
|
+
if (next === "." || next === ";") continue;
|
|
1567
|
+
if (!next) {
|
|
1568
|
+
value += "\\";
|
|
1569
|
+
push({
|
|
1570
|
+
type: "text",
|
|
1571
|
+
value
|
|
1572
|
+
});
|
|
1573
|
+
continue;
|
|
1574
|
+
}
|
|
1575
|
+
const match = /^\\+/.exec(remaining());
|
|
1576
|
+
let slashes = 0;
|
|
1577
|
+
if (match && match[0].length > 2) {
|
|
1578
|
+
slashes = match[0].length;
|
|
1579
|
+
state.index += slashes;
|
|
1580
|
+
if (slashes % 2 !== 0) value += "\\";
|
|
1581
|
+
}
|
|
1582
|
+
if (opts.unescape === true) value = advance();
|
|
1583
|
+
else value += advance();
|
|
1584
|
+
if (state.brackets === 0) {
|
|
1585
|
+
push({
|
|
1586
|
+
type: "text",
|
|
1587
|
+
value
|
|
1588
|
+
});
|
|
1589
|
+
continue;
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* If we're inside a regex character class, continue
|
|
1594
|
+
* until we reach the closing bracket.
|
|
1595
|
+
*/
|
|
1596
|
+
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
1597
|
+
if (opts.posix !== false && value === ":") {
|
|
1598
|
+
const inner = prev.value.slice(1);
|
|
1599
|
+
if (inner.includes("[")) {
|
|
1600
|
+
prev.posix = true;
|
|
1601
|
+
if (inner.includes(":")) {
|
|
1602
|
+
const idx = prev.value.lastIndexOf("[");
|
|
1603
|
+
const pre = prev.value.slice(0, idx);
|
|
1604
|
+
const posix$1 = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
|
|
1605
|
+
if (posix$1) {
|
|
1606
|
+
prev.value = pre + posix$1;
|
|
1607
|
+
state.backtrack = true;
|
|
1608
|
+
advance();
|
|
1609
|
+
if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR$1;
|
|
1610
|
+
continue;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
|
|
1616
|
+
if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
|
|
1617
|
+
if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
|
|
1618
|
+
prev.value += value;
|
|
1619
|
+
append({ value });
|
|
1620
|
+
continue;
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* If we're inside a quoted string, continue
|
|
1624
|
+
* until we reach the closing double quote.
|
|
1625
|
+
*/
|
|
1626
|
+
if (state.quotes === 1 && value !== "\"") {
|
|
1627
|
+
value = utils$2.escapeRegex(value);
|
|
1628
|
+
prev.value += value;
|
|
1629
|
+
append({ value });
|
|
1630
|
+
continue;
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Double quotes
|
|
1634
|
+
*/
|
|
1635
|
+
if (value === "\"") {
|
|
1636
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
1637
|
+
if (opts.keepQuotes === true) push({
|
|
1638
|
+
type: "text",
|
|
1639
|
+
value
|
|
1640
|
+
});
|
|
1641
|
+
continue;
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Parentheses
|
|
1645
|
+
*/
|
|
1646
|
+
if (value === "(") {
|
|
1647
|
+
increment("parens");
|
|
1648
|
+
push({
|
|
1649
|
+
type: "paren",
|
|
1650
|
+
value
|
|
1651
|
+
});
|
|
1652
|
+
continue;
|
|
1653
|
+
}
|
|
1654
|
+
if (value === ")") {
|
|
1655
|
+
if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
|
|
1656
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
1657
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
1658
|
+
extglobClose(extglobs.pop());
|
|
1659
|
+
continue;
|
|
1660
|
+
}
|
|
1661
|
+
push({
|
|
1662
|
+
type: "paren",
|
|
1663
|
+
value,
|
|
1664
|
+
output: state.parens ? ")" : "\\)"
|
|
1665
|
+
});
|
|
1666
|
+
decrement("parens");
|
|
1667
|
+
continue;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Square brackets
|
|
1671
|
+
*/
|
|
1672
|
+
if (value === "[") {
|
|
1673
|
+
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
1674
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
1675
|
+
value = `\\${value}`;
|
|
1676
|
+
} else increment("brackets");
|
|
1677
|
+
push({
|
|
1678
|
+
type: "bracket",
|
|
1679
|
+
value
|
|
1680
|
+
});
|
|
1681
|
+
continue;
|
|
1682
|
+
}
|
|
1683
|
+
if (value === "]") {
|
|
1684
|
+
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
1685
|
+
push({
|
|
1686
|
+
type: "text",
|
|
1687
|
+
value,
|
|
1688
|
+
output: `\\${value}`
|
|
1689
|
+
});
|
|
1690
|
+
continue;
|
|
1691
|
+
}
|
|
1692
|
+
if (state.brackets === 0) {
|
|
1693
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
|
|
1694
|
+
push({
|
|
1695
|
+
type: "text",
|
|
1696
|
+
value,
|
|
1697
|
+
output: `\\${value}`
|
|
1698
|
+
});
|
|
1699
|
+
continue;
|
|
1700
|
+
}
|
|
1701
|
+
decrement("brackets");
|
|
1702
|
+
const prevValue = prev.value.slice(1);
|
|
1703
|
+
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
|
|
1704
|
+
prev.value += value;
|
|
1705
|
+
append({ value });
|
|
1706
|
+
if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) continue;
|
|
1707
|
+
const escaped = utils$2.escapeRegex(prev.value);
|
|
1708
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
1709
|
+
if (opts.literalBrackets === true) {
|
|
1710
|
+
state.output += escaped;
|
|
1711
|
+
prev.value = escaped;
|
|
1712
|
+
continue;
|
|
1713
|
+
}
|
|
1714
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
1715
|
+
state.output += prev.value;
|
|
1716
|
+
continue;
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* Braces
|
|
1720
|
+
*/
|
|
1721
|
+
if (value === "{" && opts.nobrace !== true) {
|
|
1722
|
+
increment("braces");
|
|
1723
|
+
const open = {
|
|
1724
|
+
type: "brace",
|
|
1725
|
+
value,
|
|
1726
|
+
output: "(",
|
|
1727
|
+
outputIndex: state.output.length,
|
|
1728
|
+
tokensIndex: state.tokens.length
|
|
1729
|
+
};
|
|
1730
|
+
braces.push(open);
|
|
1731
|
+
push(open);
|
|
1732
|
+
continue;
|
|
1733
|
+
}
|
|
1734
|
+
if (value === "}") {
|
|
1735
|
+
const brace = braces[braces.length - 1];
|
|
1736
|
+
if (opts.nobrace === true || !brace) {
|
|
1737
|
+
push({
|
|
1738
|
+
type: "text",
|
|
1739
|
+
value,
|
|
1740
|
+
output: value
|
|
1741
|
+
});
|
|
1742
|
+
continue;
|
|
1743
|
+
}
|
|
1744
|
+
let output = ")";
|
|
1745
|
+
if (brace.dots === true) {
|
|
1746
|
+
const arr = tokens.slice();
|
|
1747
|
+
const range = [];
|
|
1748
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
1749
|
+
tokens.pop();
|
|
1750
|
+
if (arr[i].type === "brace") break;
|
|
1751
|
+
if (arr[i].type !== "dots") range.unshift(arr[i].value);
|
|
1752
|
+
}
|
|
1753
|
+
output = expandRange(range, opts);
|
|
1754
|
+
state.backtrack = true;
|
|
1755
|
+
}
|
|
1756
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
1757
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
1758
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
1759
|
+
brace.value = brace.output = "\\{";
|
|
1760
|
+
value = output = "\\}";
|
|
1761
|
+
state.output = out;
|
|
1762
|
+
for (const t of toks) state.output += t.output || t.value;
|
|
1763
|
+
}
|
|
1764
|
+
push({
|
|
1765
|
+
type: "brace",
|
|
1766
|
+
value,
|
|
1767
|
+
output
|
|
1768
|
+
});
|
|
1769
|
+
decrement("braces");
|
|
1770
|
+
braces.pop();
|
|
1771
|
+
continue;
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Pipes
|
|
1775
|
+
*/
|
|
1776
|
+
if (value === "|") {
|
|
1777
|
+
if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
|
|
1778
|
+
push({
|
|
1779
|
+
type: "text",
|
|
1780
|
+
value
|
|
1781
|
+
});
|
|
1782
|
+
continue;
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Commas
|
|
1786
|
+
*/
|
|
1787
|
+
if (value === ",") {
|
|
1788
|
+
let output = value;
|
|
1789
|
+
const brace = braces[braces.length - 1];
|
|
1790
|
+
if (brace && stack[stack.length - 1] === "braces") {
|
|
1791
|
+
brace.comma = true;
|
|
1792
|
+
output = "|";
|
|
1793
|
+
}
|
|
1794
|
+
push({
|
|
1795
|
+
type: "comma",
|
|
1796
|
+
value,
|
|
1797
|
+
output
|
|
1798
|
+
});
|
|
1799
|
+
continue;
|
|
1800
|
+
}
|
|
1801
|
+
/**
|
|
1802
|
+
* Slashes
|
|
1803
|
+
*/
|
|
1804
|
+
if (value === "/") {
|
|
1805
|
+
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
1806
|
+
state.start = state.index + 1;
|
|
1807
|
+
state.consumed = "";
|
|
1808
|
+
state.output = "";
|
|
1809
|
+
tokens.pop();
|
|
1810
|
+
prev = bos;
|
|
1811
|
+
continue;
|
|
1812
|
+
}
|
|
1813
|
+
push({
|
|
1814
|
+
type: "slash",
|
|
1815
|
+
value,
|
|
1816
|
+
output: SLASH_LITERAL$1
|
|
1817
|
+
});
|
|
1818
|
+
continue;
|
|
1819
|
+
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Dots
|
|
1822
|
+
*/
|
|
1823
|
+
if (value === ".") {
|
|
1824
|
+
if (state.braces > 0 && prev.type === "dot") {
|
|
1825
|
+
if (prev.value === ".") prev.output = DOT_LITERAL$1;
|
|
1826
|
+
const brace = braces[braces.length - 1];
|
|
1827
|
+
prev.type = "dots";
|
|
1828
|
+
prev.output += value;
|
|
1829
|
+
prev.value += value;
|
|
1830
|
+
brace.dots = true;
|
|
1831
|
+
continue;
|
|
1832
|
+
}
|
|
1833
|
+
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
1834
|
+
push({
|
|
1835
|
+
type: "text",
|
|
1836
|
+
value,
|
|
1837
|
+
output: DOT_LITERAL$1
|
|
1838
|
+
});
|
|
1839
|
+
continue;
|
|
1840
|
+
}
|
|
1841
|
+
push({
|
|
1842
|
+
type: "dot",
|
|
1843
|
+
value,
|
|
1844
|
+
output: DOT_LITERAL$1
|
|
1845
|
+
});
|
|
1846
|
+
continue;
|
|
1847
|
+
}
|
|
1848
|
+
/**
|
|
1849
|
+
* Question marks
|
|
1850
|
+
*/
|
|
1851
|
+
if (value === "?") {
|
|
1852
|
+
if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1853
|
+
extglobOpen("qmark", value);
|
|
1854
|
+
continue;
|
|
1855
|
+
}
|
|
1856
|
+
if (prev && prev.type === "paren") {
|
|
1857
|
+
const next = peek();
|
|
1858
|
+
let output = value;
|
|
1859
|
+
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
|
|
1860
|
+
push({
|
|
1861
|
+
type: "text",
|
|
1862
|
+
value,
|
|
1863
|
+
output
|
|
1864
|
+
});
|
|
1865
|
+
continue;
|
|
1866
|
+
}
|
|
1867
|
+
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
1868
|
+
push({
|
|
1869
|
+
type: "qmark",
|
|
1870
|
+
value,
|
|
1871
|
+
output: QMARK_NO_DOT
|
|
1872
|
+
});
|
|
1873
|
+
continue;
|
|
1874
|
+
}
|
|
1875
|
+
push({
|
|
1876
|
+
type: "qmark",
|
|
1877
|
+
value,
|
|
1878
|
+
output: QMARK$1
|
|
1879
|
+
});
|
|
1880
|
+
continue;
|
|
1881
|
+
}
|
|
1882
|
+
/**
|
|
1883
|
+
* Exclamation
|
|
1884
|
+
*/
|
|
1885
|
+
if (value === "!") {
|
|
1886
|
+
if (opts.noextglob !== true && peek() === "(") {
|
|
1887
|
+
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
1888
|
+
extglobOpen("negate", value);
|
|
1889
|
+
continue;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
1893
|
+
negate();
|
|
1894
|
+
continue;
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
/**
|
|
1898
|
+
* Plus
|
|
1899
|
+
*/
|
|
1900
|
+
if (value === "+") {
|
|
1901
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1902
|
+
extglobOpen("plus", value);
|
|
1903
|
+
continue;
|
|
1904
|
+
}
|
|
1905
|
+
if (prev && prev.value === "(" || opts.regex === false) {
|
|
1906
|
+
push({
|
|
1907
|
+
type: "plus",
|
|
1908
|
+
value,
|
|
1909
|
+
output: PLUS_LITERAL$1
|
|
1910
|
+
});
|
|
1911
|
+
continue;
|
|
1912
|
+
}
|
|
1913
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
1914
|
+
push({
|
|
1915
|
+
type: "plus",
|
|
1916
|
+
value
|
|
1917
|
+
});
|
|
1918
|
+
continue;
|
|
1919
|
+
}
|
|
1920
|
+
push({
|
|
1921
|
+
type: "plus",
|
|
1922
|
+
value: PLUS_LITERAL$1
|
|
1923
|
+
});
|
|
1924
|
+
continue;
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* Plain text
|
|
1928
|
+
*/
|
|
1929
|
+
if (value === "@") {
|
|
1930
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1931
|
+
push({
|
|
1932
|
+
type: "at",
|
|
1933
|
+
extglob: true,
|
|
1934
|
+
value,
|
|
1935
|
+
output: ""
|
|
1936
|
+
});
|
|
1937
|
+
continue;
|
|
1938
|
+
}
|
|
1939
|
+
push({
|
|
1940
|
+
type: "text",
|
|
1941
|
+
value
|
|
1942
|
+
});
|
|
1943
|
+
continue;
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Plain text
|
|
1947
|
+
*/
|
|
1948
|
+
if (value !== "*") {
|
|
1949
|
+
if (value === "$" || value === "^") value = `\\${value}`;
|
|
1950
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
1951
|
+
if (match) {
|
|
1952
|
+
value += match[0];
|
|
1953
|
+
state.index += match[0].length;
|
|
1954
|
+
}
|
|
1955
|
+
push({
|
|
1956
|
+
type: "text",
|
|
1957
|
+
value
|
|
1958
|
+
});
|
|
1959
|
+
continue;
|
|
1960
|
+
}
|
|
1961
|
+
/**
|
|
1962
|
+
* Stars
|
|
1963
|
+
*/
|
|
1964
|
+
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
1965
|
+
prev.type = "star";
|
|
1966
|
+
prev.star = true;
|
|
1967
|
+
prev.value += value;
|
|
1968
|
+
prev.output = star;
|
|
1969
|
+
state.backtrack = true;
|
|
1970
|
+
state.globstar = true;
|
|
1971
|
+
consume(value);
|
|
1972
|
+
continue;
|
|
1973
|
+
}
|
|
1974
|
+
let rest = remaining();
|
|
1975
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
1976
|
+
extglobOpen("star", value);
|
|
1977
|
+
continue;
|
|
1978
|
+
}
|
|
1979
|
+
if (prev.type === "star") {
|
|
1980
|
+
if (opts.noglobstar === true) {
|
|
1981
|
+
consume(value);
|
|
1982
|
+
continue;
|
|
1983
|
+
}
|
|
1984
|
+
const prior = prev.prev;
|
|
1985
|
+
const before = prior.prev;
|
|
1986
|
+
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
1987
|
+
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
1988
|
+
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
1989
|
+
push({
|
|
1990
|
+
type: "star",
|
|
1991
|
+
value,
|
|
1992
|
+
output: ""
|
|
1993
|
+
});
|
|
1994
|
+
continue;
|
|
1995
|
+
}
|
|
1996
|
+
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
1997
|
+
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
1998
|
+
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
1999
|
+
push({
|
|
2000
|
+
type: "star",
|
|
2001
|
+
value,
|
|
2002
|
+
output: ""
|
|
2003
|
+
});
|
|
2004
|
+
continue;
|
|
2005
|
+
}
|
|
2006
|
+
while (rest.slice(0, 3) === "/**") {
|
|
2007
|
+
const after = input[state.index + 4];
|
|
2008
|
+
if (after && after !== "/") break;
|
|
2009
|
+
rest = rest.slice(3);
|
|
2010
|
+
consume("/**", 3);
|
|
2011
|
+
}
|
|
2012
|
+
if (prior.type === "bos" && eos()) {
|
|
2013
|
+
prev.type = "globstar";
|
|
2014
|
+
prev.value += value;
|
|
2015
|
+
prev.output = globstar(opts);
|
|
2016
|
+
state.output = prev.output;
|
|
2017
|
+
state.globstar = true;
|
|
2018
|
+
consume(value);
|
|
2019
|
+
continue;
|
|
2020
|
+
}
|
|
2021
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
2022
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2023
|
+
prior.output = `(?:${prior.output}`;
|
|
2024
|
+
prev.type = "globstar";
|
|
2025
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
2026
|
+
prev.value += value;
|
|
2027
|
+
state.globstar = true;
|
|
2028
|
+
state.output += prior.output + prev.output;
|
|
2029
|
+
consume(value);
|
|
2030
|
+
continue;
|
|
2031
|
+
}
|
|
2032
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
2033
|
+
const end = rest[1] !== void 0 ? "|$" : "";
|
|
2034
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2035
|
+
prior.output = `(?:${prior.output}`;
|
|
2036
|
+
prev.type = "globstar";
|
|
2037
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`;
|
|
2038
|
+
prev.value += value;
|
|
2039
|
+
state.output += prior.output + prev.output;
|
|
2040
|
+
state.globstar = true;
|
|
2041
|
+
consume(value + advance());
|
|
2042
|
+
push({
|
|
2043
|
+
type: "slash",
|
|
2044
|
+
value: "/",
|
|
2045
|
+
output: ""
|
|
2046
|
+
});
|
|
2047
|
+
continue;
|
|
2048
|
+
}
|
|
2049
|
+
if (prior.type === "bos" && rest[0] === "/") {
|
|
2050
|
+
prev.type = "globstar";
|
|
2051
|
+
prev.value += value;
|
|
2052
|
+
prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
|
|
2053
|
+
state.output = prev.output;
|
|
2054
|
+
state.globstar = true;
|
|
2055
|
+
consume(value + advance());
|
|
2056
|
+
push({
|
|
2057
|
+
type: "slash",
|
|
2058
|
+
value: "/",
|
|
2059
|
+
output: ""
|
|
2060
|
+
});
|
|
2061
|
+
continue;
|
|
2062
|
+
}
|
|
2063
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
2064
|
+
prev.type = "globstar";
|
|
2065
|
+
prev.output = globstar(opts);
|
|
2066
|
+
prev.value += value;
|
|
2067
|
+
state.output += prev.output;
|
|
2068
|
+
state.globstar = true;
|
|
2069
|
+
consume(value);
|
|
2070
|
+
continue;
|
|
2071
|
+
}
|
|
2072
|
+
const token = {
|
|
2073
|
+
type: "star",
|
|
2074
|
+
value,
|
|
2075
|
+
output: star
|
|
2076
|
+
};
|
|
2077
|
+
if (opts.bash === true) {
|
|
2078
|
+
token.output = ".*?";
|
|
2079
|
+
if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
|
|
2080
|
+
push(token);
|
|
2081
|
+
continue;
|
|
2082
|
+
}
|
|
2083
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
2084
|
+
token.output = value;
|
|
2085
|
+
push(token);
|
|
2086
|
+
continue;
|
|
2087
|
+
}
|
|
2088
|
+
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
2089
|
+
if (prev.type === "dot") {
|
|
2090
|
+
state.output += NO_DOT_SLASH;
|
|
2091
|
+
prev.output += NO_DOT_SLASH;
|
|
2092
|
+
} else if (opts.dot === true) {
|
|
2093
|
+
state.output += NO_DOTS_SLASH;
|
|
2094
|
+
prev.output += NO_DOTS_SLASH;
|
|
2095
|
+
} else {
|
|
2096
|
+
state.output += nodot;
|
|
2097
|
+
prev.output += nodot;
|
|
2098
|
+
}
|
|
2099
|
+
if (peek() !== "*") {
|
|
2100
|
+
state.output += ONE_CHAR$1;
|
|
2101
|
+
prev.output += ONE_CHAR$1;
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
push(token);
|
|
2105
|
+
}
|
|
2106
|
+
while (state.brackets > 0) {
|
|
2107
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
2108
|
+
state.output = utils$2.escapeLast(state.output, "[");
|
|
2109
|
+
decrement("brackets");
|
|
2110
|
+
}
|
|
2111
|
+
while (state.parens > 0) {
|
|
2112
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
2113
|
+
state.output = utils$2.escapeLast(state.output, "(");
|
|
2114
|
+
decrement("parens");
|
|
2115
|
+
}
|
|
2116
|
+
while (state.braces > 0) {
|
|
2117
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
2118
|
+
state.output = utils$2.escapeLast(state.output, "{");
|
|
2119
|
+
decrement("braces");
|
|
2120
|
+
}
|
|
2121
|
+
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
|
|
2122
|
+
type: "maybe_slash",
|
|
2123
|
+
value: "",
|
|
2124
|
+
output: `${SLASH_LITERAL$1}?`
|
|
2125
|
+
});
|
|
2126
|
+
if (state.backtrack === true) {
|
|
2127
|
+
state.output = "";
|
|
2128
|
+
for (const token of state.tokens) {
|
|
2129
|
+
state.output += token.output != null ? token.output : token.value;
|
|
2130
|
+
if (token.suffix) state.output += token.suffix;
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
return state;
|
|
2134
|
+
};
|
|
2135
|
+
/**
|
|
2136
|
+
* Fast paths for creating regular expressions for common glob patterns.
|
|
2137
|
+
* This can significantly speed up processing and has very little downside
|
|
2138
|
+
* impact when none of the fast paths match.
|
|
2139
|
+
*/
|
|
2140
|
+
parse$1.fastpaths = (input, options) => {
|
|
2141
|
+
const opts = { ...options };
|
|
2142
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
2143
|
+
const len = input.length;
|
|
2144
|
+
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
2145
|
+
input = REPLACEMENTS[input] || input;
|
|
2146
|
+
const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
|
|
2147
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
2148
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
2149
|
+
const capture = opts.capture ? "" : "?:";
|
|
2150
|
+
const state = {
|
|
2151
|
+
negated: false,
|
|
2152
|
+
prefix: ""
|
|
2153
|
+
};
|
|
2154
|
+
let star = opts.bash === true ? ".*?" : STAR;
|
|
2155
|
+
if (opts.capture) star = `(${star})`;
|
|
2156
|
+
const globstar = (opts$1) => {
|
|
2157
|
+
if (opts$1.noglobstar === true) return star;
|
|
2158
|
+
return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
|
|
2159
|
+
};
|
|
2160
|
+
const create = (str) => {
|
|
2161
|
+
switch (str) {
|
|
2162
|
+
case "*": return `${nodot}${ONE_CHAR$1}${star}`;
|
|
2163
|
+
case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
2164
|
+
case "*.*": return `${nodot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
2165
|
+
case "*/*": return `${nodot}${star}${SLASH_LITERAL$1}${ONE_CHAR$1}${slashDot}${star}`;
|
|
2166
|
+
case "**": return nodot + globstar(opts);
|
|
2167
|
+
case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${ONE_CHAR$1}${star}`;
|
|
2168
|
+
case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
2169
|
+
case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
2170
|
+
default: {
|
|
2171
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
2172
|
+
if (!match) return;
|
|
2173
|
+
const source$1 = create(match[1]);
|
|
2174
|
+
if (!source$1) return;
|
|
2175
|
+
return source$1 + DOT_LITERAL$1 + match[2];
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
};
|
|
2179
|
+
let source = create(utils$2.removePrefix(input, state));
|
|
2180
|
+
if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
|
|
2181
|
+
return source;
|
|
2182
|
+
};
|
|
2183
|
+
module.exports = parse$1;
|
|
2184
|
+
}));
|
|
2185
|
+
|
|
2186
|
+
//#endregion
|
|
2187
|
+
//#region ../../node_modules/.bun/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
|
|
2188
|
+
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2189
|
+
const scan = require_scan();
|
|
2190
|
+
const parse = require_parse();
|
|
2191
|
+
const utils$1 = require_utils();
|
|
2192
|
+
const constants = require_constants();
|
|
2193
|
+
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
2194
|
+
/**
|
|
2195
|
+
* Creates a matcher function from one or more glob patterns. The
|
|
2196
|
+
* returned function takes a string to match as its first argument,
|
|
2197
|
+
* and returns true if the string is a match. The returned matcher
|
|
2198
|
+
* function also takes a boolean as the second argument that, when true,
|
|
2199
|
+
* returns an object with additional information.
|
|
2200
|
+
*
|
|
2201
|
+
* ```js
|
|
2202
|
+
* const picomatch = require('picomatch');
|
|
2203
|
+
* // picomatch(glob[, options]);
|
|
2204
|
+
*
|
|
2205
|
+
* const isMatch = picomatch('*.!(*a)');
|
|
2206
|
+
* console.log(isMatch('a.a')); //=> false
|
|
2207
|
+
* console.log(isMatch('a.b')); //=> true
|
|
2208
|
+
* ```
|
|
2209
|
+
* @name picomatch
|
|
2210
|
+
* @param {String|Array} `globs` One or more glob patterns.
|
|
2211
|
+
* @param {Object=} `options`
|
|
2212
|
+
* @return {Function=} Returns a matcher function.
|
|
2213
|
+
* @api public
|
|
2214
|
+
*/
|
|
2215
|
+
const picomatch$2 = (glob$1, options, returnState = false) => {
|
|
2216
|
+
if (Array.isArray(glob$1)) {
|
|
2217
|
+
const fns = glob$1.map((input) => picomatch$2(input, options, returnState));
|
|
2218
|
+
const arrayMatcher = (str) => {
|
|
2219
|
+
for (const isMatch of fns) {
|
|
2220
|
+
const state$1 = isMatch(str);
|
|
2221
|
+
if (state$1) return state$1;
|
|
2222
|
+
}
|
|
2223
|
+
return false;
|
|
2224
|
+
};
|
|
2225
|
+
return arrayMatcher;
|
|
2226
|
+
}
|
|
2227
|
+
const isState = isObject(glob$1) && glob$1.tokens && glob$1.input;
|
|
2228
|
+
if (glob$1 === "" || typeof glob$1 !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
|
|
2229
|
+
const opts = options || {};
|
|
2230
|
+
const posix$1 = opts.windows;
|
|
2231
|
+
const regex = isState ? picomatch$2.compileRe(glob$1, options) : picomatch$2.makeRe(glob$1, options, false, true);
|
|
2232
|
+
const state = regex.state;
|
|
2233
|
+
delete regex.state;
|
|
2234
|
+
let isIgnored = () => false;
|
|
2235
|
+
if (opts.ignore) {
|
|
2236
|
+
const ignoreOpts = {
|
|
2237
|
+
...options,
|
|
2238
|
+
ignore: null,
|
|
2239
|
+
onMatch: null,
|
|
2240
|
+
onResult: null
|
|
2241
|
+
};
|
|
2242
|
+
isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
|
|
2243
|
+
}
|
|
2244
|
+
const matcher = (input, returnObject = false) => {
|
|
2245
|
+
const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
|
|
2246
|
+
glob: glob$1,
|
|
2247
|
+
posix: posix$1
|
|
2248
|
+
});
|
|
2249
|
+
const result = {
|
|
2250
|
+
glob: glob$1,
|
|
2251
|
+
state,
|
|
2252
|
+
regex,
|
|
2253
|
+
posix: posix$1,
|
|
2254
|
+
input,
|
|
2255
|
+
output,
|
|
2256
|
+
match,
|
|
2257
|
+
isMatch
|
|
2258
|
+
};
|
|
2259
|
+
if (typeof opts.onResult === "function") opts.onResult(result);
|
|
2260
|
+
if (isMatch === false) {
|
|
2261
|
+
result.isMatch = false;
|
|
2262
|
+
return returnObject ? result : false;
|
|
2263
|
+
}
|
|
2264
|
+
if (isIgnored(input)) {
|
|
2265
|
+
if (typeof opts.onIgnore === "function") opts.onIgnore(result);
|
|
2266
|
+
result.isMatch = false;
|
|
2267
|
+
return returnObject ? result : false;
|
|
2268
|
+
}
|
|
2269
|
+
if (typeof opts.onMatch === "function") opts.onMatch(result);
|
|
2270
|
+
return returnObject ? result : true;
|
|
2271
|
+
};
|
|
2272
|
+
if (returnState) matcher.state = state;
|
|
2273
|
+
return matcher;
|
|
2274
|
+
};
|
|
2275
|
+
/**
|
|
2276
|
+
* Test `input` with the given `regex`. This is used by the main
|
|
2277
|
+
* `picomatch()` function to test the input string.
|
|
2278
|
+
*
|
|
2279
|
+
* ```js
|
|
2280
|
+
* const picomatch = require('picomatch');
|
|
2281
|
+
* // picomatch.test(input, regex[, options]);
|
|
2282
|
+
*
|
|
2283
|
+
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
2284
|
+
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
2285
|
+
* ```
|
|
2286
|
+
* @param {String} `input` String to test.
|
|
2287
|
+
* @param {RegExp} `regex`
|
|
2288
|
+
* @return {Object} Returns an object with matching info.
|
|
2289
|
+
* @api public
|
|
2290
|
+
*/
|
|
2291
|
+
picomatch$2.test = (input, regex, options, { glob: glob$1, posix: posix$1 } = {}) => {
|
|
2292
|
+
if (typeof input !== "string") throw new TypeError("Expected input to be a string");
|
|
2293
|
+
if (input === "") return {
|
|
2294
|
+
isMatch: false,
|
|
2295
|
+
output: ""
|
|
2296
|
+
};
|
|
2297
|
+
const opts = options || {};
|
|
2298
|
+
const format = opts.format || (posix$1 ? utils$1.toPosixSlashes : null);
|
|
2299
|
+
let match = input === glob$1;
|
|
2300
|
+
let output = match && format ? format(input) : input;
|
|
2301
|
+
if (match === false) {
|
|
2302
|
+
output = format ? format(input) : input;
|
|
2303
|
+
match = output === glob$1;
|
|
2304
|
+
}
|
|
2305
|
+
if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex, options, posix$1);
|
|
2306
|
+
else match = regex.exec(output);
|
|
2307
|
+
return {
|
|
2308
|
+
isMatch: Boolean(match),
|
|
2309
|
+
match,
|
|
2310
|
+
output
|
|
2311
|
+
};
|
|
2312
|
+
};
|
|
2313
|
+
/**
|
|
2314
|
+
* Match the basename of a filepath.
|
|
2315
|
+
*
|
|
2316
|
+
* ```js
|
|
2317
|
+
* const picomatch = require('picomatch');
|
|
2318
|
+
* // picomatch.matchBase(input, glob[, options]);
|
|
2319
|
+
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
2320
|
+
* ```
|
|
2321
|
+
* @param {String} `input` String to test.
|
|
2322
|
+
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
2323
|
+
* @return {Boolean}
|
|
2324
|
+
* @api public
|
|
2325
|
+
*/
|
|
2326
|
+
picomatch$2.matchBase = (input, glob$1, options) => {
|
|
2327
|
+
return (glob$1 instanceof RegExp ? glob$1 : picomatch$2.makeRe(glob$1, options)).test(utils$1.basename(input));
|
|
2328
|
+
};
|
|
2329
|
+
/**
|
|
2330
|
+
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
2331
|
+
*
|
|
2332
|
+
* ```js
|
|
2333
|
+
* const picomatch = require('picomatch');
|
|
2334
|
+
* // picomatch.isMatch(string, patterns[, options]);
|
|
2335
|
+
*
|
|
2336
|
+
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
2337
|
+
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
2338
|
+
* ```
|
|
2339
|
+
* @param {String|Array} str The string to test.
|
|
2340
|
+
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
2341
|
+
* @param {Object} [options] See available [options](#options).
|
|
2342
|
+
* @return {Boolean} Returns true if any patterns match `str`
|
|
2343
|
+
* @api public
|
|
2344
|
+
*/
|
|
2345
|
+
picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
|
|
2346
|
+
/**
|
|
2347
|
+
* Parse a glob pattern to create the source string for a regular
|
|
2348
|
+
* expression.
|
|
2349
|
+
*
|
|
2350
|
+
* ```js
|
|
2351
|
+
* const picomatch = require('picomatch');
|
|
2352
|
+
* const result = picomatch.parse(pattern[, options]);
|
|
2353
|
+
* ```
|
|
2354
|
+
* @param {String} `pattern`
|
|
2355
|
+
* @param {Object} `options`
|
|
2356
|
+
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
2357
|
+
* @api public
|
|
2358
|
+
*/
|
|
2359
|
+
picomatch$2.parse = (pattern, options) => {
|
|
2360
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch$2.parse(p, options));
|
|
2361
|
+
return parse(pattern, {
|
|
2362
|
+
...options,
|
|
2363
|
+
fastpaths: false
|
|
2364
|
+
});
|
|
2365
|
+
};
|
|
2366
|
+
/**
|
|
2367
|
+
* Scan a glob pattern to separate the pattern into segments.
|
|
2368
|
+
*
|
|
2369
|
+
* ```js
|
|
2370
|
+
* const picomatch = require('picomatch');
|
|
2371
|
+
* // picomatch.scan(input[, options]);
|
|
2372
|
+
*
|
|
2373
|
+
* const result = picomatch.scan('!./foo/*.js');
|
|
2374
|
+
* console.log(result);
|
|
2375
|
+
* { prefix: '!./',
|
|
2376
|
+
* input: '!./foo/*.js',
|
|
2377
|
+
* start: 3,
|
|
2378
|
+
* base: 'foo',
|
|
2379
|
+
* glob: '*.js',
|
|
2380
|
+
* isBrace: false,
|
|
2381
|
+
* isBracket: false,
|
|
2382
|
+
* isGlob: true,
|
|
2383
|
+
* isExtglob: false,
|
|
2384
|
+
* isGlobstar: false,
|
|
2385
|
+
* negated: true }
|
|
2386
|
+
* ```
|
|
2387
|
+
* @param {String} `input` Glob pattern to scan.
|
|
2388
|
+
* @param {Object} `options`
|
|
2389
|
+
* @return {Object} Returns an object with
|
|
2390
|
+
* @api public
|
|
2391
|
+
*/
|
|
2392
|
+
picomatch$2.scan = (input, options) => scan(input, options);
|
|
2393
|
+
/**
|
|
2394
|
+
* Compile a regular expression from the `state` object returned by the
|
|
2395
|
+
* [parse()](#parse) method.
|
|
2396
|
+
*
|
|
2397
|
+
* @param {Object} `state`
|
|
2398
|
+
* @param {Object} `options`
|
|
2399
|
+
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
2400
|
+
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
2401
|
+
* @return {RegExp}
|
|
2402
|
+
* @api public
|
|
2403
|
+
*/
|
|
2404
|
+
picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
2405
|
+
if (returnOutput === true) return state.output;
|
|
2406
|
+
const opts = options || {};
|
|
2407
|
+
const prepend = opts.contains ? "" : "^";
|
|
2408
|
+
const append = opts.contains ? "" : "$";
|
|
2409
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
2410
|
+
if (state && state.negated === true) source = `^(?!${source}).*$`;
|
|
2411
|
+
const regex = picomatch$2.toRegex(source, options);
|
|
2412
|
+
if (returnState === true) regex.state = state;
|
|
2413
|
+
return regex;
|
|
2414
|
+
};
|
|
2415
|
+
/**
|
|
2416
|
+
* Create a regular expression from a parsed glob pattern.
|
|
2417
|
+
*
|
|
2418
|
+
* ```js
|
|
2419
|
+
* const picomatch = require('picomatch');
|
|
2420
|
+
* const state = picomatch.parse('*.js');
|
|
2421
|
+
* // picomatch.compileRe(state[, options]);
|
|
2422
|
+
*
|
|
2423
|
+
* console.log(picomatch.compileRe(state));
|
|
2424
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2425
|
+
* ```
|
|
2426
|
+
* @param {String} `state` The object returned from the `.parse` method.
|
|
2427
|
+
* @param {Object} `options`
|
|
2428
|
+
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
|
2429
|
+
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
2430
|
+
* @return {RegExp} Returns a regex created from the given pattern.
|
|
2431
|
+
* @api public
|
|
2432
|
+
*/
|
|
2433
|
+
picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
2434
|
+
if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
|
|
2435
|
+
let parsed = {
|
|
2436
|
+
negated: false,
|
|
2437
|
+
fastpaths: true
|
|
2438
|
+
};
|
|
2439
|
+
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
|
|
2440
|
+
if (!parsed.output) parsed = parse(input, options);
|
|
2441
|
+
return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
|
|
2442
|
+
};
|
|
2443
|
+
/**
|
|
2444
|
+
* Create a regular expression from the given regex source string.
|
|
2445
|
+
*
|
|
2446
|
+
* ```js
|
|
2447
|
+
* const picomatch = require('picomatch');
|
|
2448
|
+
* // picomatch.toRegex(source[, options]);
|
|
2449
|
+
*
|
|
2450
|
+
* const { output } = picomatch.parse('*.js');
|
|
2451
|
+
* console.log(picomatch.toRegex(output));
|
|
2452
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2453
|
+
* ```
|
|
2454
|
+
* @param {String} `source` Regular expression source string.
|
|
2455
|
+
* @param {Object} `options`
|
|
2456
|
+
* @return {RegExp}
|
|
2457
|
+
* @api public
|
|
2458
|
+
*/
|
|
2459
|
+
picomatch$2.toRegex = (source, options) => {
|
|
2460
|
+
try {
|
|
2461
|
+
const opts = options || {};
|
|
2462
|
+
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
2463
|
+
} catch (err) {
|
|
2464
|
+
if (options && options.debug === true) throw err;
|
|
2465
|
+
return /$^/;
|
|
2466
|
+
}
|
|
2467
|
+
};
|
|
2468
|
+
/**
|
|
2469
|
+
* Picomatch constants.
|
|
2470
|
+
* @return {Object}
|
|
2471
|
+
*/
|
|
2472
|
+
picomatch$2.constants = constants;
|
|
2473
|
+
/**
|
|
2474
|
+
* Expose "picomatch"
|
|
2475
|
+
*/
|
|
2476
|
+
module.exports = picomatch$2;
|
|
2477
|
+
}));
|
|
2478
|
+
|
|
2479
|
+
//#endregion
|
|
2480
|
+
//#region ../../node_modules/.bun/picomatch@4.0.3/node_modules/picomatch/index.js
|
|
2481
|
+
var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2482
|
+
const pico = require_picomatch$1();
|
|
2483
|
+
const utils = require_utils();
|
|
2484
|
+
function picomatch$1(glob$1, options, returnState = false) {
|
|
2485
|
+
if (options && (options.windows === null || options.windows === void 0)) options = {
|
|
2486
|
+
...options,
|
|
2487
|
+
windows: utils.isWindows()
|
|
2488
|
+
};
|
|
2489
|
+
return pico(glob$1, options, returnState);
|
|
2490
|
+
}
|
|
2491
|
+
Object.assign(picomatch$1, pico);
|
|
2492
|
+
module.exports = picomatch$1;
|
|
2493
|
+
}));
|
|
2494
|
+
|
|
2495
|
+
//#endregion
|
|
2496
|
+
//#region ../../node_modules/.bun/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs
|
|
2497
|
+
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
2498
|
+
const isReadonlyArray = Array.isArray;
|
|
2499
|
+
const isWin = process.platform === "win32";
|
|
2500
|
+
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
2501
|
+
function getPartialMatcher(patterns, options = {}) {
|
|
2502
|
+
const patternsCount = patterns.length;
|
|
2503
|
+
const patternsParts = Array(patternsCount);
|
|
2504
|
+
const matchers = Array(patternsCount);
|
|
2505
|
+
const globstarEnabled = !options.noglobstar;
|
|
2506
|
+
for (let i = 0; i < patternsCount; i++) {
|
|
2507
|
+
const parts = splitPattern(patterns[i]);
|
|
2508
|
+
patternsParts[i] = parts;
|
|
2509
|
+
const partsCount = parts.length;
|
|
2510
|
+
const partMatchers = Array(partsCount);
|
|
2511
|
+
for (let j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
|
|
2512
|
+
matchers[i] = partMatchers;
|
|
2513
|
+
}
|
|
2514
|
+
return (input) => {
|
|
2515
|
+
const inputParts = input.split("/");
|
|
2516
|
+
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
2517
|
+
for (let i = 0; i < patterns.length; i++) {
|
|
2518
|
+
const patternParts = patternsParts[i];
|
|
2519
|
+
const matcher = matchers[i];
|
|
2520
|
+
const inputPatternCount = inputParts.length;
|
|
2521
|
+
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
2522
|
+
let j = 0;
|
|
2523
|
+
while (j < minParts) {
|
|
2524
|
+
const part = patternParts[j];
|
|
2525
|
+
if (part.includes("/")) return true;
|
|
2526
|
+
if (!matcher[j](inputParts[j])) break;
|
|
2527
|
+
if (globstarEnabled && part === "**") return true;
|
|
2528
|
+
j++;
|
|
2529
|
+
}
|
|
2530
|
+
if (j === inputPatternCount) return true;
|
|
2531
|
+
}
|
|
2532
|
+
return false;
|
|
2533
|
+
};
|
|
2534
|
+
}
|
|
2535
|
+
/* node:coverage ignore next 2 */
|
|
2536
|
+
const WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
|
|
2537
|
+
const isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === "/";
|
|
2538
|
+
function buildFormat(cwd, root, absolute) {
|
|
2539
|
+
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
2540
|
+
if (absolute) {
|
|
2541
|
+
const start = isRoot(cwd) ? cwd.length : cwd.length + 1;
|
|
2542
|
+
return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
|
|
2543
|
+
}
|
|
2544
|
+
const prefix = root.slice(cwd.length + 1);
|
|
2545
|
+
if (prefix) return (p, isDir) => {
|
|
2546
|
+
if (p === ".") return prefix;
|
|
2547
|
+
const result = `${prefix}/${p}`;
|
|
2548
|
+
return isDir ? result.slice(0, -1) : result;
|
|
2549
|
+
};
|
|
2550
|
+
return (p, isDir) => isDir && p !== "." ? p.slice(0, -1) : p;
|
|
2551
|
+
}
|
|
2552
|
+
if (absolute) return (p) => posix.relative(cwd, p) || ".";
|
|
2553
|
+
return (p) => posix.relative(cwd, `${root}/${p}`) || ".";
|
|
2554
|
+
}
|
|
2555
|
+
function buildRelative(cwd, root) {
|
|
2556
|
+
if (root.startsWith(`${cwd}/`)) {
|
|
2557
|
+
const prefix = root.slice(cwd.length + 1);
|
|
2558
|
+
return (p) => `${prefix}/${p}`;
|
|
2559
|
+
}
|
|
2560
|
+
return (p) => {
|
|
2561
|
+
const result = posix.relative(cwd, `${root}/${p}`);
|
|
2562
|
+
if (p.endsWith("/") && result !== "") return `${result}/`;
|
|
2563
|
+
return result || ".";
|
|
2564
|
+
};
|
|
2565
|
+
}
|
|
2566
|
+
const splitPatternOptions = { parts: true };
|
|
2567
|
+
function splitPattern(path$1$1) {
|
|
2568
|
+
var _result$parts;
|
|
2569
|
+
const result = import_picomatch.default.scan(path$1$1, splitPatternOptions);
|
|
2570
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1$1];
|
|
2571
|
+
}
|
|
2572
|
+
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
2573
|
+
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
2574
|
+
const escapePosixPath = (path$1$1) => path$1$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2575
|
+
const escapeWin32Path = (path$1$1) => path$1$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2576
|
+
/**
|
|
2577
|
+
* Escapes a path's special characters depending on the platform.
|
|
2578
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
2579
|
+
*/
|
|
2580
|
+
/* node:coverage ignore next */
|
|
2581
|
+
const escapePath = isWin ? escapeWin32Path : escapePosixPath;
|
|
2582
|
+
/**
|
|
2583
|
+
* Checks if a pattern has dynamic parts.
|
|
2584
|
+
*
|
|
2585
|
+
* Has a few minor differences with [`fast-glob`](https://github.com/mrmlnc/fast-glob) for better accuracy:
|
|
2586
|
+
*
|
|
2587
|
+
* - Doesn't necessarily return `false` on patterns that include `\`.
|
|
2588
|
+
* - Returns `true` if the pattern includes parentheses, regardless of them representing one single pattern or not.
|
|
2589
|
+
* - Returns `true` for unfinished glob extensions i.e. `(h`, `+(h`.
|
|
2590
|
+
* - Returns `true` for unfinished brace expansions as long as they include `,` or `..`.
|
|
2591
|
+
*
|
|
2592
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#isDynamicPattern}
|
|
2593
|
+
*/
|
|
2594
|
+
function isDynamicPattern(pattern, options) {
|
|
2595
|
+
if ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;
|
|
2596
|
+
const scan$2 = import_picomatch.default.scan(pattern);
|
|
2597
|
+
return scan$2.isGlob || scan$2.negated;
|
|
2598
|
+
}
|
|
2599
|
+
function log(...tasks) {
|
|
2600
|
+
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
|
|
2601
|
+
}
|
|
2602
|
+
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
2603
|
+
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
2604
|
+
const BACKSLASHES = /\\/g;
|
|
2605
|
+
function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
2606
|
+
let result = pattern;
|
|
2607
|
+
if (pattern.endsWith("/")) result = pattern.slice(0, -1);
|
|
2608
|
+
if (!result.endsWith("*") && expandDirectories) result += "/**";
|
|
2609
|
+
const escapedCwd = escapePath(cwd);
|
|
2610
|
+
if (path$1.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
|
|
2611
|
+
else result = posix.normalize(result);
|
|
2612
|
+
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
2613
|
+
const parts = splitPattern(result);
|
|
2614
|
+
if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
|
|
2615
|
+
const n = (parentDirectoryMatch[0].length + 1) / 3;
|
|
2616
|
+
let i = 0;
|
|
2617
|
+
const cwdParts = escapedCwd.split("/");
|
|
2618
|
+
while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
|
|
2619
|
+
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
2620
|
+
i++;
|
|
2621
|
+
}
|
|
2622
|
+
const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i * 3));
|
|
2623
|
+
if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
|
|
2624
|
+
props.root = potentialRoot;
|
|
2625
|
+
props.depthOffset = -n + i;
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
if (!isIgnore && props.depthOffset >= 0) {
|
|
2629
|
+
var _props$commonPath;
|
|
2630
|
+
(_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
|
|
2631
|
+
const newCommonPath = [];
|
|
2632
|
+
const length = Math.min(props.commonPath.length, parts.length);
|
|
2633
|
+
for (let i = 0; i < length; i++) {
|
|
2634
|
+
const part = parts[i];
|
|
2635
|
+
if (part === "**" && !parts[i + 1]) {
|
|
2636
|
+
newCommonPath.pop();
|
|
2637
|
+
break;
|
|
2638
|
+
}
|
|
2639
|
+
if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
|
|
2640
|
+
newCommonPath.push(part);
|
|
2641
|
+
}
|
|
2642
|
+
props.depthOffset = newCommonPath.length;
|
|
2643
|
+
props.commonPath = newCommonPath;
|
|
2644
|
+
props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
|
|
2645
|
+
}
|
|
2646
|
+
return result;
|
|
2647
|
+
}
|
|
2648
|
+
function processPatterns({ patterns = ["**/*"], ignore = [], expandDirectories = true }, cwd, props) {
|
|
2649
|
+
if (typeof patterns === "string") patterns = [patterns];
|
|
2650
|
+
if (typeof ignore === "string") ignore = [ignore];
|
|
2651
|
+
const matchPatterns = [];
|
|
2652
|
+
const ignorePatterns = [];
|
|
2653
|
+
for (const pattern of ignore) {
|
|
2654
|
+
if (!pattern) continue;
|
|
2655
|
+
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
|
|
2656
|
+
}
|
|
2657
|
+
for (const pattern of patterns) {
|
|
2658
|
+
if (!pattern) continue;
|
|
2659
|
+
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
|
|
2660
|
+
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
|
|
2661
|
+
}
|
|
2662
|
+
return {
|
|
2663
|
+
match: matchPatterns,
|
|
2664
|
+
ignore: ignorePatterns
|
|
2665
|
+
};
|
|
2666
|
+
}
|
|
2667
|
+
function formatPaths(paths, relative$1) {
|
|
2668
|
+
for (let i = paths.length - 1; i >= 0; i--) {
|
|
2669
|
+
const path$1$1 = paths[i];
|
|
2670
|
+
paths[i] = relative$1(path$1$1);
|
|
2671
|
+
}
|
|
2672
|
+
return paths;
|
|
2673
|
+
}
|
|
2674
|
+
function normalizeCwd(cwd) {
|
|
2675
|
+
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
2676
|
+
if (cwd instanceof URL) return fileURLToPath$1(cwd).replace(BACKSLASHES, "/");
|
|
2677
|
+
return path$1.resolve(cwd).replace(BACKSLASHES, "/");
|
|
2678
|
+
}
|
|
2679
|
+
function getCrawler(patterns, inputOptions = {}) {
|
|
2680
|
+
const options = process.env.TINYGLOBBY_DEBUG ? {
|
|
2681
|
+
...inputOptions,
|
|
2682
|
+
debug: true
|
|
2683
|
+
} : inputOptions;
|
|
2684
|
+
const cwd = normalizeCwd(options.cwd);
|
|
2685
|
+
if (options.debug) log("globbing with:", {
|
|
2686
|
+
patterns,
|
|
2687
|
+
options,
|
|
2688
|
+
cwd
|
|
2689
|
+
});
|
|
2690
|
+
if (Array.isArray(patterns) && patterns.length === 0) return [{
|
|
2691
|
+
sync: () => [],
|
|
2692
|
+
withPromise: async () => []
|
|
2693
|
+
}, false];
|
|
2694
|
+
const props = {
|
|
2695
|
+
root: cwd,
|
|
2696
|
+
commonPath: null,
|
|
2697
|
+
depthOffset: 0
|
|
2698
|
+
};
|
|
2699
|
+
const processed = processPatterns({
|
|
2700
|
+
...options,
|
|
2701
|
+
patterns
|
|
2702
|
+
}, cwd, props);
|
|
2703
|
+
if (options.debug) log("internal processing patterns:", processed);
|
|
2704
|
+
const matchOptions = {
|
|
2705
|
+
dot: options.dot,
|
|
2706
|
+
nobrace: options.braceExpansion === false,
|
|
2707
|
+
nocase: options.caseSensitiveMatch === false,
|
|
2708
|
+
noextglob: options.extglob === false,
|
|
2709
|
+
noglobstar: options.globstar === false,
|
|
2710
|
+
posix: true
|
|
2711
|
+
};
|
|
2712
|
+
const matcher = (0, import_picomatch.default)(processed.match, {
|
|
2713
|
+
...matchOptions,
|
|
2714
|
+
ignore: processed.ignore
|
|
2715
|
+
});
|
|
2716
|
+
const ignore = (0, import_picomatch.default)(processed.ignore, matchOptions);
|
|
2717
|
+
const partialMatcher = getPartialMatcher(processed.match, matchOptions);
|
|
2718
|
+
const format = buildFormat(cwd, props.root, options.absolute);
|
|
2719
|
+
const formatExclude = options.absolute ? format : buildFormat(cwd, props.root, true);
|
|
2720
|
+
const fdirOptions = {
|
|
2721
|
+
filters: [options.debug ? (p, isDirectory) => {
|
|
2722
|
+
const path$1$1 = format(p, isDirectory);
|
|
2723
|
+
const matches = matcher(path$1$1);
|
|
2724
|
+
if (matches) log(`matched ${path$1$1}`);
|
|
2725
|
+
return matches;
|
|
2726
|
+
} : (p, isDirectory) => matcher(format(p, isDirectory))],
|
|
2727
|
+
exclude: options.debug ? (_, p) => {
|
|
2728
|
+
const relativePath = formatExclude(p, true);
|
|
2729
|
+
const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
2730
|
+
if (skipped) log(`skipped ${p}`);
|
|
2731
|
+
else log(`crawling ${p}`);
|
|
2732
|
+
return skipped;
|
|
2733
|
+
} : (_, p) => {
|
|
2734
|
+
const relativePath = formatExclude(p, true);
|
|
2735
|
+
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
2736
|
+
},
|
|
2737
|
+
fs: options.fs ? {
|
|
2738
|
+
readdir: options.fs.readdir || nativeFs.readdir,
|
|
2739
|
+
readdirSync: options.fs.readdirSync || nativeFs.readdirSync,
|
|
2740
|
+
realpath: options.fs.realpath || nativeFs.realpath,
|
|
2741
|
+
realpathSync: options.fs.realpathSync || nativeFs.realpathSync,
|
|
2742
|
+
stat: options.fs.stat || nativeFs.stat,
|
|
2743
|
+
statSync: options.fs.statSync || nativeFs.statSync
|
|
2744
|
+
} : void 0,
|
|
2745
|
+
pathSeparator: "/",
|
|
2746
|
+
relativePaths: true,
|
|
2747
|
+
resolveSymlinks: true,
|
|
2748
|
+
signal: options.signal
|
|
2749
|
+
};
|
|
2750
|
+
if (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
|
|
2751
|
+
if (options.absolute) {
|
|
2752
|
+
fdirOptions.relativePaths = false;
|
|
2753
|
+
fdirOptions.resolvePaths = true;
|
|
2754
|
+
fdirOptions.includeBasePath = true;
|
|
2755
|
+
}
|
|
2756
|
+
if (options.followSymbolicLinks === false) {
|
|
2757
|
+
fdirOptions.resolveSymlinks = false;
|
|
2758
|
+
fdirOptions.excludeSymlinks = true;
|
|
2759
|
+
}
|
|
2760
|
+
if (options.onlyDirectories) {
|
|
2761
|
+
fdirOptions.excludeFiles = true;
|
|
2762
|
+
fdirOptions.includeDirs = true;
|
|
2763
|
+
} else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
|
|
2764
|
+
props.root = props.root.replace(BACKSLASHES, "");
|
|
2765
|
+
const root = props.root;
|
|
2766
|
+
if (options.debug) log("internal properties:", props);
|
|
2767
|
+
const relative$1 = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
|
|
2768
|
+
return [new Builder(fdirOptions).crawl(root), relative$1];
|
|
2769
|
+
}
|
|
2770
|
+
async function glob(patternsOrOptions, options) {
|
|
2771
|
+
if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
2772
|
+
const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
|
|
2773
|
+
const opts = isModern ? options : patternsOrOptions;
|
|
2774
|
+
const [crawler, relative$1] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
|
|
2775
|
+
if (!relative$1) return crawler.withPromise();
|
|
2776
|
+
return formatPaths(await crawler.withPromise(), relative$1);
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
//#endregion
|
|
2780
|
+
//#region src/core/template-reader.ts
|
|
2781
|
+
/**
|
|
2782
|
+
* Template reader - loads templates from embedded or filesystem
|
|
2783
|
+
* Uses modern libraries: pathe, tinyglobby, is-binary-path
|
|
2784
|
+
*/
|
|
2785
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
2786
|
+
/**
|
|
2787
|
+
* Get the root path where templates are stored
|
|
2788
|
+
*/
|
|
2789
|
+
function getTemplatesRoot() {
|
|
2790
|
+
const possiblePaths = [
|
|
2791
|
+
join(__dirname, "../templates"),
|
|
2792
|
+
join(__dirname, "../../templates"),
|
|
2793
|
+
join(__dirname, "../../../templates")
|
|
2794
|
+
];
|
|
2795
|
+
for (const p of possiblePaths) if (fs.existsSync(p)) return p;
|
|
2796
|
+
throw new Error("Templates directory not found. Checked: " + possiblePaths.join(", "));
|
|
2797
|
+
}
|
|
2798
|
+
/**
|
|
2799
|
+
* Load all templates from a directory prefix into a Map
|
|
2800
|
+
* This is the primary way to load templates for processing
|
|
2801
|
+
*/
|
|
2802
|
+
async function loadTemplates(prefix) {
|
|
2803
|
+
const templatesRoot = getTemplatesRoot();
|
|
2804
|
+
const searchDir = prefix ? join(templatesRoot, prefix) : templatesRoot;
|
|
2805
|
+
if (!fs.existsSync(searchDir)) return /* @__PURE__ */ new Map();
|
|
2806
|
+
const files = await glob("**/*", {
|
|
2807
|
+
cwd: searchDir,
|
|
2808
|
+
dot: true,
|
|
2809
|
+
onlyFiles: true
|
|
2810
|
+
});
|
|
2811
|
+
const templates = /* @__PURE__ */ new Map();
|
|
2812
|
+
for (const file of files) {
|
|
2813
|
+
const fullPath = join(searchDir, file);
|
|
2814
|
+
const relativePath = prefix ? `${prefix}/${file}` : file;
|
|
2815
|
+
try {
|
|
2816
|
+
if (isBinaryPath(file)) templates.set(relativePath, "[Binary file]");
|
|
2817
|
+
else {
|
|
2818
|
+
const content = fs.readFileSync(fullPath, "utf-8");
|
|
2819
|
+
templates.set(relativePath, content);
|
|
2820
|
+
}
|
|
2821
|
+
} catch (error) {
|
|
2822
|
+
console.warn(`Failed to read template: ${relativePath}`, error);
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
return templates;
|
|
2826
|
+
}
|
|
2827
|
+
/**
|
|
2828
|
+
* Load a single template file
|
|
2829
|
+
*/
|
|
2830
|
+
function loadTemplate(relativePath) {
|
|
2831
|
+
const fullPath = join(getTemplatesRoot(), relativePath);
|
|
2832
|
+
if (!fs.existsSync(fullPath)) return;
|
|
2833
|
+
if (isBinaryPath(relativePath)) return "[Binary file]";
|
|
2834
|
+
return fs.readFileSync(fullPath, "utf-8");
|
|
2835
|
+
}
|
|
2836
|
+
/**
|
|
2837
|
+
* List all template paths matching a pattern
|
|
2838
|
+
*/
|
|
2839
|
+
async function listTemplates(prefix) {
|
|
2840
|
+
const templatesRoot = getTemplatesRoot();
|
|
2841
|
+
const searchDir = prefix ? join(templatesRoot, prefix) : templatesRoot;
|
|
2842
|
+
if (!fs.existsSync(searchDir)) return [];
|
|
2843
|
+
const files = await glob("**/*", {
|
|
2844
|
+
cwd: searchDir,
|
|
2845
|
+
dot: true,
|
|
2846
|
+
onlyFiles: true
|
|
2847
|
+
});
|
|
2848
|
+
return prefix ? files.map((f) => `${prefix}/${f}`) : files;
|
|
2849
|
+
}
|
|
2850
|
+
/**
|
|
2851
|
+
* Check if path is a binary file
|
|
2852
|
+
* Uses is-binary-path package for comprehensive detection
|
|
2853
|
+
*/
|
|
2854
|
+
function isBinary(filePath) {
|
|
2855
|
+
return isBinaryPath(filePath);
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
//#endregion
|
|
2859
|
+
export { getTemplatesRoot as TEMPLATES_ROOT, getTemplatesRoot, isBinary, listTemplates, loadTemplate, loadTemplates };
|
|
2860
|
+
//# sourceMappingURL=template-reader.mjs.map
|