From c150f487261471807474fc645d54b80cd35fbcc5 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Sun, 7 Jul 2024 12:38:42 -0400 Subject: [PATCH 1/5] Move unplugin to source/unplugin, examples to integration/unplugin-examples --- build/build.sh | 8 +- build/esbuild.civet | 47 ++- civet.dev/config.md | 4 +- civet.dev/getting-started.md | 6 +- civet.dev/integrations.md | 4 +- civet.dev/reference.md | 2 +- .../astro/.gitignore | 0 .../astro/.vscode/extensions.json | 0 .../astro/.vscode/launch.json | 0 .../astro/README.md | 0 .../astro/astro.config.mjs | 0 .../astro/package.json | 0 .../astro/public/favicon.svg | 0 .../astro/src/component.civet | 0 .../astro/src/env.d.ts | 0 .../astro/src/pages/index.astro | 0 .../astro/tsconfig.json | 0 .../esbuild/esbuild.js | 0 .../esbuild/package.json | 0 .../esbuild/src/main.civet | 0 .../esbuild/src/module.civet | 0 .../nextjs/.gitignore | 0 .../nextjs/README.md | 0 .../nextjs/components/button.civet | 0 .../nextjs/next.config.js | 0 .../nextjs/package-lock.json | 0 .../nextjs/package.json | 0 .../nextjs/pages/_app.tsx | 0 .../nextjs/pages/_document.tsx | 0 .../nextjs/pages/about.civet | 0 .../nextjs/pages/api/hello.ts | 0 .../nextjs/pages/index.tsx | 0 .../nextjs/public/favicon.ico | Bin .../nextjs/public/next.svg | 0 .../nextjs/public/thirteen.svg | 0 .../nextjs/public/vercel.svg | 0 .../nextjs/styles/Home.module.css | 0 .../nextjs/styles/globals.css | 0 .../nextjs/tsconfig.json | 0 .../rollup/main.civet | 0 .../rollup/package.json | 0 .../rollup/rollup.config.js | 0 .../rollup/tsconfig.json | 0 .../rollup/utils/module.civet | 0 .../vite-lib/index.html | 0 .../vite-lib/package.json | 0 .../vite-lib/src/main.civet | 0 .../vite-lib/src/module.civet | 0 .../vite-lib/tsconfig.json | 0 .../vite-lib/vite.config.js | 0 .../vite/index.html | 0 .../vite/package.json | 0 .../vite/src/main.civet | 0 .../vite/src/module.civet | 0 .../vite/vite.config.js | 0 .../webpack/main.civet | 0 .../webpack/module.civet | 0 .../webpack/package.json | 0 .../webpack/webpack.config.js | 0 integration/unplugin/package.json | 7 - integration/unplugin/src/rollup.ts | 3 - integration/unplugin/src/vite.ts | 3 - integration/unplugin/src/webpack.ts | 3 - integration/unplugin/tsup.config.ts | 27 -- package.json | 1 - {integration => source}/unplugin/README.md | 5 + .../unplugin/src => source/unplugin}/astro.ts | 2 +- .../src => source/unplugin}/constants.ts | 0 .../src => source/unplugin}/esbuild.ts | 2 +- source/unplugin/rollup.ts | 3 + .../index.ts => source/unplugin/unplugin.ts | 0 source/unplugin/vite.ts | 3 + source/unplugin/webpack.ts | 3 + tsconfig.json | 3 +- yarn.lock | 375 +----------------- 75 files changed, 77 insertions(+), 434 deletions(-) rename integration/{unplugin/examples => unplugin-examples}/astro/.gitignore (100%) rename integration/{unplugin/examples => unplugin-examples}/astro/.vscode/extensions.json (100%) rename integration/{unplugin/examples => unplugin-examples}/astro/.vscode/launch.json (100%) rename integration/{unplugin/examples => unplugin-examples}/astro/README.md (100%) rename integration/{unplugin/examples => unplugin-examples}/astro/astro.config.mjs (100%) rename integration/{unplugin/examples => unplugin-examples}/astro/package.json (100%) rename integration/{unplugin/examples => unplugin-examples}/astro/public/favicon.svg (100%) rename integration/{unplugin/examples => unplugin-examples}/astro/src/component.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/astro/src/env.d.ts (100%) rename integration/{unplugin/examples => unplugin-examples}/astro/src/pages/index.astro (100%) rename integration/{unplugin/examples => unplugin-examples}/astro/tsconfig.json (100%) rename integration/{unplugin/examples => unplugin-examples}/esbuild/esbuild.js (100%) rename integration/{unplugin/examples => unplugin-examples}/esbuild/package.json (100%) rename integration/{unplugin/examples => unplugin-examples}/esbuild/src/main.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/esbuild/src/module.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/.gitignore (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/README.md (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/components/button.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/next.config.js (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/package-lock.json (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/package.json (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/pages/_app.tsx (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/pages/_document.tsx (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/pages/about.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/pages/api/hello.ts (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/pages/index.tsx (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/public/favicon.ico (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/public/next.svg (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/public/thirteen.svg (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/public/vercel.svg (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/styles/Home.module.css (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/styles/globals.css (100%) rename integration/{unplugin/examples => unplugin-examples}/nextjs/tsconfig.json (100%) rename integration/{unplugin/examples => unplugin-examples}/rollup/main.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/rollup/package.json (100%) rename integration/{unplugin/examples => unplugin-examples}/rollup/rollup.config.js (100%) rename integration/{unplugin/examples => unplugin-examples}/rollup/tsconfig.json (100%) rename integration/{unplugin/examples => unplugin-examples}/rollup/utils/module.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/vite-lib/index.html (100%) rename integration/{unplugin/examples => unplugin-examples}/vite-lib/package.json (100%) rename integration/{unplugin/examples => unplugin-examples}/vite-lib/src/main.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/vite-lib/src/module.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/vite-lib/tsconfig.json (100%) rename integration/{unplugin/examples => unplugin-examples}/vite-lib/vite.config.js (100%) rename integration/{unplugin/examples => unplugin-examples}/vite/index.html (100%) rename integration/{unplugin/examples => unplugin-examples}/vite/package.json (100%) rename integration/{unplugin/examples => unplugin-examples}/vite/src/main.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/vite/src/module.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/vite/vite.config.js (100%) rename integration/{unplugin/examples => unplugin-examples}/webpack/main.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/webpack/module.civet (100%) rename integration/{unplugin/examples => unplugin-examples}/webpack/package.json (100%) rename integration/{unplugin/examples => unplugin-examples}/webpack/webpack.config.js (100%) delete mode 100644 integration/unplugin/package.json delete mode 100644 integration/unplugin/src/rollup.ts delete mode 100644 integration/unplugin/src/vite.ts delete mode 100644 integration/unplugin/src/webpack.ts delete mode 100644 integration/unplugin/tsup.config.ts rename {integration => source}/unplugin/README.md (96%) rename {integration/unplugin/src => source/unplugin}/astro.ts (89%) rename {integration/unplugin/src => source/unplugin}/constants.ts (100%) rename {integration/unplugin/src => source/unplugin}/esbuild.ts (50%) create mode 100644 source/unplugin/rollup.ts rename integration/unplugin/src/index.ts => source/unplugin/unplugin.ts (100%) create mode 100644 source/unplugin/vite.ts create mode 100644 source/unplugin/webpack.ts diff --git a/build/build.sh b/build/build.sh index efa6842d..6b3f5c0d 100755 --- a/build/build.sh +++ b/build/build.sh @@ -4,6 +4,9 @@ set -euo pipefail # clean build rm -rf dist +# tree-shake needed constants from Vite +node -e 'import("./node_modules/vite/dist/node/constants.js").then((c)=>console.log(`export const DEFAULT_EXTENSIONS = ${JSON.stringify(c.DEFAULT_EXTENSIONS)}`))' >./source/unplugin/constants.ts + # normal files civet --no-config build/esbuild.civet "$@" @@ -19,11 +22,6 @@ cp source/babel-plugin.mjs dist/babel-plugin.mjs # types cp types/types.d.ts dist/types.d.ts -# unplugin -node -e 'import("./node_modules/vite/dist/node/constants.js").then((c)=>console.log(`export const DEFAULT_EXTENSIONS = ${JSON.stringify(c.DEFAULT_EXTENSIONS)}`))' >./integration/unplugin/src/constants.ts -yarn --cwd ./integration/unplugin build -cp ./integration/unplugin/dist/* ./dist - # create browser build for docs terser dist/browser.js --compress --mangle --ecma 2015 --output civet.dev/public/__civet.js diff --git a/build/esbuild.civet b/build/esbuild.civet index eaaec37d..e0703308 100644 --- a/build/esbuild.civet +++ b/build/esbuild.civet @@ -2,6 +2,7 @@ esbuild := require "esbuild" heraPlugin := require "@danielx/hera/esbuild-plugin" // Need to use the packaged version because we may not have built our own yet civetPlugin := require "../node_modules/@danielx/civet/dist/esbuild-plugin.js" +civetUnplugin := require("../node_modules/@danielx/civet/dist/esbuild.js").default path := require "path" {access} := require "fs/promises" @@ -22,11 +23,11 @@ exists := (p) -> .catch -> false -extensionResolverPlugin := (extensions) -> +extensionResolverPlugin := (extensions) => { name: "extension-resolve" - setup: (build) -> + setup(build) // For relative requires that don't contain a '.' - build.onResolve { filter: /\/[^.]*$/ }, (r) -> + build.onResolve { filter: /\/[^.]*$/ }, (r) => for extension of extensions {path: resolvePath, resolveDir} = r p := path.join(resolveDir, resolvePath + `.${extension}`) @@ -37,6 +38,7 @@ extensionResolverPlugin := (extensions) -> return path: p return undefined +} resolveExtensions := extensionResolverPlugin(["civet", "hera"]) @@ -45,17 +47,17 @@ resolveExtensions := extensionResolverPlugin(["civet", "hera"]) // set bundle: true, then rewrite .coffee -> .js and mark as external // Also marking everything else as external since we don't want to bundle anything rewriteCivetImports := { - name: 'rewrite-civet', - setup: (build) -> - build.onResolve { filter: /.*/ }, (args) -> - if (args.importer) + name: 'rewrite-civet' + setup(build) + build.onResolve { filter: /.*/ }, (args) => + if args.importer path: args.path.replace(/\.civet$/, ".js") external: true } // Files that need civet imports re-written // since they aren't actually bundled -["cli", "config", "esbuild-plugin"].forEach (name) -> +for name of ["cli", "config", "esbuild-plugin"] build({ entryPoints: [`source/${name}.civet`] bundle: true @@ -73,7 +75,7 @@ rewriteCivetImports := { }).catch -> process.exit 1 // esm needs to be a module for import.meta -["esm"].forEach (name) -> +for name of ["esm"] build({ entryPoints: [`source/${name}.civet`] bundle: true @@ -133,6 +135,33 @@ build({ ] }).catch -> process.exit 1 +for format of ["esm", "cjs"] + build({ + entryPoints: + for name of [ 'unplugin', 'webpack', 'vite', 'rollup', 'esbuild', 'astro' ] + `source/unplugin/${name}.ts` + chunkNames: 'unplugin-shared' + bundle: true + sourcemap + minify + platform: 'node' + format + external: [ + '@danielx/civet' + 'typescript' + '@typescript/vfs' + 'unplugin' + 'esbuild' + ] + target: "esNext" + outdir: 'dist' + outExtension: { ".js": if format == "esm" then ".mjs" else ".js" } + plugins: [ + civetUnplugin + ts: 'civet' + emitDeclaration: true + ] + }).catch -> process.exit 1 for format of ["esm", "cjs"] build({ diff --git a/civet.dev/config.md b/civet.dev/config.md index 5e7d3f9e..67389cab 100644 --- a/civet.dev/config.md +++ b/civet.dev/config.md @@ -138,8 +138,8 @@ For example, the [directive](#local-configuration-via-directives) ## Global Configuration within Build Tools -The [unplugin](https://github.com/DanielXMoore/Civet/blob/main/integration/unplugin) -offers [options](https://github.com/DanielXMoore/Civet/tree/main/integration/unplugin#options) +The [unplugin](https://github.com/DanielXMoore/Civet/blob/main/source/unplugin) +offers [options](https://github.com/DanielXMoore/Civet/tree/main/source/unplugin#options) to specify global config directives (overriding even config files) and to specify or disable a config file. For example: diff --git a/civet.dev/getting-started.md b/civet.dev/getting-started.md index 946679ab..194837c2 100644 --- a/civet.dev/getting-started.md +++ b/civet.dev/getting-started.md @@ -188,7 +188,7 @@ civet --emit-declaration src/**/*.civet ## Building a project -Use Civet's built-in [unplugin](https://github.com/DanielXMoore/Civet/blob/main/integration/unplugin) to integrate with many +Use Civet's built-in [unplugin](https://github.com/DanielXMoore/Civet/blob/main/source/unplugin) to integrate with many bundlers: Vite, esbuild, Astro, Rollup, Webpack, or Rspack. For example: ```js @@ -221,8 +221,8 @@ You can mix and match `.civet` files with `.js` and `.ts` files. Even `.coffee` will work if you require `coffeescript/register` or add a loader for it. ::: -See the [unplugin documentation](https://github.com/DanielXMoore/Civet/blob/main/integration/unplugin) for more configurations, -including [full working examples](https://github.com/DanielXMoore/Civet/blob/main/integration/unplugin/examples). +See the [unplugin documentation](https://github.com/DanielXMoore/Civet/blob/main/source/unplugin) for more configurations, +including [full working examples](https://github.com/DanielXMoore/Civet/blob/main/integration/unplugin-examples). These plugins should support metaframeworks built upon these bundlers. For example, the esbuild unplugin supports [tsup](https://github.com/egoist/tsup): diff --git a/civet.dev/integrations.md b/civet.dev/integrations.md index 68c7329c..d9c731e9 100644 --- a/civet.dev/integrations.md +++ b/civet.dev/integrations.md @@ -10,7 +10,7 @@ title: Integrations ## Build tools -- [unplugin](https://github.com/DanielXMoore/Civet/blob/main/integration/unplugin) integrates Civet into Vite, esbuild, Astro, Rollup, Webpack, and Rspack, including `.d.ts` generation (see [basic instructions](https://civet.dev/getting-started#building-a-project)) +- [unplugin](https://github.com/DanielXMoore/Civet/blob/main/source/unplugin) integrates Civet into Vite, esbuild, Astro, Rollup, Webpack, and Rspack, including `.d.ts` generation (see [basic instructions](https://civet.dev/getting-started#building-a-project)) - [Simpler esbuild plugin](https://github.com/DanielXMoore/Civet/blob/main/source/esbuild-plugin.civet) - [Older Vite plugin](https://github.com/edemaine/vite-plugin-civet) (no longer recommended) - [ESM/CJS loader](https://github.com/DanielXMoore/Civet/blob/main/register.js) for `import`/`require` to support `.civet` files @@ -21,7 +21,7 @@ title: Integrations ## Starter Templates -- [Astro, Rollup, Vite, and Webpack](https://github.com/DanielXMoore/Civet/blob/main/integration/unplugin/examples) +- [Astro, esbuild, NextJS, Rollup, Vite, and Webpack](https://github.com/DanielXMoore/Civet/blob/main/integration/unplugin-examples) - [Solid](https://github.com/orenelbaum/solid-civet-template) - [SolidStart](https://github.com/orenelbaum/solid-start-civet-template) diff --git a/civet.dev/reference.md b/civet.dev/reference.md index 50781e32..c1aededb 100644 --- a/civet.dev/reference.md +++ b/civet.dev/reference.md @@ -1697,7 +1697,7 @@ is not enabled by default, nor can it be enabled via a directive or config file. In particular, the VSCode language server will not execute `comptime` blocks. You can enable `comptime` evaluation in the CLI using `civet --comptime`, and in the -[unplugin](https://github.com/DanielXMoore/Civet/tree/main/integration/unplugin) +[unplugin](https://github.com/DanielXMoore/Civet/tree/main/source/unplugin) using the `comptime: true` option. If not enabled, `comptime` blocks will execute at runtime. diff --git a/integration/unplugin/examples/astro/.gitignore b/integration/unplugin-examples/astro/.gitignore similarity index 100% rename from integration/unplugin/examples/astro/.gitignore rename to integration/unplugin-examples/astro/.gitignore diff --git a/integration/unplugin/examples/astro/.vscode/extensions.json b/integration/unplugin-examples/astro/.vscode/extensions.json similarity index 100% rename from integration/unplugin/examples/astro/.vscode/extensions.json rename to integration/unplugin-examples/astro/.vscode/extensions.json diff --git a/integration/unplugin/examples/astro/.vscode/launch.json b/integration/unplugin-examples/astro/.vscode/launch.json similarity index 100% rename from integration/unplugin/examples/astro/.vscode/launch.json rename to integration/unplugin-examples/astro/.vscode/launch.json diff --git a/integration/unplugin/examples/astro/README.md b/integration/unplugin-examples/astro/README.md similarity index 100% rename from integration/unplugin/examples/astro/README.md rename to integration/unplugin-examples/astro/README.md diff --git a/integration/unplugin/examples/astro/astro.config.mjs b/integration/unplugin-examples/astro/astro.config.mjs similarity index 100% rename from integration/unplugin/examples/astro/astro.config.mjs rename to integration/unplugin-examples/astro/astro.config.mjs diff --git a/integration/unplugin/examples/astro/package.json b/integration/unplugin-examples/astro/package.json similarity index 100% rename from integration/unplugin/examples/astro/package.json rename to integration/unplugin-examples/astro/package.json diff --git a/integration/unplugin/examples/astro/public/favicon.svg b/integration/unplugin-examples/astro/public/favicon.svg similarity index 100% rename from integration/unplugin/examples/astro/public/favicon.svg rename to integration/unplugin-examples/astro/public/favicon.svg diff --git a/integration/unplugin/examples/astro/src/component.civet b/integration/unplugin-examples/astro/src/component.civet similarity index 100% rename from integration/unplugin/examples/astro/src/component.civet rename to integration/unplugin-examples/astro/src/component.civet diff --git a/integration/unplugin/examples/astro/src/env.d.ts b/integration/unplugin-examples/astro/src/env.d.ts similarity index 100% rename from integration/unplugin/examples/astro/src/env.d.ts rename to integration/unplugin-examples/astro/src/env.d.ts diff --git a/integration/unplugin/examples/astro/src/pages/index.astro b/integration/unplugin-examples/astro/src/pages/index.astro similarity index 100% rename from integration/unplugin/examples/astro/src/pages/index.astro rename to integration/unplugin-examples/astro/src/pages/index.astro diff --git a/integration/unplugin/examples/astro/tsconfig.json b/integration/unplugin-examples/astro/tsconfig.json similarity index 100% rename from integration/unplugin/examples/astro/tsconfig.json rename to integration/unplugin-examples/astro/tsconfig.json diff --git a/integration/unplugin/examples/esbuild/esbuild.js b/integration/unplugin-examples/esbuild/esbuild.js similarity index 100% rename from integration/unplugin/examples/esbuild/esbuild.js rename to integration/unplugin-examples/esbuild/esbuild.js diff --git a/integration/unplugin/examples/esbuild/package.json b/integration/unplugin-examples/esbuild/package.json similarity index 100% rename from integration/unplugin/examples/esbuild/package.json rename to integration/unplugin-examples/esbuild/package.json diff --git a/integration/unplugin/examples/esbuild/src/main.civet b/integration/unplugin-examples/esbuild/src/main.civet similarity index 100% rename from integration/unplugin/examples/esbuild/src/main.civet rename to integration/unplugin-examples/esbuild/src/main.civet diff --git a/integration/unplugin/examples/esbuild/src/module.civet b/integration/unplugin-examples/esbuild/src/module.civet similarity index 100% rename from integration/unplugin/examples/esbuild/src/module.civet rename to integration/unplugin-examples/esbuild/src/module.civet diff --git a/integration/unplugin/examples/nextjs/.gitignore b/integration/unplugin-examples/nextjs/.gitignore similarity index 100% rename from integration/unplugin/examples/nextjs/.gitignore rename to integration/unplugin-examples/nextjs/.gitignore diff --git a/integration/unplugin/examples/nextjs/README.md b/integration/unplugin-examples/nextjs/README.md similarity index 100% rename from integration/unplugin/examples/nextjs/README.md rename to integration/unplugin-examples/nextjs/README.md diff --git a/integration/unplugin/examples/nextjs/components/button.civet b/integration/unplugin-examples/nextjs/components/button.civet similarity index 100% rename from integration/unplugin/examples/nextjs/components/button.civet rename to integration/unplugin-examples/nextjs/components/button.civet diff --git a/integration/unplugin/examples/nextjs/next.config.js b/integration/unplugin-examples/nextjs/next.config.js similarity index 100% rename from integration/unplugin/examples/nextjs/next.config.js rename to integration/unplugin-examples/nextjs/next.config.js diff --git a/integration/unplugin/examples/nextjs/package-lock.json b/integration/unplugin-examples/nextjs/package-lock.json similarity index 100% rename from integration/unplugin/examples/nextjs/package-lock.json rename to integration/unplugin-examples/nextjs/package-lock.json diff --git a/integration/unplugin/examples/nextjs/package.json b/integration/unplugin-examples/nextjs/package.json similarity index 100% rename from integration/unplugin/examples/nextjs/package.json rename to integration/unplugin-examples/nextjs/package.json diff --git a/integration/unplugin/examples/nextjs/pages/_app.tsx b/integration/unplugin-examples/nextjs/pages/_app.tsx similarity index 100% rename from integration/unplugin/examples/nextjs/pages/_app.tsx rename to integration/unplugin-examples/nextjs/pages/_app.tsx diff --git a/integration/unplugin/examples/nextjs/pages/_document.tsx b/integration/unplugin-examples/nextjs/pages/_document.tsx similarity index 100% rename from integration/unplugin/examples/nextjs/pages/_document.tsx rename to integration/unplugin-examples/nextjs/pages/_document.tsx diff --git a/integration/unplugin/examples/nextjs/pages/about.civet b/integration/unplugin-examples/nextjs/pages/about.civet similarity index 100% rename from integration/unplugin/examples/nextjs/pages/about.civet rename to integration/unplugin-examples/nextjs/pages/about.civet diff --git a/integration/unplugin/examples/nextjs/pages/api/hello.ts b/integration/unplugin-examples/nextjs/pages/api/hello.ts similarity index 100% rename from integration/unplugin/examples/nextjs/pages/api/hello.ts rename to integration/unplugin-examples/nextjs/pages/api/hello.ts diff --git a/integration/unplugin/examples/nextjs/pages/index.tsx b/integration/unplugin-examples/nextjs/pages/index.tsx similarity index 100% rename from integration/unplugin/examples/nextjs/pages/index.tsx rename to integration/unplugin-examples/nextjs/pages/index.tsx diff --git a/integration/unplugin/examples/nextjs/public/favicon.ico b/integration/unplugin-examples/nextjs/public/favicon.ico similarity index 100% rename from integration/unplugin/examples/nextjs/public/favicon.ico rename to integration/unplugin-examples/nextjs/public/favicon.ico diff --git a/integration/unplugin/examples/nextjs/public/next.svg b/integration/unplugin-examples/nextjs/public/next.svg similarity index 100% rename from integration/unplugin/examples/nextjs/public/next.svg rename to integration/unplugin-examples/nextjs/public/next.svg diff --git a/integration/unplugin/examples/nextjs/public/thirteen.svg b/integration/unplugin-examples/nextjs/public/thirteen.svg similarity index 100% rename from integration/unplugin/examples/nextjs/public/thirteen.svg rename to integration/unplugin-examples/nextjs/public/thirteen.svg diff --git a/integration/unplugin/examples/nextjs/public/vercel.svg b/integration/unplugin-examples/nextjs/public/vercel.svg similarity index 100% rename from integration/unplugin/examples/nextjs/public/vercel.svg rename to integration/unplugin-examples/nextjs/public/vercel.svg diff --git a/integration/unplugin/examples/nextjs/styles/Home.module.css b/integration/unplugin-examples/nextjs/styles/Home.module.css similarity index 100% rename from integration/unplugin/examples/nextjs/styles/Home.module.css rename to integration/unplugin-examples/nextjs/styles/Home.module.css diff --git a/integration/unplugin/examples/nextjs/styles/globals.css b/integration/unplugin-examples/nextjs/styles/globals.css similarity index 100% rename from integration/unplugin/examples/nextjs/styles/globals.css rename to integration/unplugin-examples/nextjs/styles/globals.css diff --git a/integration/unplugin/examples/nextjs/tsconfig.json b/integration/unplugin-examples/nextjs/tsconfig.json similarity index 100% rename from integration/unplugin/examples/nextjs/tsconfig.json rename to integration/unplugin-examples/nextjs/tsconfig.json diff --git a/integration/unplugin/examples/rollup/main.civet b/integration/unplugin-examples/rollup/main.civet similarity index 100% rename from integration/unplugin/examples/rollup/main.civet rename to integration/unplugin-examples/rollup/main.civet diff --git a/integration/unplugin/examples/rollup/package.json b/integration/unplugin-examples/rollup/package.json similarity index 100% rename from integration/unplugin/examples/rollup/package.json rename to integration/unplugin-examples/rollup/package.json diff --git a/integration/unplugin/examples/rollup/rollup.config.js b/integration/unplugin-examples/rollup/rollup.config.js similarity index 100% rename from integration/unplugin/examples/rollup/rollup.config.js rename to integration/unplugin-examples/rollup/rollup.config.js diff --git a/integration/unplugin/examples/rollup/tsconfig.json b/integration/unplugin-examples/rollup/tsconfig.json similarity index 100% rename from integration/unplugin/examples/rollup/tsconfig.json rename to integration/unplugin-examples/rollup/tsconfig.json diff --git a/integration/unplugin/examples/rollup/utils/module.civet b/integration/unplugin-examples/rollup/utils/module.civet similarity index 100% rename from integration/unplugin/examples/rollup/utils/module.civet rename to integration/unplugin-examples/rollup/utils/module.civet diff --git a/integration/unplugin/examples/vite-lib/index.html b/integration/unplugin-examples/vite-lib/index.html similarity index 100% rename from integration/unplugin/examples/vite-lib/index.html rename to integration/unplugin-examples/vite-lib/index.html diff --git a/integration/unplugin/examples/vite-lib/package.json b/integration/unplugin-examples/vite-lib/package.json similarity index 100% rename from integration/unplugin/examples/vite-lib/package.json rename to integration/unplugin-examples/vite-lib/package.json diff --git a/integration/unplugin/examples/vite-lib/src/main.civet b/integration/unplugin-examples/vite-lib/src/main.civet similarity index 100% rename from integration/unplugin/examples/vite-lib/src/main.civet rename to integration/unplugin-examples/vite-lib/src/main.civet diff --git a/integration/unplugin/examples/vite-lib/src/module.civet b/integration/unplugin-examples/vite-lib/src/module.civet similarity index 100% rename from integration/unplugin/examples/vite-lib/src/module.civet rename to integration/unplugin-examples/vite-lib/src/module.civet diff --git a/integration/unplugin/examples/vite-lib/tsconfig.json b/integration/unplugin-examples/vite-lib/tsconfig.json similarity index 100% rename from integration/unplugin/examples/vite-lib/tsconfig.json rename to integration/unplugin-examples/vite-lib/tsconfig.json diff --git a/integration/unplugin/examples/vite-lib/vite.config.js b/integration/unplugin-examples/vite-lib/vite.config.js similarity index 100% rename from integration/unplugin/examples/vite-lib/vite.config.js rename to integration/unplugin-examples/vite-lib/vite.config.js diff --git a/integration/unplugin/examples/vite/index.html b/integration/unplugin-examples/vite/index.html similarity index 100% rename from integration/unplugin/examples/vite/index.html rename to integration/unplugin-examples/vite/index.html diff --git a/integration/unplugin/examples/vite/package.json b/integration/unplugin-examples/vite/package.json similarity index 100% rename from integration/unplugin/examples/vite/package.json rename to integration/unplugin-examples/vite/package.json diff --git a/integration/unplugin/examples/vite/src/main.civet b/integration/unplugin-examples/vite/src/main.civet similarity index 100% rename from integration/unplugin/examples/vite/src/main.civet rename to integration/unplugin-examples/vite/src/main.civet diff --git a/integration/unplugin/examples/vite/src/module.civet b/integration/unplugin-examples/vite/src/module.civet similarity index 100% rename from integration/unplugin/examples/vite/src/module.civet rename to integration/unplugin-examples/vite/src/module.civet diff --git a/integration/unplugin/examples/vite/vite.config.js b/integration/unplugin-examples/vite/vite.config.js similarity index 100% rename from integration/unplugin/examples/vite/vite.config.js rename to integration/unplugin-examples/vite/vite.config.js diff --git a/integration/unplugin/examples/webpack/main.civet b/integration/unplugin-examples/webpack/main.civet similarity index 100% rename from integration/unplugin/examples/webpack/main.civet rename to integration/unplugin-examples/webpack/main.civet diff --git a/integration/unplugin/examples/webpack/module.civet b/integration/unplugin-examples/webpack/module.civet similarity index 100% rename from integration/unplugin/examples/webpack/module.civet rename to integration/unplugin-examples/webpack/module.civet diff --git a/integration/unplugin/examples/webpack/package.json b/integration/unplugin-examples/webpack/package.json similarity index 100% rename from integration/unplugin/examples/webpack/package.json rename to integration/unplugin-examples/webpack/package.json diff --git a/integration/unplugin/examples/webpack/webpack.config.js b/integration/unplugin-examples/webpack/webpack.config.js similarity index 100% rename from integration/unplugin/examples/webpack/webpack.config.js rename to integration/unplugin-examples/webpack/webpack.config.js diff --git a/integration/unplugin/package.json b/integration/unplugin/package.json deleted file mode 100644 index da7cbe07..00000000 --- a/integration/unplugin/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "unplugin-civet", - "private": true, - "scripts": { - "build": "tsup" - } -} diff --git a/integration/unplugin/src/rollup.ts b/integration/unplugin/src/rollup.ts deleted file mode 100644 index 61e68cc5..00000000 --- a/integration/unplugin/src/rollup.ts +++ /dev/null @@ -1,3 +0,0 @@ -import civetUnplugin from '.' - -export default civetUnplugin.rollup; diff --git a/integration/unplugin/src/vite.ts b/integration/unplugin/src/vite.ts deleted file mode 100644 index b6e0bacd..00000000 --- a/integration/unplugin/src/vite.ts +++ /dev/null @@ -1,3 +0,0 @@ -import civetUnplugin from '.' - -export default civetUnplugin.vite; diff --git a/integration/unplugin/src/webpack.ts b/integration/unplugin/src/webpack.ts deleted file mode 100644 index a0ad63e7..00000000 --- a/integration/unplugin/src/webpack.ts +++ /dev/null @@ -1,3 +0,0 @@ -import civetUnplugin from '.'; - -export default civetUnplugin.webpack; diff --git a/integration/unplugin/tsup.config.ts b/integration/unplugin/tsup.config.ts deleted file mode 100644 index ee66fb8f..00000000 --- a/integration/unplugin/tsup.config.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { defineConfig } from 'tsup'; - -export default defineConfig({ - entryPoints: { - unplugin: 'src/index.ts', - webpack: 'src/webpack.ts', - vite: 'src/vite.ts', - rollup: 'src/rollup.ts', - esbuild: 'src/esbuild.ts', - astro: 'src/astro.ts', - }, - esbuildOptions(opts) { - opts.chunkNames = 'unplugin-shared'; - }, - outDir: 'dist', - format: ['esm', 'cjs'], - dts: true, - platform: 'node', - clean: true, - external: [ - '@danielx/civet', - 'typescript', - '@typescript/vfs', - 'unplugin', - 'esbuild', - ], -}); diff --git a/package.json b/package.json index f316cc4b..a0a023ef 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,6 @@ "terser": "^5.16.1", "ts-node": "^10.9.1", "tslib": "^2.4.0", - "tsup": "^7.2.0", "typescript": "^5.5.2", "vite": "^4.4.12", "vitepress": "^1.0.0-alpha.35", diff --git a/integration/unplugin/README.md b/source/unplugin/README.md similarity index 96% rename from integration/unplugin/README.md rename to source/unplugin/README.md index d3345048..6522f707 100644 --- a/integration/unplugin/README.md +++ b/source/unplugin/README.md @@ -133,3 +133,8 @@ interface PluginOptions { [`comptime` blocks](https://civet.dev/reference#comptime-blocks) at compile time. Default: `false`. - `transformOutput(code, id)`: Adds a custom transformer over jsx/tsx code produced by `civet.compile`. It gets passed the jsx/tsx source (`code`) and filename (`id`), and should return valid jsx/tsx code. + +## Examples + +See also [full examples of unplugin](../../integration/unplugin-examples). +in Astro, esbuild, NextJS, Rollup, Vite, and Webpack. diff --git a/integration/unplugin/src/astro.ts b/source/unplugin/astro.ts similarity index 89% rename from integration/unplugin/src/astro.ts rename to source/unplugin/astro.ts index 1581fd13..7be7d618 100644 --- a/integration/unplugin/src/astro.ts +++ b/source/unplugin/astro.ts @@ -6,7 +6,7 @@ interface AstroIntegration { } } -import civetUnplugin, { type PluginOptions } from '.' +import civetUnplugin, { type PluginOptions } from './unplugin' export default function(opts: PluginOptions = {}): AstroIntegration { return { diff --git a/integration/unplugin/src/constants.ts b/source/unplugin/constants.ts similarity index 100% rename from integration/unplugin/src/constants.ts rename to source/unplugin/constants.ts diff --git a/integration/unplugin/src/esbuild.ts b/source/unplugin/esbuild.ts similarity index 50% rename from integration/unplugin/src/esbuild.ts rename to source/unplugin/esbuild.ts index 9b99d75f..2b0fda46 100644 --- a/integration/unplugin/src/esbuild.ts +++ b/source/unplugin/esbuild.ts @@ -1,3 +1,3 @@ -import civetUnplugin from '.' +import civetUnplugin from './unplugin' export default civetUnplugin.esbuild; diff --git a/source/unplugin/rollup.ts b/source/unplugin/rollup.ts new file mode 100644 index 00000000..1e19e284 --- /dev/null +++ b/source/unplugin/rollup.ts @@ -0,0 +1,3 @@ +import civetUnplugin from './unplugin' + +export default civetUnplugin.rollup; diff --git a/integration/unplugin/src/index.ts b/source/unplugin/unplugin.ts similarity index 100% rename from integration/unplugin/src/index.ts rename to source/unplugin/unplugin.ts diff --git a/source/unplugin/vite.ts b/source/unplugin/vite.ts new file mode 100644 index 00000000..50375d56 --- /dev/null +++ b/source/unplugin/vite.ts @@ -0,0 +1,3 @@ +import civetUnplugin from './unplugin' + +export default civetUnplugin.vite; diff --git a/source/unplugin/webpack.ts b/source/unplugin/webpack.ts new file mode 100644 index 00000000..a9547930 --- /dev/null +++ b/source/unplugin/webpack.ts @@ -0,0 +1,3 @@ +import civetUnplugin from './unplugin'; + +export default civetUnplugin.webpack; diff --git a/tsconfig.json b/tsconfig.json index 762adee0..ec096f23 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -98,8 +98,7 @@ }, "exclude": [ "dist/**/*", - "integration/unplugin/dist/*", - "integration/unplugin/examples" + "integration/unplugin-examples" ], "include": [ "source", diff --git a/yarn.lock b/yarn.lock index dd3a5675..2ab05bbf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -417,7 +417,7 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": +"@jridgewell/gen-mapping@^0.3.0": version "0.3.3" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== @@ -465,27 +465,6 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@nodelib/fs.scandir@2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" - integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== - dependencies: - "@nodelib/fs.stat" "2.0.5" - run-parallel "^1.1.9" - -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" - integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== - -"@nodelib/fs.walk@^1.2.3": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" - integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== - dependencies: - "@nodelib/fs.scandir" "2.1.5" - fastq "^1.6.0" - "@prettier/sync@^0.5.2": version "0.5.2" resolved "https://registry.yarnpkg.com/@prettier/sync/-/sync-0.5.2.tgz#f8401e45b667e8d6207015fd03619ea2c2e3e680" @@ -737,11 +716,6 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" -any-promise@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" - integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== - anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -760,11 +734,6 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -array-union@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" - integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== - balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -790,7 +759,7 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -braces@^3.0.2, braces@~3.0.2: +braces@~3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== @@ -807,13 +776,6 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -bundle-require@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/bundle-require/-/bundle-require-4.0.1.tgz#2cc1ad76428043d15e0e7f30990ee3d5404aa2e3" - integrity sha512-9NQkRHlNdNpDBGmLpngF3EFDcwodhMUuLz9PaWYciVcQF9SE4LFjM2DB/xV1Li5JiuDMv7ZUWuC3rGbqR0MAXQ== - dependencies: - load-tsconfig "^0.2.3" - c8@^7.12.0: version "7.14.0" resolved "https://registry.yarnpkg.com/c8/-/c8-7.14.0.tgz#f368184c73b125a80565e9ab2396ff0be4d732f3" @@ -832,11 +794,6 @@ c8@^7.12.0: yargs "^16.2.0" yargs-parser "^20.2.9" -cac@^6.7.12: - version "6.7.14" - resolved "https://registry.yarnpkg.com/cac/-/cac-6.7.14.tgz#804e1e6f506ee363cb0e3ccbb09cad5dd9870959" - integrity sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ== - camelcase@^6.0.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" @@ -850,7 +807,7 @@ chalk@^4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chokidar@3.5.3, chokidar@^3.5.1, chokidar@^3.5.3: +chokidar@3.5.3, chokidar@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -891,11 +848,6 @@ commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" - integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== - concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -911,7 +863,7 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -cross-spawn@^7.0.0, cross-spawn@^7.0.3: +cross-spawn@^7.0.0: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -925,7 +877,7 @@ csstype@^3.1.1: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== -debug@4.3.4, debug@^4.1.1, debug@^4.3.1: +debug@4.3.4, debug@^4.1.1: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -947,13 +899,6 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -988,7 +933,7 @@ esbuild@0.20.0: "@esbuild/win32-ia32" "0.20.0" "@esbuild/win32-x64" "0.20.0" -esbuild@^0.18.10, esbuild@^0.18.2: +esbuild@^0.18.10: version "0.18.20" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.18.20.tgz#4709f5a34801b43b799ab7d6d82f7284a9b7a7a6" integrity sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA== @@ -1031,39 +976,6 @@ estree-walker@^2.0.2: resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== -execa@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" - integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== - dependencies: - cross-spawn "^7.0.3" - get-stream "^6.0.0" - human-signals "^2.1.0" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.1" - onetime "^5.1.2" - signal-exit "^3.0.3" - strip-final-newline "^2.0.0" - -fast-glob@^3.2.9: - version "3.3.1" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4" - integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fastq@^1.6.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" - integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== - dependencies: - reusify "^1.0.4" - fill-range@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" @@ -1114,30 +1026,13 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-stream@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" - integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== - -glob-parent@^5.1.2, glob-parent@~5.1.2: +glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" -glob@7.1.6: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" @@ -1162,18 +1057,6 @@ glob@^7.1.3, glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" -globby@^11.0.3: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" - slash "^3.0.0" - has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" @@ -1189,16 +1072,6 @@ html-escaper@^2.0.0: resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -human-signals@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" - integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== - -ignore@^5.2.0: - version "5.2.4" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" - integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== - inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -1246,11 +1119,6 @@ is-plain-obj@^2.1.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== -is-stream@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" - integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== - is-unicode-supported@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" @@ -1283,11 +1151,6 @@ istanbul-reports@^3.1.4: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -joycon@^3.0.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.1.1.tgz#bce8596d6ae808f8b68168f5fc69280996894f03" - integrity sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw== - js-yaml@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -1300,21 +1163,6 @@ jsonc-parser@^3.2.0: resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== -lilconfig@^2.0.5: - version "2.1.0" - resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" - integrity sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ== - -lines-and-columns@^1.1.6: - version "1.2.4" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" - integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== - -load-tsconfig@^0.2.3: - version "0.2.5" - resolved "https://registry.yarnpkg.com/load-tsconfig/-/load-tsconfig-0.2.5.tgz#453b8cd8961bfb912dea77eb6c168fe8cca3d3a1" - integrity sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg== - locate-path@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" @@ -1322,11 +1170,6 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" -lodash.sortby@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" - integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA== - log-symbols@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" @@ -1376,29 +1219,6 @@ marked@^4.2.4: resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3" integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A== -merge-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== - -merge2@^1.3.0, merge2@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" - integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== - -micromatch@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== - dependencies: - braces "^3.0.2" - picomatch "^2.3.1" - -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - minimatch@5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" @@ -1455,15 +1275,6 @@ ms@2.1.3: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -mz@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" - integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== - dependencies: - any-promise "^1.0.0" - object-assign "^4.0.1" - thenify-all "^1.0.0" - nanoid@3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" @@ -1479,18 +1290,6 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -npm-run-path@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== - dependencies: - path-key "^3.0.0" - -object-assign@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -1498,13 +1297,6 @@ once@^1.3.0: dependencies: wrappy "1" -onetime@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - dependencies: - mimic-fn "^2.1.0" - p-limit@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" @@ -1529,39 +1321,21 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== -path-key@^3.0.0, path-key@^3.1.0: +path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: +picomatch@^2.0.4, picomatch@^2.2.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -pirates@^4.0.1: - version "4.0.6" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" - integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== - -postcss-load-config@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-4.0.1.tgz#152383f481c2758274404e4962743191d73875bd" - integrity sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA== - dependencies: - lilconfig "^2.0.5" - yaml "^2.1.1" - postcss@^8.1.10, postcss@^8.4.27: version "8.4.31" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" @@ -1581,16 +1355,6 @@ prettier@^3.2.5: resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== -punycode@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" - integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== - -queue-microtask@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" - integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== - randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -1610,16 +1374,6 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - -reusify@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" - integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== - rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -1627,20 +1381,13 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" -rollup@^3.2.5, rollup@^3.27.1: +rollup@^3.27.1: version "3.28.1" resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.28.1.tgz#fb44aa6d5e65c7e13fd5bcfff266d0c4ea9ba433" integrity sha512-R9OMQmIHJm9znrU3m3cpE8uhN0fGdXiawME7aZIpQqvpS/85+Vt1Hq1/yVIcYfOmaQiHjvXkQAoJukvLpau6Yw== optionalDependencies: fsevents "~2.3.2" -run-parallel@^1.1.9: - version "1.2.0" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" - integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== - dependencies: - queue-microtask "^1.2.2" - safe-buffer@^5.1.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -1682,16 +1429,11 @@ shiki@^0.14.3: vscode-oniguruma "^1.7.0" vscode-textmate "^8.0.0" -signal-exit@^3.0.2, signal-exit@^3.0.3: +signal-exit@^3.0.2: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - source-map-js@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" @@ -1705,13 +1447,6 @@ source-map-support@~0.5.20: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@0.8.0-beta.0: - version "0.8.0-beta.0" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.8.0-beta.0.tgz#d4c1bb42c3f7ee925f005927ba10709e0d1d1f11" - integrity sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA== - dependencies: - whatwg-url "^7.0.0" - source-map@^0.6.0: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" @@ -1733,29 +1468,11 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== - strip-json-comments@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -sucrase@^3.20.3: - version "3.34.0" - resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.34.0.tgz#1e0e2d8fcf07f8b9c3569067d92fbd8690fb576f" - integrity sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw== - dependencies: - "@jridgewell/gen-mapping" "^0.3.2" - commander "^4.0.0" - glob "7.1.6" - lines-and-columns "^1.1.6" - mz "^2.7.0" - pirates "^4.0.1" - ts-interface-checker "^0.1.9" - supports-color@8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" @@ -1794,20 +1511,6 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" -thenify-all@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" - integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== - dependencies: - thenify ">= 3.1.0 < 4" - -"thenify@>= 3.1.0 < 4": - version "3.3.1" - resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" - integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== - dependencies: - any-promise "^1.0.0" - to-regex-range@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" @@ -1815,23 +1518,6 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -tr46@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" - integrity sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA== - dependencies: - punycode "^2.1.0" - -tree-kill@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" - integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== - -ts-interface-checker@^0.1.9: - version "0.1.13" - resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" - integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== - ts-node@^10.9.1: version "10.9.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" @@ -1856,26 +1542,6 @@ tslib@^2.4.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== -tsup@^7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/tsup/-/tsup-7.2.0.tgz#bb24c0d5e436477900c712e42adc67200607303c" - integrity sha512-vDHlczXbgUvY3rWvqFEbSqmC1L7woozbzngMqTtL2PGBODTtWlRwGDDawhvWzr5c1QjKe4OAKqJGfE1xeXUvtQ== - dependencies: - bundle-require "^4.0.0" - cac "^6.7.12" - chokidar "^3.5.1" - debug "^4.3.1" - esbuild "^0.18.2" - execa "^5.0.0" - globby "^11.0.3" - joycon "^3.0.1" - postcss-load-config "^4.0.1" - resolve-from "^5.0.0" - rollup "^3.2.5" - source-map "0.8.0-beta.0" - sucrase "^3.20.3" - tree-kill "^1.2.2" - typescript@^5.5.2: version "5.5.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.2.tgz#c26f023cb0054e657ce04f72583ea2d85f8d0507" @@ -1994,11 +1660,6 @@ vue@^3.2.45, vue@^3.3.4: "@vue/server-renderer" "3.3.4" "@vue/shared" "3.3.4" -webidl-conversions@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" - integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== - webpack-sources@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" @@ -2009,15 +1670,6 @@ webpack-virtual-modules@^0.6.1: resolved "https://registry.yarnpkg.com/webpack-virtual-modules/-/webpack-virtual-modules-0.6.1.tgz#ac6fdb9c5adb8caecd82ec241c9631b7a3681b6f" integrity sha512-poXpCylU7ExuvZK8z+On3kX+S8o/2dQ/SVYueKA0D4WEMXROXgY8Ez50/bQEUmvoSMMrWcrJqCHuhAbsiwg7Dg== -whatwg-url@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" - integrity sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg== - dependencies: - lodash.sortby "^4.7.0" - tr46 "^1.0.1" - webidl-conversions "^4.0.2" - which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -2054,11 +1706,6 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml@^2.1.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.2.tgz#f522db4313c671a0ca963a75670f1c12ea909144" - integrity sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg== - yargs-parser@20.2.4: version "20.2.4" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" From 32f5b8c7d7d15ae29fb11dbf2574d6360933df56 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Sun, 7 Jul 2024 13:53:30 -0400 Subject: [PATCH 2/5] Switch unplugin to Civet and build with emitDeclarations --- build/build.sh | 13 +++- build/esbuild.civet | 4 +- package.json | 28 +++++--- source/unplugin/astro.civet | 15 +++++ source/unplugin/astro.ts | 24 ------- .../{constants.ts => constants.civet} | 0 source/unplugin/esbuild.civet | 3 + source/unplugin/esbuild.ts | 3 - source/unplugin/rollup.civet | 3 + source/unplugin/rollup.ts | 3 - .../unplugin/{unplugin.ts => unplugin.civet} | 64 +++++++++---------- source/unplugin/vite.civet | 3 + source/unplugin/vite.ts | 3 - source/unplugin/webpack.civet | 3 + source/unplugin/webpack.ts | 3 - tsconfig.json | 2 +- yarn.lock | 17 ++--- 17 files changed, 95 insertions(+), 96 deletions(-) create mode 100644 source/unplugin/astro.civet delete mode 100644 source/unplugin/astro.ts rename source/unplugin/{constants.ts => constants.civet} (100%) create mode 100644 source/unplugin/esbuild.civet delete mode 100644 source/unplugin/esbuild.ts create mode 100644 source/unplugin/rollup.civet delete mode 100644 source/unplugin/rollup.ts rename source/unplugin/{unplugin.ts => unplugin.civet} (95%) create mode 100644 source/unplugin/vite.civet delete mode 100644 source/unplugin/vite.ts create mode 100644 source/unplugin/webpack.civet delete mode 100644 source/unplugin/webpack.ts diff --git a/build/build.sh b/build/build.sh index 6b3f5c0d..6acbf39a 100755 --- a/build/build.sh +++ b/build/build.sh @@ -3,13 +3,23 @@ set -euo pipefail # clean build rm -rf dist +mkdir dist # tree-shake needed constants from Vite node -e 'import("./node_modules/vite/dist/node/constants.js").then((c)=>console.log(`export const DEFAULT_EXTENSIONS = ${JSON.stringify(c.DEFAULT_EXTENSIONS)}`))' >./source/unplugin/constants.ts +# types (these get used for type checking during esbuild, so must go first) +cp types/types.d.ts dist/types.d.ts + # normal files civet --no-config build/esbuild.civet "$@" +# built types +for name in astro esbuild rollup unplugin vite webpack; do + mv dist/unplugin/$name.civet.d.ts dist/$name.d.ts +done +rmdir dist/unplugin + # cli BIN="dist/civet" echo "#!/usr/bin/env node" | cat - dist/cli.js > "$BIN" @@ -19,9 +29,6 @@ rm dist/cli.js # babel plugin cp source/babel-plugin.mjs dist/babel-plugin.mjs -# types -cp types/types.d.ts dist/types.d.ts - # create browser build for docs terser dist/browser.js --compress --mangle --ecma 2015 --output civet.dev/public/__civet.js diff --git a/build/esbuild.civet b/build/esbuild.civet index e0703308..33428134 100644 --- a/build/esbuild.civet +++ b/build/esbuild.civet @@ -139,7 +139,7 @@ for format of ["esm", "cjs"] build({ entryPoints: for name of [ 'unplugin', 'webpack', 'vite', 'rollup', 'esbuild', 'astro' ] - `source/unplugin/${name}.ts` + `source/unplugin/${name}.civet` chunkNames: 'unplugin-shared' bundle: true sourcemap @@ -159,7 +159,7 @@ for format of ["esm", "cjs"] plugins: [ civetUnplugin ts: 'civet' - emitDeclaration: true + emitDeclaration: format == "esm" // only run TypeScript once ] }).catch -> process.exit 1 diff --git a/package.json b/package.json index a0a023ef..bac6af49 100644 --- a/package.json +++ b/package.json @@ -8,37 +8,47 @@ "exports": { ".": { "import": "./dist/main.mjs", - "require": "./dist/main.js" + "require": "./dist/main.js", + "types": "./dist/types.d.ts" }, "./babel-plugin": "./dist/babel-plugin.mjs", "./bun-civet": "./dist/bun-civet.mjs", "./esm": "./dist/esm.mjs", "./esbuild-plugin": "./dist/esbuild-plugin.js", "./register": "./register.js", - "./config": "./dist/config.js", + "./config": { + "require": "./dist/config.js", + "types": "./dist/types.d.ts" + }, "./unplugin": { "require": "./dist/unplugin.js", - "import": "./dist/unplugin.mjs" + "import": "./dist/unplugin.mjs", + "types": "./dist/unplugin.d.ts" }, "./vite": { "require": "./dist/vite.js", - "import": "./dist/vite.mjs" + "import": "./dist/vite.mjs", + "types": "./dist/vite.d.ts" }, "./webpack": { "require": "./dist/webpack.js", - "import": "./dist/webpack.mjs" + "import": "./dist/webpack.mjs", + "types": "./dist/webpack.d.ts" }, "./rollup": { "require": "./dist/rollup.js", - "import": "./dist/rollup.mjs" + "import": "./dist/rollup.mjs", + "types": "./dist/rollup.d.ts" }, "./esbuild": { "require": "./dist/esbuild.js", - "import": "./dist/esbuild.mjs" + "import": "./dist/esbuild.mjs", + "types": "./dist/esbuild.d.ts" }, "./astro": { "require": "./dist/astro.js", - "import": "./dist/astro.mjs" + "import": "./dist/astro.mjs", + "types": "./dist/astro.d.ts" }, "./ts-diagnostic": { "require": "./dist/ts-diagnostic.js", @@ -75,7 +85,7 @@ "unplugin": "^1.6.0" }, "devDependencies": { - "@danielx/civet": "0.7.11", + "@danielx/civet": "0.7.16", "@danielx/hera": "^0.8.14", "@prettier/sync": "^0.5.2", "@types/assert": "^1.5.6", diff --git a/source/unplugin/astro.civet b/source/unplugin/astro.civet new file mode 100644 index 00000000..a4c7a0cd --- /dev/null +++ b/source/unplugin/astro.civet @@ -0,0 +1,15 @@ +//type { AstroIntegration } from astro +interface AstroIntegration + name: string + hooks: + "astro:config:setup": (data: { updateConfig: (config: unknown) => void }) => void + +civetUnplugin, { type PluginOptions } from ./unplugin.civet + +export default function(opts: PluginOptions = {}): AstroIntegration + name: "@danielx/civet" + hooks: + "astro:config:setup": ({ updateConfig }) => + updateConfig + vite: + plugins: [civetUnplugin.vite(opts)] diff --git a/source/unplugin/astro.ts b/source/unplugin/astro.ts deleted file mode 100644 index 7be7d618..00000000 --- a/source/unplugin/astro.ts +++ /dev/null @@ -1,24 +0,0 @@ -//import type { AstroIntegration } from 'astro'; -interface AstroIntegration { - name: string, - hooks: { - "astro:config:setup": (data: { updateConfig: (config: unknown) => void }) => void - } -} - -import civetUnplugin, { type PluginOptions } from './unplugin' - -export default function(opts: PluginOptions = {}): AstroIntegration { - return { - name: "@danielx/civet", - hooks: { - "astro:config:setup": ({ updateConfig }) => { - updateConfig({ - vite: { - plugins: [civetUnplugin.vite(opts)], - } - }); - }, - }, - }; -} diff --git a/source/unplugin/constants.ts b/source/unplugin/constants.civet similarity index 100% rename from source/unplugin/constants.ts rename to source/unplugin/constants.civet diff --git a/source/unplugin/esbuild.civet b/source/unplugin/esbuild.civet new file mode 100644 index 00000000..90484cab --- /dev/null +++ b/source/unplugin/esbuild.civet @@ -0,0 +1,3 @@ +civetUnplugin from ./unplugin.civet + +export default civetUnplugin.esbuild diff --git a/source/unplugin/esbuild.ts b/source/unplugin/esbuild.ts deleted file mode 100644 index 2b0fda46..00000000 --- a/source/unplugin/esbuild.ts +++ /dev/null @@ -1,3 +0,0 @@ -import civetUnplugin from './unplugin' - -export default civetUnplugin.esbuild; diff --git a/source/unplugin/rollup.civet b/source/unplugin/rollup.civet new file mode 100644 index 00000000..087777c3 --- /dev/null +++ b/source/unplugin/rollup.civet @@ -0,0 +1,3 @@ +civetUnplugin from ./unplugin.civet + +export default civetUnplugin.rollup diff --git a/source/unplugin/rollup.ts b/source/unplugin/rollup.ts deleted file mode 100644 index 1e19e284..00000000 --- a/source/unplugin/rollup.ts +++ /dev/null @@ -1,3 +0,0 @@ -import civetUnplugin from './unplugin' - -export default civetUnplugin.rollup; diff --git a/source/unplugin/unplugin.ts b/source/unplugin/unplugin.civet similarity index 95% rename from source/unplugin/unplugin.ts rename to source/unplugin/unplugin.civet index 77399e9d..50dc17f5 100644 --- a/source/unplugin/unplugin.ts +++ b/source/unplugin/unplugin.civet @@ -98,7 +98,7 @@ function implicitCivet(file: string): string | undefined { } export const rawPlugin: Parameters>[0] = -(options: PluginOptions = {}, meta) => { +(options: PluginOptions = {}, meta) => if (options.dts) options.emitDeclaration = options.dts; if (options.js) options.ts = 'civet'; let compileOptions: CompileOptions = {}; @@ -118,24 +118,23 @@ export const rawPlugin: Parameters>[0] = const tsPromise = transformTS || options.ts === 'tsc' - ? import('typescript').then(m => m.default) + ? import('typescript').then .default : null; - const getFormatHost = (sys: System): FormatDiagnosticsHost => { + const getFormatHost = (sys: System): FormatDiagnosticsHost => return { - getCurrentDirectory: () => sys.getCurrentDirectory(), - getNewLine: () => sys.newLine, + getCurrentDirectory: => sys.getCurrentDirectory() + getNewLine: => sys.newLine getCanonicalFileName: sys.useCaseSensitiveFileNames - ? f => f - : f => f.toLowerCase(), - }; - }; + ? (f) => f + : (f) => f.toLowerCase() + } const cache = options.cache ? new Map() : undefined; return { - name: 'unplugin-civet', - enforce: 'pre', - async buildStart() { + name: 'unplugin-civet' + enforce: 'pre' + async buildStart(): Promise { if (transformTS || options.ts === 'tsc') { const ts = await tsPromise!; @@ -185,7 +184,7 @@ export const rawPlugin: Parameters>[0] = system.readDirectory = (path: string, extensions?: readonly string[], excludes?: readonly string[], includes?: readonly string[], depth?: number): string[] => { extensions = [ ...(extensions ?? []), ".civet" ]; return systemReadDirectory(path, extensions, excludes, includes, depth) - .map(name => name.endsWith(".civet") ? name + ".tsx" : name); + .map &.endsWith(".civet") ? & + ".tsx" : & } const configContents = ts.parseJsonConfigFileContent( @@ -210,8 +209,8 @@ export const rawPlugin: Parameters>[0] = }; fsMap = new Map(); } - }, - async buildEnd(useConfigFileNames = false) { + } + async buildEnd(useConfigFileNames = false): Promise { if (transformTS) { const ts = await tsPromise!; @@ -233,7 +232,7 @@ export const rawPlugin: Parameters>[0] = system.readDirectory = (path: string): string[] => systemReadDirectory(path) - .map(name => name.endsWith('.civet') ? name + '.tsx' : name) + .map &.endsWith('.civet') ? & + '.tsx' : & system.readFile = (filename: string, encoding: string = 'utf-8'): string | undefined => { // Mogrify package.json imports field to use .civet.tsx @@ -242,7 +241,7 @@ export const rawPlugin: Parameters>[0] = if (!json) return json const parsed: Record = JSON.parse(json) let modified = false - function recurse(node: unknown) { + function recurse(node: unknown): void { if (node && typeof node === 'object') { for (const key in node) { const value = (node as Record)[key] @@ -296,7 +295,7 @@ export const rawPlugin: Parameters>[0] = const diagnostics: Diagnostic[] = ts .getPreEmitDiagnostics(program) - .map(diagnostic => { + .map((diagnostic) => const file = diagnostic.file; if (!file) return diagnostic; @@ -318,7 +317,7 @@ export const rawPlugin: Parameters>[0] = length: diagnostic.length, start: range.start, }; - }); + ); if (configErrors?.length) { diagnostics.unshift(...configErrors); @@ -345,7 +344,7 @@ export const rawPlugin: Parameters>[0] = // Default behavior: fail on errors failures.push(DiagnosticCategory.Error) } - const count = diagnostics.filter(d => failures.includes(d.category)).length + const count = diagnostics.filter((d) => failures.includes(d.category)).length if (count) { const reason = (count === diagnostics.length ? count : `${count} out of ${diagnostics.length}`) @@ -401,7 +400,7 @@ export const rawPlugin: Parameters>[0] = } } } - }, + } resolveId(id, importer, options) { if (/\0/.test(id)) return null; @@ -426,10 +425,10 @@ export const rawPlugin: Parameters>[0] = } return resolvedId + outExt; - }, + } loadInclude(id) { return isCivetTranspiled.test(id); - }, + } async load(id) { const match = isCivetTranspiled.exec(id); if (!match) return null; @@ -553,12 +552,12 @@ export const rawPlugin: Parameters>[0] = cache?.set(filename, {mtime: mtime!, result: transformed}); return transformed; - }, + } esbuild: { config(options: BuildOptions) { - esbuildOptions = options; - }, - }, + esbuildOptions = options + } + } vite: { config(config: UserConfig) { rootDir = path.resolve(process.cwd(), config.root ?? ''); @@ -570,8 +569,8 @@ export const rawPlugin: Parameters>[0] = } }, async transformIndexHtml(html) { - return html.replace(/|<[^<>]*>/g, tag => - tag.replace(/<\s*script\b[^<>]*>/gi, script => + return html.replace(/|<[^<>]*>/g, (tag) => + tag.replace(/<\s*script\b[^<>]*>/gi, (script) => // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 script.replace( /([:_\p{ID_Start}][:\p{ID_Continue}]*)(\s*=\s*("[^"]*"|'[^']*'|[^\s"'=<>`]*))?/gu, @@ -602,10 +601,9 @@ export const rawPlugin: Parameters>[0] = return [ ...modules, module ] } return modules; - }, - }, - }; -}; + } + } + } var unplugin = createUnplugin(rawPlugin) export default unplugin diff --git a/source/unplugin/vite.civet b/source/unplugin/vite.civet new file mode 100644 index 00000000..03db8d82 --- /dev/null +++ b/source/unplugin/vite.civet @@ -0,0 +1,3 @@ +civetUnplugin from ./unplugin.civet + +export default civetUnplugin.vite diff --git a/source/unplugin/vite.ts b/source/unplugin/vite.ts deleted file mode 100644 index 50375d56..00000000 --- a/source/unplugin/vite.ts +++ /dev/null @@ -1,3 +0,0 @@ -import civetUnplugin from './unplugin' - -export default civetUnplugin.vite; diff --git a/source/unplugin/webpack.civet b/source/unplugin/webpack.civet new file mode 100644 index 00000000..60e7e8f2 --- /dev/null +++ b/source/unplugin/webpack.civet @@ -0,0 +1,3 @@ +civetUnplugin from ./unplugin.civet + +export default civetUnplugin.webpack diff --git a/source/unplugin/webpack.ts b/source/unplugin/webpack.ts deleted file mode 100644 index a9547930..00000000 --- a/source/unplugin/webpack.ts +++ /dev/null @@ -1,3 +0,0 @@ -import civetUnplugin from './unplugin'; - -export default civetUnplugin.webpack; diff --git a/tsconfig.json b/tsconfig.json index ec096f23..26f84188 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,7 +26,7 @@ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ /* Modules */ "module": "esnext", /* Specify what module code is generated. */ - // "rootDir": "./", /* Specify the root folder within your source files. */ + "rootDir": "./source", /* Specify the root folder within your source files. */ "moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ diff --git a/yarn.lock b/yarn.lock index 2ab05bbf..34ba4d15 100644 --- a/yarn.lock +++ b/yarn.lock @@ -150,13 +150,13 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@danielx/civet@0.7.11": - version "0.7.11" - resolved "https://registry.yarnpkg.com/@danielx/civet/-/civet-0.7.11.tgz#3dbbd00eeaf466efb35f8adc5a9c4b5d2e7d3e5b" - integrity sha512-tq6FMamPQ30UenoKXiq5Wui0dZEhMKNG7G4lmpTj67oE/lw+mI5PbsSIAJQA2+bAEfhrDw9NVn9yW3XR3Ea8fA== +"@danielx/civet@0.7.16": + version "0.7.16" + resolved "https://registry.yarnpkg.com/@danielx/civet/-/civet-0.7.16.tgz#ecb7ce76de76bbbdb3b07f3e8cd085356362a0e0" + integrity sha512-tc/NT1nm7Sn/fib/iwYcvbH6FK52Yd4MtD0CzMXJLnU59AvuIpy3LZNBCDk8Nn5iioS6+V+AaTMBRMuKMP7UnQ== dependencies: "@cspotcode/source-map-support" "^0.8.1" - "@typescript/vfs" "^1.5.0" + "@typescript/vfs" "^1.5.3" unplugin "^1.6.0" "@danielx/hera@^0.8.14": @@ -519,13 +519,6 @@ resolved "https://registry.yarnpkg.com/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz#5c9f3c617f64a9735d7b72a7cc671e166d900c40" integrity sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA== -"@typescript/vfs@^1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@typescript/vfs/-/vfs-1.5.0.tgz#ed942922724f9ace8c07c80b006c47e5e3833218" - integrity sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg== - dependencies: - debug "^4.1.1" - "@typescript/vfs@^1.5.3": version "1.5.3" resolved "https://registry.yarnpkg.com/@typescript/vfs/-/vfs-1.5.3.tgz#b3e9e580cbdf282d6581543dcf3b2c0e44ebf9fb" From c0c95b5305937fd83019cae74e11cd6e40d9b71b Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Sun, 7 Jul 2024 14:09:52 -0400 Subject: [PATCH 3/5] Move unplugin to dist/unplugin for consistency with source --- build/build.sh | 4 ++-- build/esbuild.civet | 2 +- package.json | 36 ++++++++++++++++++------------------ source/cli.civet | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/build/build.sh b/build/build.sh index 6acbf39a..86b24890 100755 --- a/build/build.sh +++ b/build/build.sh @@ -16,9 +16,9 @@ civet --no-config build/esbuild.civet "$@" # built types for name in astro esbuild rollup unplugin vite webpack; do - mv dist/unplugin/$name.civet.d.ts dist/$name.d.ts + mv dist/unplugin/unplugin/$name.civet.d.ts dist/unplugin/$name.d.ts done -rmdir dist/unplugin +rmdir dist/unplugin/unplugin # cli BIN="dist/civet" diff --git a/build/esbuild.civet b/build/esbuild.civet index 33428134..b1707492 100644 --- a/build/esbuild.civet +++ b/build/esbuild.civet @@ -154,7 +154,7 @@ for format of ["esm", "cjs"] 'esbuild' ] target: "esNext" - outdir: 'dist' + outdir: 'dist/unplugin' outExtension: { ".js": if format == "esm" then ".mjs" else ".js" } plugins: [ civetUnplugin diff --git a/package.json b/package.json index bac6af49..79b4d878 100644 --- a/package.json +++ b/package.json @@ -21,34 +21,34 @@ "types": "./dist/types.d.ts" }, "./unplugin": { - "require": "./dist/unplugin.js", - "import": "./dist/unplugin.mjs", - "types": "./dist/unplugin.d.ts" + "require": "./dist/unplugin/unplugin.js", + "import": "./dist/unplugin/unplugin.mjs", + "types": "./dist/unplugin/unplugin.d.ts" }, "./vite": { - "require": "./dist/vite.js", - "import": "./dist/vite.mjs", - "types": "./dist/vite.d.ts" + "require": "./dist/unplugin/vite.js", + "import": "./dist/unplugin/vite.mjs", + "types": "./dist/unplugin/vite.d.ts" }, "./webpack": { - "require": "./dist/webpack.js", - "import": "./dist/webpack.mjs", - "types": "./dist/webpack.d.ts" + "require": "./dist/unplugin/webpack.js", + "import": "./dist/unplugin/webpack.mjs", + "types": "./dist/unplugin/webpack.d.ts" }, "./rollup": { - "require": "./dist/rollup.js", - "import": "./dist/rollup.mjs", - "types": "./dist/rollup.d.ts" + "require": "./dist/unplugin/rollup.js", + "import": "./dist/unplugin/rollup.mjs", + "types": "./dist/unplugin/rollup.d.ts" }, "./esbuild": { - "require": "./dist/esbuild.js", - "import": "./dist/esbuild.mjs", - "types": "./dist/esbuild.d.ts" + "require": "./dist/unplugin/esbuild.js", + "import": "./dist/unplugin/esbuild.mjs", + "types": "./dist/unplugin/esbuild.d.ts" }, "./astro": { - "require": "./dist/astro.js", - "import": "./dist/astro.mjs", - "types": "./dist/astro.d.ts" + "require": "./dist/unplugin/astro.js", + "import": "./dist/unplugin/astro.mjs", + "types": "./dist/unplugin/astro.d.ts" }, "./ts-diagnostic": { "require": "./dist/ts-diagnostic.js", diff --git a/source/cli.civet b/source/cli.civet index 8399c99a..f9bb5547 100644 --- a/source/cli.civet +++ b/source/cli.civet @@ -2,7 +2,7 @@ { findConfig, loadConfig } from ./config.civet // unplugin ends up getting installed in the same dist directory -{rawPlugin} from ./unplugin +{rawPlugin} from ./unplugin/unplugin.civet let unplugin: buildStart: () => Promise buildEnd: (this: {emitFile: (data: {source: string, fileName: string, type: string}) => void}, useConfigFileNames?: boolean) => Promise From 1421bbdc29dec62d9aef2c1e443b68b7107aedc1 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Sun, 7 Jul 2024 16:22:48 -0400 Subject: [PATCH 4/5] Fix .civet resolution in dist --- build/build.sh | 4 ++-- build/esbuild.civet | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/build/build.sh b/build/build.sh index 86b24890..7e4bc06e 100755 --- a/build/build.sh +++ b/build/build.sh @@ -16,9 +16,9 @@ civet --no-config build/esbuild.civet "$@" # built types for name in astro esbuild rollup unplugin vite webpack; do - mv dist/unplugin/unplugin/$name.civet.d.ts dist/unplugin/$name.d.ts + sed 's/\.civet"/\.js"/' dist/unplugin/unplugin/$name.civet.d.ts >dist/unplugin/$name.d.ts done -rmdir dist/unplugin/unplugin +rm -rf dist/unplugin/unplugin # cli BIN="dist/civet" diff --git a/build/esbuild.civet b/build/esbuild.civet index b1707492..94bad01e 100644 --- a/build/esbuild.civet +++ b/build/esbuild.civet @@ -49,9 +49,10 @@ resolveExtensions := extensionResolverPlugin(["civet", "hera"]) rewriteCivetImports := { name: 'rewrite-civet' setup(build) + ext := build.initialOptions.format is "esm" ? ".mjs" : ".js" build.onResolve { filter: /.*/ }, (args) => - if args.importer - path: args.path.replace(/\.civet$/, ".js") + if args.importer and /\.civet$/.test args.path + path: args.path.replace(/\.civet$/, ext) external: true } @@ -68,6 +69,10 @@ for name of ["cli", "config", "esbuild-plugin"] rewriteCivetImports civetPlugin() ] + external: [ + '../package.json' + '../register.js' + ] footer: // Rewrite default export as CJS exports object, // so require('esbuild-plugin') gives the plugin. @@ -140,7 +145,6 @@ for format of ["esm", "cjs"] entryPoints: for name of [ 'unplugin', 'webpack', 'vite', 'rollup', 'esbuild', 'astro' ] `source/unplugin/${name}.civet` - chunkNames: 'unplugin-shared' bundle: true sourcemap minify @@ -152,11 +156,13 @@ for format of ["esm", "cjs"] '@typescript/vfs' 'unplugin' 'esbuild' + './unplugin.civet' ] target: "esNext" outdir: 'dist/unplugin' - outExtension: { ".js": if format == "esm" then ".mjs" else ".js" } + outExtension: ".js": if format == "esm" then ".mjs" else ".js" plugins: [ + rewriteCivetImports civetUnplugin ts: 'civet' emitDeclaration: format == "esm" // only run TypeScript once @@ -173,7 +179,7 @@ for format of ["esm", "cjs"] format target: "esNext" outdir: 'dist' - outExtension: { ".js": if format == "esm" then ".mjs" else ".js" } + outExtension: ".js": if format == "esm" then ".mjs" else ".js" plugins: [ civetPlugin({ emitDeclaration: true }) ] From da2beff3cd4d7623e22b1834f4d01f31bad463db Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Sun, 7 Jul 2024 17:16:25 -0400 Subject: [PATCH 5/5] ESM build of config, fix tests --- build/build.sh | 3 ++- build/esbuild.civet | 21 ++++++++++++++++++++- integration/example/build.civet | 2 +- package.json | 3 ++- source/unplugin/constants.ts | 1 + source/unplugin/unplugin.civet | 2 +- tsconfig.json | 5 ++--- types/config.d.ts | 1 + 8 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 source/unplugin/constants.ts create mode 100644 types/config.d.ts diff --git a/build/build.sh b/build/build.sh index 7e4bc06e..b1aff45f 100755 --- a/build/build.sh +++ b/build/build.sh @@ -9,7 +9,8 @@ mkdir dist node -e 'import("./node_modules/vite/dist/node/constants.js").then((c)=>console.log(`export const DEFAULT_EXTENSIONS = ${JSON.stringify(c.DEFAULT_EXTENSIONS)}`))' >./source/unplugin/constants.ts # types (these get used for type checking during esbuild, so must go first) -cp types/types.d.ts dist/types.d.ts +cp types/types.d.ts types/config.d.ts dist/ +cp types/config.d.ts dist/config.d.mts # normal files civet --no-config build/esbuild.civet "$@" diff --git a/build/esbuild.civet b/build/esbuild.civet index 94bad01e..ef92f0cd 100644 --- a/build/esbuild.civet +++ b/build/esbuild.civet @@ -58,7 +58,7 @@ rewriteCivetImports := { // Files that need civet imports re-written // since they aren't actually bundled -for name of ["cli", "config", "esbuild-plugin"] +for name of ["cli", "esbuild-plugin"] build({ entryPoints: [`source/${name}.civet`] bundle: true @@ -79,6 +79,25 @@ for name of ["cli", "config", "esbuild-plugin"] js: name is 'esbuild-plugin' ? 'module.exports = module.exports.default;' : '' }).catch -> process.exit 1 +for name of ["config"] + for format of ["esm", "cjs"] + build({ + entryPoints: [`source/${name}.civet`] + bundle: true + platform: 'node' + format + outdir: 'dist' + outExtension: ".js": if format == "esm" then ".mjs" else ".js" + plugins: [ + rewriteCivetImports + civetPlugin() + ] + footer: + // Rewrite default export as CJS exports object, + // so require('esbuild-plugin') gives the plugin. + js: name is 'esbuild-plugin' ? 'module.exports = module.exports.default;' : '' + }).catch -> process.exit 1 + // esm needs to be a module for import.meta for name of ["esm"] build({ diff --git a/integration/example/build.civet b/integration/example/build.civet index eee61497..d91077e5 100644 --- a/integration/example/build.civet +++ b/integration/example/build.civet @@ -1,7 +1,7 @@ // This file is used in test/integration.civet to test the esbuild plugin esbuild from esbuild -civetPlugin from ../../dist/esbuild.mjs +civetPlugin from ../../dist/unplugin/esbuild.mjs esbuild.build { +sourcemap diff --git a/package.json b/package.json index 79b4d878..4a85b58e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "./register": "./register.js", "./config": { "require": "./dist/config.js", - "types": "./dist/types.d.ts" + "import": "./dist/config.mjs", + "types": "./dist/config.d.ts" }, "./unplugin": { "require": "./dist/unplugin/unplugin.js", diff --git a/source/unplugin/constants.ts b/source/unplugin/constants.ts new file mode 100644 index 00000000..977b09ef --- /dev/null +++ b/source/unplugin/constants.ts @@ -0,0 +1 @@ +export const DEFAULT_EXTENSIONS = [".mjs",".js",".mts",".ts",".jsx",".tsx",".json"] diff --git a/source/unplugin/unplugin.civet b/source/unplugin/unplugin.civet index 50dc17f5..3038898b 100644 --- a/source/unplugin/unplugin.civet +++ b/source/unplugin/unplugin.civet @@ -1,4 +1,4 @@ -import { TransformResult, createUnplugin } from 'unplugin'; +import { type TransformResult, createUnplugin } from 'unplugin'; import civet, { SourceMap, type CompileOptions, type ParseOptions } from '@danielx/civet'; import { findInDir, loadConfig } from '@danielx/civet/config'; import { diff --git a/tsconfig.json b/tsconfig.json index 26f84188..c1ded555 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -97,14 +97,13 @@ "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, "exclude": [ - "dist/**/*", - "integration/unplugin-examples" + "dist", + "integration/unplugin-examples", ], "include": [ "source", "test", "types", - "integration" ], "ts-node": { "transpileOnly": true, diff --git a/types/config.d.ts b/types/config.d.ts new file mode 100644 index 00000000..6e3e99bd --- /dev/null +++ b/types/config.d.ts @@ -0,0 +1 @@ +///