2.2 KiB
2.2 KiB
AGENTS.md - Yarn Spinner Loader
Commands
npm run build— Build all entry points (tsup, ESM + CJS)npm run dev— Watch modenpm run test— Vitest watch modenpm run test:run— Run tests oncenpm run typecheck—tsc --noEmit
Architecture
src/index.ts— Main entry point. Full browser package: parse + compile + run + all types. No Node.js deps.src/core.ts— Mirror of index.ts. Not in package.json exports.src/runner.ts— Minimal runtime export:YarnRunner+ runtime/IR types only. No parser, no compiler.src/loader/— Filesystem loader: parses.yarnprojectfiles, validates against JSON schema (ajv), resolves globs (fast-glob), compiles.yarnfiles.src/plugins/— Build tool plugins: esbuild, rollup, vite, webpack. Each is a separate tsup entry point outputting todist/plugins/.src/yarn-spinner/— Embedded Yarn Spinner implementation:parse/,compile/,runtime/,markup/,model/.src/runner/— Empty directory. Ignore.
Package exports
yarn-spinner-loader→dist/index.js(full browser package)yarn-spinner-loader/runner→dist/runner.js(runtime only)yarn-spinner-loader/esbuild→dist/plugins/esbuild.jsyarn-spinner-loader/rollup→dist/plugins/rollup.jsyarn-spinner-loader/vite→dist/plugins/vite.jsyarn-spinner-loader/webpack→dist/plugins/webpack.js
Key conventions
src/index.tsandsrc/core.tsmust NOT import fromsrc/loader/or any Node.js-specific modules.src/loader/is the only code that usesfs,path,fast-glob.- TypeScript: strict mode, ES2022,
moduleResolution: "bundler". - Tests live in
tests/, notsrc/. Pattern:tests/**/*.test.ts.
Build notes
- tsup config has 6 entry points. Main + runner output to
dist/, plugins output todist/plugins/. npm run buildcleansdist/automatically.core.tsis NOT exported in package.json — it exists for internal consistency only.- This package is intended as a
devDependencyalongside bundlers. Dependencies (ajv,fast-glob) are needed at build time.
Security
.npmrccontains an npm auth token. Never commit or expose this.