From 06581c7fa6cb5b6dc1bc21d01e78b48641a19cfd Mon Sep 17 00:00:00 2001 From: Kelly Mears Date: Sat, 15 Jun 2024 14:49:07 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20improve(none):=20reuse=20ink=20i?= =?UTF-8?q?nstance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/tsconfig.json | 18 +- examples/node-api/node-script.js | 2 +- examples/node-api/package.json | 3 +- examples/node-api/webpack.config.js | 18 +- examples/s3/bud.config.ts | 25 +- examples/sage/bud.config.js | 2 +- examples/typescript/package.json | 4 + sources/@repo/test-kit/integration-test.ts | 32 +- sources/@roots/bud-build/src/config/stats.ts | 2 +- .../@roots/bud-compiler/src/service/index.ts | 20 +- .../@roots/bud-compiler/test/compiler.test.ts | 4 - .../bud-dashboard/src/components/error.tsx | 26 +- sources/@roots/bud-dashboard/src/service.tsx | 54 +- .../bud-framework/src/bootstrap/index.ts | 2 +- sources/@roots/bud-framework/src/bud/index.ts | 43 +- .../@roots/bud-framework/src/context/index.ts | 13 +- .../bud-framework/src/methods/close/index.ts | 7 +- .../src/services/compiler/index.ts | 16 - .../src/services/dashboard/index.ts | 6 - .../test/stylelintrc-no-extension.test.ts | 11 +- .../bud-support/jsx-dev-runtime/index.cjs | 1536 +---------------- .../@roots/bud-support/jsx-runtime/index.cjs | 35 +- sources/@roots/bud-support/package.json | 4 + .../bud-support/src/ink/instance/index.tsx | 15 + sources/@roots/bud-swc/src/extension/jsc.ts | 4 + sources/@roots/bud/config/jsconfig.json | 8 +- sources/@roots/bud/config/tsconfig.json | 7 +- sources/@roots/bud/src/cli/app/index.ts | 2 +- sources/@roots/bud/src/cli/commands/index.tsx | 29 +- .../bud/src/cli/commands/repl/index.tsx | 2 +- sources/@roots/bud/src/context/index.ts | 2 - .../test/cli-flag-cache/cache-flag.test.ts | 6 +- .../__snapshots__/babel.test.ts.snap | 12 +- .../__snapshots__/basic.test.ts.snap | 12 +- .../__snapshots__/critical-css.test.ts.snap | 15 - .../__snapshots__/node-api.test.ts.snap | 117 +- tests/integration/babel-advanced.test.ts | 1 - tests/integration/babel.test.ts | 26 +- tests/integration/basic.test.ts | 25 +- tests/integration/critical-css.test.ts | 15 +- tests/integration/node-api.test.ts | 100 +- tests/integration/webpack-plugin.test.ts | 25 +- yarn.lock | 301 +++- 43 files changed, 710 insertions(+), 1897 deletions(-) create mode 100644 sources/@roots/bud-support/src/ink/instance/index.tsx diff --git a/config/tsconfig.json b/config/tsconfig.json index f40e2d4031..19a65833bb 100644 --- a/config/tsconfig.json +++ b/config/tsconfig.json @@ -11,7 +11,7 @@ "forceConsistentCasingInFileNames": true, "importHelpers": true, "incremental": true, - "jsx": "react-jsxdev", + "jsx": "react-jsx", "jsxImportSource": "@roots/bud-support", "lib": ["ES2022", "DOM", "DOM.Iterable"], "module": "NodeNext", @@ -73,23 +73,15 @@ {"path": "../sources/@roots/bud-wordpress-externals/tsconfig.json"}, {"path": "../sources/@roots/bud-wordpress-theme-json/tsconfig.json"}, {"path": "../sources/@roots/container/tsconfig.json"}, - { - "path": "../sources/@roots/critical-css-webpack-plugin/tsconfig.json" - }, + {"path": "../sources/@roots/critical-css-webpack-plugin/tsconfig.json"}, {"path": "../sources/@roots/dependencies/tsconfig.json"}, {"path": "../sources/@roots/entrypoints-webpack-plugin/tsconfig.json"}, {"path": "../sources/@roots/filesystem/tsconfig.json"}, {"path": "../sources/@roots/sage/tsconfig.json"}, - { - "path": "../sources/@roots/wordpress-dependencies-webpack-plugin/tsconfig.json" - }, - { - "path": "../sources/@roots/wordpress-externals-webpack-plugin/tsconfig.json" - }, + {"path": "../sources/@roots/wordpress-dependencies-webpack-plugin/tsconfig.json"}, + { "path": "../sources/@roots/wordpress-externals-webpack-plugin/tsconfig.json"}, {"path": "../sources/@roots/wordpress-hmr/tsconfig.json"}, - { - "path": "../sources/@roots/wordpress-theme-json-webpack-plugin/tsconfig.json" - }, + {"path": "../sources/@roots/wordpress-theme-json-webpack-plugin/tsconfig.json"}, {"path": "../sources/@roots/wordpress-transforms/tsconfig.json"}, {"path": "../sources/create-bud-app/tsconfig.json"} ] diff --git a/examples/node-api/node-script.js b/examples/node-api/node-script.js index b3579d65e1..8318b24438 100644 --- a/examples/node-api/node-script.js +++ b/examples/node-api/node-script.js @@ -1,4 +1,4 @@ -import { factory } from '@roots/bud' +import {factory} from '@roots/bud' /** * Run this example with: diff --git a/examples/node-api/package.json b/examples/node-api/package.json index 9bd22e3fc0..b17138e281 100644 --- a/examples/node-api/package.json +++ b/examples/node-api/package.json @@ -10,6 +10,7 @@ "@roots/bud": "workspace:*", "@roots/bud-swc": "workspace:*", "webpack": "5.91.0", - "webpack-cli": "5.1.4" + "webpack-cli": "5.1.4", + "webpack-dev-server": "5.0.4" } } diff --git a/examples/node-api/webpack.config.js b/examples/node-api/webpack.config.js index 7e496f2d09..57063b72cb 100644 --- a/examples/node-api/webpack.config.js +++ b/examples/node-api/webpack.config.js @@ -1,4 +1,4 @@ -import { factory } from '@roots/bud' +import {factory} from '@roots/bud' /** * Run this example with: @@ -13,23 +13,25 @@ import { factory } from '@roots/bud' */ const bud = await factory({ clean: false, - dashboard: false, }) /** * Configure bud as you would in your project. */ -bud.setPath(`@dist`, `dist/build-b`) +bud.setPath(`@dist`, `dist/build-b`).html() + +const config = await bud.build.make() /** * Export the final config for webpack to consume. * - * - You probably want to set `stats`, since bud.js doesn't use this interface. - * - You'll also want to set up `watch` and `server` options as + * You'll want to set up `watch` and `devServer` options as * bud.js doesn't use these either. */ export default { - ...(await bud.build.make()), - stats: true, - watch: bud.isDevelopment, + ...config, + devServer: { + host: 'localhost', + port: 3010, + }, } diff --git a/examples/s3/bud.config.ts b/examples/s3/bud.config.ts index 16576b9dfe..f5612fc702 100644 --- a/examples/s3/bud.config.ts +++ b/examples/s3/bud.config.ts @@ -1,16 +1,15 @@ import {bud} from '@roots/bud' -bud - .html() - .when(bud.isProduction, bud => - bud.setPublicPath( +bud.html().when(bud.isProduction, bud => + bud + .setPublicPath( `https://bud-js-tests.s3.us-west-2.amazonaws.com/examples/s3/`, - ), - ) - .fs.setCredentials({ - accessKeyId: bud.env.get(`AWS_ACCESS_KEY_ID`), - secretAccessKey: bud.env.get(`AWS_SECRET_ACCESS_KEY`), - }) - .setRegion(`us-west-2`) - .setBucket(`bud-js-tests`) - .upload({destination: `examples/s3`}) + ) + .fs.setCredentials({ + accessKeyId: bud.env.get(`AWS_ACCESS_KEY_ID`), + secretAccessKey: bud.env.get(`AWS_SECRET_ACCESS_KEY`), + }) + .setRegion(`us-west-2`) + .setBucket(`bud-js-tests`) + .upload({destination: `examples/s3`}), +) diff --git a/examples/sage/bud.config.js b/examples/sage/bud.config.js index 97527680fa..5178195751 100644 --- a/examples/sage/bud.config.js +++ b/examples/sage/bud.config.js @@ -1,4 +1,4 @@ -import { bud } from '@roots/bud' +import {bud} from '@roots/bud' bud .entry({ diff --git a/examples/typescript/package.json b/examples/typescript/package.json index ce7dc076d0..c4373d186d 100644 --- a/examples/typescript/package.json +++ b/examples/typescript/package.json @@ -10,6 +10,10 @@ "@roots/bud": "workspace:*", "@roots/bud-babel": "workspace:*", "@roots/bud-typescript": "workspace:*", + "@types/node": "20.14.2", "ts-node": "10.9.2" + }, + "dependencies": { + "typescript": "5.4.5" } } diff --git a/sources/@repo/test-kit/integration-test.ts b/sources/@repo/test-kit/integration-test.ts index 62af6a94a4..f34d5557b1 100644 --- a/sources/@repo/test-kit/integration-test.ts +++ b/sources/@repo/test-kit/integration-test.ts @@ -9,6 +9,7 @@ import stripAnsi from 'strip-ansi' interface Options { buildCommand?: [string, Array?] dist?: string + integrationBuildCommand?: [string, Array?] label: string projectDir?: string } @@ -58,7 +59,7 @@ class Project { let results: ExecaReturnValue - if (this.options.buildCommand) { + if (globalThis.__INTEGRATION__) { await execa( `node`, [this.getPath(`node_modules`, `.bin`, `bud`), `clean`], @@ -68,23 +69,18 @@ class Project { }, ) - results = await execa(...this.options.buildCommand, { - cwd: this.directory, - reject: false, - }) - } else if (globalThis.__INTEGRATION__) { - results = await execa( + const command = this.options.integrationBuildCommand ?? [ `node`, [ this.getPath(`node_modules`, `.bin`, `bud`), `build`, `--no-cache`, ], - { - cwd: this.directory, - reject: false, - }, - ) + ] + results = await execa(...command, { + cwd: this.directory, + reject: false, + }) } else { await execa( `yarn`, @@ -100,7 +96,7 @@ class Project { }, ) - results = await execa( + const command = this.options.buildCommand ?? [ `yarn`, [ `bud`, @@ -109,11 +105,11 @@ class Project { `build`, `--no-cache`, ], - { - cwd: this.directory, - reject: false, - }, - ) + ] + results = await execa(...command, { + cwd: this.directory, + reject: false, + }) } results.stdout && diff --git a/sources/@roots/bud-build/src/config/stats.ts b/sources/@roots/bud-build/src/config/stats.ts index 0ca0a09124..80297200df 100644 --- a/sources/@roots/bud-build/src/config/stats.ts +++ b/sources/@roots/bud-build/src/config/stats.ts @@ -1,4 +1,4 @@ import type {Factory} from '@roots/bud-build/config' export const stats: Factory<`stats`> = async app => - app.hooks.filter(`build.stats`, {preset: `none`}) + app.hooks.filter(`build.stats`, {preset: `normal`}) diff --git a/sources/@roots/bud-compiler/src/service/index.ts b/sources/@roots/bud-compiler/src/service/index.ts index af68219161..3433403fe8 100644 --- a/sources/@roots/bud-compiler/src/service/index.ts +++ b/sources/@roots/bud-compiler/src/service/index.ts @@ -3,7 +3,6 @@ import type {Compiler as BudCompiler} from '@roots/bud-framework' import type { MultiCompiler, MultiStats, - StatsError, Webpack, } from '@roots/bud-framework/config' @@ -50,16 +49,18 @@ class Compiler extends Service implements BudCompiler { @bind public onStats(stats: MultiStats) { this.stats = stats.toJson(statsOptions) - this.app.context.render(this.app.dashboard.render(stats)) + this.app.dashboard.render(stats) if (stats.hasErrors()) { process.exitCode = 1 + const format = makeErrorFormatter(this.stats) this.stats.children = this.stats.children?.map(child => ({ ...child, - errors: child.errors - ? this.formatErrors(child.errors) - : child.errors ?? [], + errors: + (child.errors + ? child.errors?.map(format).filter(Boolean) + : child.errors) ?? [], })) this.stats.children @@ -147,15 +148,6 @@ class Compiler extends Service implements BudCompiler { throw BudError.normalize(error) }) } - - @bind - public formatErrors( - errors: Array | undefined, - ): Array<({file: string} & Error) | StatsError> { - return ( - errors?.map(makeErrorFormatter(this.stats)).filter(Boolean) ?? [] - ) - } } const statsOptions = { diff --git a/sources/@roots/bud-compiler/test/compiler.test.ts b/sources/@roots/bud-compiler/test/compiler.test.ts index 8aa57d3691..e41a5229cc 100644 --- a/sources/@roots/bud-compiler/test/compiler.test.ts +++ b/sources/@roots/bud-compiler/test/compiler.test.ts @@ -28,10 +28,6 @@ describe(`@roots/bud-compiler`, function () { expect(compiler.onStats).toBeInstanceOf(Function) }) - it(`should have formatErrors transformer`, () => { - expect(compiler.formatErrors).toBeInstanceOf(Function) - }) - it(`should call logger.log`, async () => { expect(logSpy).toHaveBeenCalled() }) diff --git a/sources/@roots/bud-dashboard/src/components/error.tsx b/sources/@roots/bud-dashboard/src/components/error.tsx index 9e9d07b1d1..286a1e4288 100644 --- a/sources/@roots/bud-dashboard/src/components/error.tsx +++ b/sources/@roots/bud-dashboard/src/components/error.tsx @@ -1,13 +1,10 @@ /* eslint-disable n/no-process-env */ import {BudError} from '@roots/bud-support/errors' import figures from '@roots/bud-support/figures' -import { - Box, - render as inkRender, - type ReactNode, - Static, - Text, -} from '@roots/bud-support/ink' +import {Box, type ReactNode, Static, Text} from '@roots/bud-support/ink' +import {render} from '@roots/bud-support/ink/instance' +import isObject from '@roots/bud-support/isObject' +import logger from '@roots/bud-support/logger' type RawError = BudError | Error | string | undefined @@ -152,6 +149,17 @@ export const Display = ({error: input}: {error: RawError}) => { ) } -export const render = (error: BudError | Error) => { - return inkRender() +export const renderError = (error: BudError | Error) => { + try { + render() + } catch (inkError) { + logger.error( + typeof inkError === `string` + ? inkError + : isObject(inkError) && `message` in inkError + ? inkError.message + : `There was an error rendering the error component.`, + ) + logger.error(error.message) + } } diff --git a/sources/@roots/bud-dashboard/src/service.tsx b/sources/@roots/bud-dashboard/src/service.tsx index b7e2e6e318..1f821b670b 100644 --- a/sources/@roots/bud-dashboard/src/service.tsx +++ b/sources/@roots/bud-dashboard/src/service.tsx @@ -5,18 +5,17 @@ import type { StatsError, } from '@roots/bud-framework/config' import type {Dashboard as BudDashboard} from '@roots/bud-framework/services' -import type {BudError} from '@roots/bud-support/errors' import {stdin} from 'node:process' import {makeErrorFormatter} from '@roots/bud-dashboard/helpers/formatErrors' import {Service} from '@roots/bud-framework/service' import {bind} from '@roots/bud-support/decorators/bind' -import {Box, type ReactElement, Text} from '@roots/bud-support/ink' +import {Box, Text} from '@roots/bud-support/ink' +import {render} from '@roots/bud-support/ink/instance' import isUndefined from '@roots/bud-support/isUndefined' import {Application, TeletypeApplication} from './application.js' -import {render} from './components/error.js' import ErrorBoundary from './errorBoundary.js' type Compilations = Array> @@ -51,14 +50,22 @@ export class Dashboard extends Service implements BudDashboard { * @param error - {@link Error} */ @bind - public render(stats?: MultiStats, error?: Error): null | ReactElement { - if (!stats) return No stats to display - + public render( + stats?: MultiStats | StatsCompilation, + error?: Error, + ): unknown { /** * Do not render if silent mode is enabled */ if (this.app.context.silent) return null + /** + * Do not render if no stats received + */ + if (!stats) { + return null + } + /** * Render basic output if `--dashboard` flag is false */ @@ -69,7 +76,29 @@ export class Dashboard extends Service implements BudDashboard { return {stringStats} } - const data = stats.toJson() + const data: StatsCompilation = + this.app.compiler.stats ?? + stats.toJson({ + all: false, + children: { + all: false, + assets: true, + cached: true, + cachedAssets: true, + cachedModules: true, + entrypoints: true, + errorDetails: false, + errors: true, + errorsCount: true, + hash: true, + modules: true, + name: true, + outputPath: true, + timings: true, + warnings: true, + warningsCount: true, + }, + }) /** * Get compilations @@ -125,9 +154,6 @@ export class Dashboard extends Service implements BudDashboard { : true /** - * Get the application to render - * - * @remarks * If the application is running in development mode, and * the terminal is a TTY, we want to render the teletype * application. Otherwise, we want to render the normal @@ -138,7 +164,7 @@ export class Dashboard extends Service implements BudDashboard { ? TeletypeApplication : Application - return ( + render( - + , ) } - - public renderError(error: BudError) { - render(error) - } } diff --git a/sources/@roots/bud-framework/src/bootstrap/index.ts b/sources/@roots/bud-framework/src/bootstrap/index.ts index bd48a32976..fb1ff84826 100644 --- a/sources/@roots/bud-framework/src/bootstrap/index.ts +++ b/sources/@roots/bud-framework/src/bootstrap/index.ts @@ -174,7 +174,7 @@ const filterServices = const instantiateServices = (bud: Bud) => async (signifier: `${keyof Bud & string}`): Promise => { - const Service = await bud.module.import(signifier).catch(bud.catch) + const Service = await bud.module.import(signifier) const value = new Service(() => bud) const handle = ( value.constructor?.name diff --git a/sources/@roots/bud-framework/src/bud/index.ts b/sources/@roots/bud-framework/src/bud/index.ts index f6c8c253c4..fa0ff50a00 100644 --- a/sources/@roots/bud-framework/src/bud/index.ts +++ b/sources/@roots/bud-framework/src/bud/index.ts @@ -21,7 +21,7 @@ import {exit} from 'node:process' import {bootstrap} from '@roots/bud-framework/bootstrap' import methods from '@roots/bud-framework/methods' import {bind} from '@roots/bud-support/decorators/bind' -import {BudError, InputError} from '@roots/bud-support/errors' +import {BudError} from '@roots/bud-support/errors' import isFunction from '@roots/bud-support/isFunction' import isString from '@roots/bud-support/isString' import isUndefined from '@roots/bud-support/isUndefined' @@ -193,10 +193,11 @@ export class Bud { * Constructor */ public constructor() { - this.set(`implementation`, this.constructor as any) + if (this.implementation) + this.set(`implementation`, this.constructor as any) - Object.entries(methods).map(([k, v]) => - this.set(k as any, v.bind(this)), + Object.entries(methods).map(([prop, value]) => + this.set(prop as keyof Bud, value), ) } @@ -205,7 +206,7 @@ export class Bud { */ @bind public async boot() { - await this.executeServiceCallbacks(`boot`).catch(this.catch) + await this.executeServiceCallbacks(`boot`) } /** @@ -213,25 +214,20 @@ export class Bud { */ @bind public async bootstrap() { - await this.executeServiceCallbacks(`bootstrap`).catch(this.catch) + await this.executeServiceCallbacks(`bootstrap`) } /** * Error handler */ @bind - public catch(error: Error) { - const normalError = BudError.normalize(error) + public catch(error: Error | string) { + if (!this.context.silent) + logger.error(isString(error) ? error : error.message) - if (!normalError.instance && this?.isChild) - normalError.instance = this.label + if (this.context.ignoreErrors) return - if (this.dashboard?.renderError && this.context?.dashboard !== false) { - this.dashboard.renderError(normalError) - exit(1) - } else { - throw normalError - } + exit(1) } /** @@ -269,11 +265,7 @@ export class Bud { setupFn?: (app: Bud) => Promise, ) { if (!this.isRoot) { - return this.catch( - InputError.normalize( - `bud.make: must be called from the root context`, - ), - ) + this.catch(`bud.make: must be called from the root context`) } const context: Context = isString(request) @@ -281,10 +273,9 @@ export class Bud { : {...this.context, ...request, root: this} if (isUndefined(context.label)) { - this.catch( - InputError.normalize(`bud.make: context.label must be a string`), - ) + this.catch(`bud.make: context.label must be a string`) } + if ( !isUndefined(this.context.filter) && !this.context.filter.includes(context.label) @@ -303,9 +294,7 @@ export class Bud { if (this.children[context.label]) { this.catch( - InputError.normalize( - `bud.make: child instance ${context.label} already exists`, - ), + `bud.make: child instance ${context.label} already exists`, ) } diff --git a/sources/@roots/bud-framework/src/context/index.ts b/sources/@roots/bud-framework/src/context/index.ts index c7d2953c28..34ef028ac7 100644 --- a/sources/@roots/bud-framework/src/context/index.ts +++ b/sources/@roots/bud-framework/src/context/index.ts @@ -259,6 +259,14 @@ export interface Context { */ html?: boolean | string + /** + * Ignore errors option + * + * @remarks + * Set witht the `--ignore-errors` CLI flag. + */ + ignoreErrors?: boolean + /** * Immutable option * @@ -384,11 +392,6 @@ export interface Context { */ reload?: boolean - /** - * Ink render function - */ - render: (element: any) => void - /** * Root bud.js instance * diff --git a/sources/@roots/bud-framework/src/methods/close/index.ts b/sources/@roots/bud-framework/src/methods/close/index.ts index 1324c42e76..37954017ef 100644 --- a/sources/@roots/bud-framework/src/methods/close/index.ts +++ b/sources/@roots/bud-framework/src/methods/close/index.ts @@ -1,5 +1,7 @@ import type {Bud} from '@roots/bud-framework' +import {exit} from 'node:process' + import isFunction from '@roots/bud-support/isFunction' /** @@ -23,7 +25,7 @@ export interface close { export function close(onComplete?: () => unknown) { try { if (this.compiler?.instance?.running) { - this.compiler.instance.close(() => { + this.compiler.instance.close?.(() => { closeDevelopmentServer(this) }) } else { @@ -34,6 +36,8 @@ export function close(onComplete?: () => unknown) { } if (onComplete) return onComplete() + + return exit() } const closeDevelopmentServer = (bud: Bud) => { @@ -49,6 +53,7 @@ const closeDevelopmentServer = (bud: Bud) => { if ( bud.isDevelopment && + bud.server.connection?.instance?.listening && isFunction(bud.server.connection?.instance?.close) ) { bud.server.connection.instance.close() diff --git a/sources/@roots/bud-framework/src/services/compiler/index.ts b/sources/@roots/bud-framework/src/services/compiler/index.ts index 53736ce3f4..37a3b471b0 100644 --- a/sources/@roots/bud-framework/src/services/compiler/index.ts +++ b/sources/@roots/bud-framework/src/services/compiler/index.ts @@ -4,7 +4,6 @@ import type { MultiCompiler, MultiStats, StatsCompilation, - StatsError, } from '@roots/bud-framework/config' /** @@ -26,13 +25,6 @@ export interface Compiler { */ config: {parallelism?: number} & Array> - /** - * Format errors - */ - formatErrors( - errors: Array | undefined, - ): Array<({file: string} & Error) | StatsError> - /** * Compiler implementation */ @@ -54,12 +46,4 @@ export interface Compiler { stats: StatsCompilation } -export type BudError = { - column: number - file: string - line: number - message: string - type: 'export' | 'syntax' -} - export type Config = Configuration diff --git a/sources/@roots/bud-framework/src/services/dashboard/index.ts b/sources/@roots/bud-framework/src/services/dashboard/index.ts index 6655071447..432b602e0d 100644 --- a/sources/@roots/bud-framework/src/services/dashboard/index.ts +++ b/sources/@roots/bud-framework/src/services/dashboard/index.ts @@ -1,5 +1,4 @@ import type {MultiStats, StatsError} from '@roots/bud-framework/config' -import type {BudError} from '@roots/bud-support/errors' /** * Dashboard service container @@ -16,9 +15,4 @@ export interface Dashboard { * Render function */ render: (stats?: MultiStats, error?: any) => any - - /** - * Render error - */ - renderError: (error: BudError) => any } diff --git a/sources/@roots/bud-stylelint/test/stylelintrc-no-extension.test.ts b/sources/@roots/bud-stylelint/test/stylelintrc-no-extension.test.ts index 8c22b9612a..87ef13f20c 100644 --- a/sources/@roots/bud-stylelint/test/stylelintrc-no-extension.test.ts +++ b/sources/@roots/bud-stylelint/test/stylelintrc-no-extension.test.ts @@ -4,7 +4,13 @@ import {describe, expect, it} from 'vitest' describe(`bud build with extensionless stylelintrc`, () => { it(`should build with expected stdout`, async () => { - await execa(`yarn`, [`workspace`, `@tests/stylelint-command-with-errors`, `run`, `bud`, `clean`]) + await execa(`yarn`, [ + `workspace`, + `@tests/stylelintrc-no-extension`, + `run`, + `bud`, + `clean`, + ]) const result = await execa(`yarn`, [ `workspace`, @@ -18,7 +24,8 @@ describe(`bud build with extensionless stylelintrc`, () => { const [_s, title, _s2, entry, runtime, css, js, _s3, timings] = stripAnsi(result.stdout).split(`\n`) - expect(stripAnsi(result.stdout).split(/\n/).slice(0, 7).join(`\n`)).toMatchInlineSnapshot(` + expect(stripAnsi(result.stdout).split(/\n/).slice(0, 7).join(`\n`)) + .toMatchInlineSnapshot(` " ╭ stylelintrc-no-extension [87e8ac84aafa65f4] ./dist │ diff --git a/sources/@roots/bud-support/jsx-dev-runtime/index.cjs b/sources/@roots/bud-support/jsx-dev-runtime/index.cjs index df68b20164..e189aa7b86 100644 --- a/sources/@roots/bud-support/jsx-dev-runtime/index.cjs +++ b/sources/@roots/bud-support/jsx-dev-runtime/index.cjs @@ -1,1512 +1,42 @@ -/* eslint-disable n/no-process-env */ -/* eslint-disable no-console */ /** * @license React - * react-jsx-dev-runtime.development.js + * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - -'use strict' - -if (process.env.NODE_ENV !== `production`) { - ;(function () { - 'use strict' - - var React = require(`react`) - - // ATTENTION - // When adding new symbols to this file, - // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' - // The Symbol used to tag the ReactElement-like types. - var REACT_ELEMENT_TYPE = Symbol.for(`react.element`) - var REACT_PORTAL_TYPE = Symbol.for(`react.portal`) - var REACT_FRAGMENT_TYPE = Symbol.for(`react.fragment`) - var REACT_STRICT_MODE_TYPE = Symbol.for(`react.strict_mode`) - var REACT_PROFILER_TYPE = Symbol.for(`react.profiler`) - var REACT_PROVIDER_TYPE = Symbol.for(`react.provider`) - var REACT_CONTEXT_TYPE = Symbol.for(`react.context`) - var REACT_FORWARD_REF_TYPE = Symbol.for(`react.forward_ref`) - var REACT_SUSPENSE_TYPE = Symbol.for(`react.suspense`) - var REACT_SUSPENSE_LIST_TYPE = Symbol.for(`react.suspense_list`) - var REACT_MEMO_TYPE = Symbol.for(`react.memo`) - var REACT_LAZY_TYPE = Symbol.for(`react.lazy`) - var REACT_OFFSCREEN_TYPE = Symbol.for(`react.offscreen`) - var MAYBE_ITERATOR_SYMBOL = Symbol.iterator - var FAUX_ITERATOR_SYMBOL = `@@iterator` - function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== `object`) { - return null - } - - var maybeIterator = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable[FAUX_ITERATOR_SYMBOL] - - if (typeof maybeIterator === `function`) { - return maybeIterator - } - - return null - } - - var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - - function error(format) { - { - { - for ( - var _len2 = arguments.length, - args = new Array(_len2 > 1 ? _len2 - 1 : 0), - _key2 = 1; - _key2 < _len2; - _key2++ - ) { - args[_key2 - 1] = arguments[_key2] - } - - printWarning(`error`, format, args) - } - } - } - - function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var ReactDebugCurrentFrame = - ReactSharedInternals.ReactDebugCurrentFrame - var stack = ReactDebugCurrentFrame.getStackAddendum() - - if (stack !== ``) { - format += `%s` - args = args.concat([stack]) - } - - var argsWithFormat = args.map(function (item) { - return String(item) - }) // Careful: RN currently depends on this prefix - - argsWithFormat.unshift(`Warning: ` + format) // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - - Function.prototype.apply.call( - console[level], - console, - argsWithFormat, - ) - } - } - - // ----------------------------------------------------------------------------- - - var enableScopeAPI = false // Experimental Create Event Handle API. - var enableCacheElement = false - var enableTransitionTracing = false // No known bugs, but needs performance testing - - var enableLegacyHidden = false // Enables unstable_avoidThisFallback feature in Fiber - // stuff. Intended to enable React core members to more easily debug scheduling - // issues in DEV builds. - - var enableDebugTracing = false // Track which Fiber(s) schedule render work. - - var REACT_MODULE_REFERENCE - - { - REACT_MODULE_REFERENCE = Symbol.for(`react.module.reference`) - } - - function isValidElementType(type) { - if (typeof type === `string` || typeof type === `function`) { - return true - } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). - - if ( - type === REACT_FRAGMENT_TYPE || - type === REACT_PROFILER_TYPE || - enableDebugTracing || - type === REACT_STRICT_MODE_TYPE || - type === REACT_SUSPENSE_TYPE || - type === REACT_SUSPENSE_LIST_TYPE || - enableLegacyHidden || - type === REACT_OFFSCREEN_TYPE || - enableScopeAPI || - enableCacheElement || - enableTransitionTracing - ) { - return true - } - - if (typeof type === `object` && type !== null) { - if ( - type.$$typeof === REACT_LAZY_TYPE || - type.$$typeof === REACT_MEMO_TYPE || - type.$$typeof === REACT_PROVIDER_TYPE || - type.$$typeof === REACT_CONTEXT_TYPE || - type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object - // types supported by any Flight configuration anywhere since - // we don't know which Flight build this will end up being used - // with. - type.$$typeof === REACT_MODULE_REFERENCE || - type.getModuleId !== undefined - ) { - return true - } - } - - return false - } - - function getWrappedName(outerType, innerType, wrapperName) { - var displayName = outerType.displayName - - if (displayName) { - return displayName - } - - var functionName = innerType.displayName || innerType.name || `` - return functionName !== `` - ? wrapperName + `(` + functionName + `)` - : wrapperName - } // Keep in sync with react-reconciler/getComponentNameFromFiber - - function getContextName(type) { - return type.displayName || `Context` - } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. - - function getComponentNameFromType(type) { - if (type == null) { - // Host root, text node or just invalid type. - return null - } - - { - if (typeof type.tag === `number`) { - error( - `Received an unexpected object in getComponentNameFromType(). ` + - `This is likely a bug in React. Please file an issue.`, - ) - } - } - - if (typeof type === `function`) { - return type.displayName || type.name || null - } - - if (typeof type === `string`) { - return type - } - - switch (type) { - case REACT_FRAGMENT_TYPE: - return `Fragment` - - case REACT_PORTAL_TYPE: - return `Portal` - - case REACT_PROFILER_TYPE: - return `Profiler` - - case REACT_STRICT_MODE_TYPE: - return `StrictMode` - - case REACT_SUSPENSE_TYPE: - return `Suspense` - - case REACT_SUSPENSE_LIST_TYPE: - return `SuspenseList` - } - - if (typeof type === `object`) { - switch (type.$$typeof) { - case REACT_CONTEXT_TYPE: - var context = type - return getContextName(context) + `.Consumer` - - case REACT_PROVIDER_TYPE: - var provider = type - return getContextName(provider._context) + `.Provider` - - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, `ForwardRef`) - - case REACT_MEMO_TYPE: - var outerName = type.displayName || null - - if (outerName !== null) { - return outerName - } - - return getComponentNameFromType(type.type) || `Memo` - - case REACT_LAZY_TYPE: { - var lazyComponent = type - var payload = lazyComponent._payload - var init = lazyComponent._init - - try { - return getComponentNameFromType(init(payload)) - } catch (x) { - return null - } - } - - // eslint-disable-next-line no-fallthrough - } - } - - return null - } - - var assign = Object.assign - - // Helpers to patch console.logs to avoid logging during side-effect free - // replaying on render function. This currently only patches the object - // lazily which won't cover if the log function was extracted eagerly. - // We could also eagerly patch the method. - var disabledDepth = 0 - var prevLog - var prevInfo - var prevWarn - var prevError - var prevGroup - var prevGroupCollapsed - var prevGroupEnd - - function disabledLog() {} - - disabledLog.__reactDisabledLog = true - function disableLogs() { - { - if (disabledDepth === 0) { - prevLog = console.log - prevInfo = console.info - prevWarn = console.warn - prevError = console.error - prevGroup = console.group - prevGroupCollapsed = console.groupCollapsed - prevGroupEnd = console.groupEnd // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true, - } // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - error: props, - group: props, - groupCollapsed: props, - groupEnd: props, - info: props, - log: props, - warn: props, - }) - } - - disabledDepth++ - } - } - function reenableLogs() { - { - disabledDepth-- - - if (disabledDepth === 0) { - var props = { - configurable: true, - enumerable: true, - writable: true, - } // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - error: assign({}, props, { - value: prevError, - }), - group: assign({}, props, { - value: prevGroup, - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed, - }), - groupEnd: assign({}, props, { - value: prevGroupEnd, - }), - info: assign({}, props, { - value: prevInfo, - }), - log: assign({}, props, { - value: prevLog, - }), - warn: assign({}, props, { - value: prevWarn, - }), - }) - } - - if (disabledDepth < 0) { - error( - `disabledDepth fell below zero. ` + - `This is a bug in React. Please file an issue.`, - ) - } - } - } - - var ReactCurrentDispatcher = - ReactSharedInternals.ReactCurrentDispatcher - var prefix - function describeBuiltInComponentFrame(name, source, ownerFn) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error() - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/) - prefix = (match && match[1]) || `` - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - return `\n` + prefix + name - } - } - var reentry = false - var componentFrameCache - - { - var PossiblyWeakMap = typeof WeakMap === `function` ? WeakMap : Map - componentFrameCache = new PossiblyWeakMap() - } - - function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return `` - } - - { - var frame = componentFrameCache.get(fn) - - if (frame !== undefined) { - return frame - } - } - - var control - reentry = true - var previousPrepareStackTrace = Error.prepareStackTrace // $FlowFixMe It does accept undefined. - - Error.prepareStackTrace = undefined - var previousDispatcher - - { - previousDispatcher = ReactCurrentDispatcher.current // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactCurrentDispatcher.current = null - disableLogs() - } - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error() - } // $FlowFixMe - - Object.defineProperty(Fake.prototype, `props`, { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error() - }, - }) - - if (typeof Reflect === `object` && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []) - } catch (x) { - control = x - } - - Reflect.construct(fn, [], Fake) - } else { - try { - Fake.call() - } catch (x) { - control = x - } - - fn.call(Fake.prototype) - } - } else { - try { - throw Error() - } catch (x) { - control = x - } - - fn() - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === `string`) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sample.stack.split(`\n`) - var controlLines = control.stack.split(`\n`) - var s = sampleLines.length - 1 - var c = controlLines.length - 1 - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c-- - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s-- - c-- // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = - `\n` + sampleLines[s].replace(` at new `, ` at `) // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. - - if (fn.displayName && _frame.includes(``)) { - _frame = _frame.replace( - ``, - fn.displayName, - ) - } - - { - if (typeof fn === `function`) { - componentFrameCache.set(fn, _frame) - } - } // Return the line we found. - - return _frame - } - } while (s >= 1 && c >= 0) - } - - break - } - } - } - } finally { - reentry = false - - { - ReactCurrentDispatcher.current = previousDispatcher - reenableLogs() - } - - Error.prepareStackTrace = previousPrepareStackTrace - } // Fallback to just using the name if we couldn't make it throw. - - var name = fn ? fn.displayName || fn.name : `` - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : `` - - { - if (typeof fn === `function`) { - componentFrameCache.set(fn, syntheticFrame) - } - } - - return syntheticFrame - } - function describeFunctionComponentFrame(fn, source, ownerFn) { - { - return describeNativeComponentFrame(fn, false) - } - } - - function shouldConstruct(Component) { - var prototype = Component.prototype - return !!(prototype && prototype.isReactComponent) - } - - function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { - if (type == null) { - return `` - } - - if (typeof type === `function`) { - { - return describeNativeComponentFrame(type, shouldConstruct(type)) - } - } - - if (typeof type === `string`) { - return describeBuiltInComponentFrame(type) - } - - switch (type) { - case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame(`Suspense`) - - case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame(`SuspenseList`) - } - - if (typeof type === `object`) { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render) - - case REACT_MEMO_TYPE: - // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV( - type.type, - source, - ownerFn, - ) - - case REACT_LAZY_TYPE: { - var lazyComponent = type - var payload = lazyComponent._payload - var init = lazyComponent._init - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV( - init(payload), - source, - ownerFn, - ) - } catch (x) {} - } - } - } - - return `` - } - - var hasOwnProperty = Object.prototype.hasOwnProperty - - var loggedTypeFailures = {} - var ReactDebugCurrentFrame = - ReactSharedInternals.ReactDebugCurrentFrame - - function setCurrentlyValidatingElement(element) { - { - if (element) { - var owner = element._owner - var stack = describeUnknownElementTypeFrameInDEV( - element.type, - element._source, - owner ? owner.type : null, - ) - ReactDebugCurrentFrame.setExtraStackFrame(stack) - } else { - ReactDebugCurrentFrame.setExtraStackFrame(null) - } - } - } - - function checkPropTypes( - typeSpecs, - values, - location, - componentName, - element, - ) { - { - // $FlowFixMe This is okay but Flow doesn't know it. - var has = Function.call.bind(hasOwnProperty) - - for (var typeSpecName in typeSpecs) { - if (has(typeSpecs, typeSpecName)) { - var error$1 = void 0 // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - if (typeof typeSpecs[typeSpecName] !== `function`) { - var err = Error( - (componentName || `React class`) + - `: ` + - location + - ` type \`` + - typeSpecName + - `\` is invalid; ` + - `it must be a function, usually from the \`prop-types\` package, but received \`` + - typeof typeSpecs[typeSpecName] + - `\`.` + - `This often happens because of typos such as \`PropTypes.function\` instead of \`PropTypes.func\`.`, - ) - err.name = `Invariant Violation` - throw err - } - - error$1 = typeSpecs[typeSpecName]( - values, - typeSpecName, - componentName, - location, - null, - `SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`, - ) - } catch (ex) { - error$1 = ex - } - - if (error$1 && !(error$1 instanceof Error)) { - setCurrentlyValidatingElement(element) - - error( - `%s: type specification of %s` + - ` \`%s\` is invalid; the type checker ` + - `function must return \`null\` or an \`Error\` but returned a %s. ` + - `You may have forgotten to pass an argument to the type checker ` + - `creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ` + - `shape all require an argument).`, - componentName || `React class`, - location, - typeSpecName, - typeof error$1, - ) - - setCurrentlyValidatingElement(null) - } - - if ( - error$1 instanceof Error && - !(error$1.message in loggedTypeFailures) - ) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error$1.message] = true - setCurrentlyValidatingElement(element) - - error(`Failed %s type: %s`, location, error$1.message) - - setCurrentlyValidatingElement(null) - } - } - } - } - } - - var isArrayImpl = Array.isArray // eslint-disable-next-line no-redeclare - - function isArray(a) { - return isArrayImpl(a) - } - - /* - * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol - * and Temporal.* types. See https://github.com/facebook/react/pull/22064. - * - * The functions in this module will throw an easier-to-understand, - * easier-to-debug exception with a clear errors message message explaining the - * problem. (Instead of a confusing exception thrown inside the implementation - * of the `value` object). - */ - // $FlowFixMe only called in DEV, so void return is not possible. - function typeName(value) { - { - // toStringTag is needed for namespaced types like Temporal.Instant - var hasToStringTag = - typeof Symbol === `function` && Symbol.toStringTag - var type = - (hasToStringTag && value[Symbol.toStringTag]) || - value.constructor.name || - `Object` - return type - } - } // $FlowFixMe only called in DEV, so void return is not possible. - - function willCoercionThrow(value) { - { - try { - testStringCoercion(value) - return false - } catch (e) { - return true - } - } - } - - function testStringCoercion(value) { - // If you ended up here by following an exception call stack, here's what's - // happened: you supplied an object or symbol value to React (as a prop, key, - // DOM attribute, CSS property, string ref, etc.) and when React tried to - // coerce it to a string using `'' + value`, an exception was thrown. - // - // The most common types that will cause this exception are `Symbol` instances - // and Temporal objects like `Temporal.Instant`. But any object that has a - // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this - // exception. (Library authors do this to prevent users from using built-in - // numeric operators like `+` or comparison operators like `>=` because custom - // methods are needed to perform accurate arithmetic or comparison.) - // - // To fix the problem, coerce this object or symbol value to a string before - // passing it to React. The most reliable way is usually `String(value)`. - // - // To find which value is throwing, check the browser or debugger console. - // Before this exception was thrown, there should be `console.error` output - // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the - // problem and how that type was used: key, atrribute, input value prop, etc. - // In most cases, this console output also shows the component and its - // ancestor components where the exception happened. - // - return `` + value - } - function checkKeyStringCoercion(value) { - { - if (willCoercionThrow(value)) { - error( - `The provided key is an unsupported type %s.` + - ` This value must be coerced to a string before before using it here.`, - typeName(value), - ) - - return testStringCoercion(value) // throw (to help callers find troubleshooting comments) - } - } - } - - var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner - var RESERVED_PROPS = { - __self: true, - __source: true, - key: true, - ref: true, - } - var specialPropKeyWarningShown - var specialPropRefWarningShown - var didWarnAboutStringRefs - - { - didWarnAboutStringRefs = {} - } - - function hasValidRef(config) { - { - if (hasOwnProperty.call(config, `ref`)) { - var getter = Object.getOwnPropertyDescriptor(config, `ref`).get - - if (getter && getter.isReactWarning) { - return false - } - } - } - - return config.ref !== undefined - } - - function hasValidKey(config) { - { - if (hasOwnProperty.call(config, `key`)) { - var getter = Object.getOwnPropertyDescriptor(config, `key`).get - - if (getter && getter.isReactWarning) { - return false - } - } - } - - return config.key !== undefined - } - - function warnIfStringRefCannotBeAutoConverted(config, self) { - { - if ( - typeof config.ref === `string` && - ReactCurrentOwner.current && - self && - ReactCurrentOwner.current.stateNode !== self - ) { - var componentName = getComponentNameFromType( - ReactCurrentOwner.current.type, - ) - - if (!didWarnAboutStringRefs[componentName]) { - error( - `Component "%s" contains the string ref "%s". ` + - `Support for string refs will be removed in a future major release. ` + - `This case cannot be automatically converted to an arrow function. ` + - `We ask you to manually fix this case by using useRef() or createRef() instead. ` + - `Learn more about using refs safely here: ` + - `https://reactjs.org/link/strict-mode-string-ref`, - getComponentNameFromType(ReactCurrentOwner.current.type), - config.ref, - ) - - didWarnAboutStringRefs[componentName] = true - } - } - } - } - - function defineKeyPropWarningGetter(props, displayName) { - { - var warnAboutAccessingKey = function () { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true - - error( - `%s: \`key\` is not a prop. Trying to access it will result ` + - `in \`undefined\` being returned. If you need to access the same ` + - `value within the child component, you should pass it as a different ` + - `prop. (https://reactjs.org/link/special-props)`, - displayName, - ) - } - } - - warnAboutAccessingKey.isReactWarning = true - Object.defineProperty(props, `key`, { - configurable: true, - get: warnAboutAccessingKey, - }) - } - } - - function defineRefPropWarningGetter(props, displayName) { - { - var warnAboutAccessingRef = function () { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true - - error( - `%s: \`ref\` is not a prop. Trying to access it will result ` + - `in \`undefined\` being returned. If you need to access the same ` + - `value within the child component, you should pass it as a different ` + - `prop. (https://reactjs.org/link/special-props)`, - displayName, - ) - } - } - - warnAboutAccessingRef.isReactWarning = true - Object.defineProperty(props, `ref`, { - configurable: true, - get: warnAboutAccessingRef, - }) - } - } - /** - * Factory method to create a new React element. This no longer adheres to - * the class pattern, so do not use new to call it. Also, instanceof check - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check - * if something is a React Element. - * - * @param {*} type - * @param {*} props - * @param {*} key - * @param {string|object} ref - * @param {*} owner - * @param {*} self A *temporary* helper to detect places where `this` is - * different from the `owner` when React.createElement is called, so that we - * can warn. We want to get rid of owner and replace string `ref`s with arrow - * functions, and as long as `this` and owner are the same, there will be no - * change in behavior. - * @param {*} source An annotation object (added by a transpiler or otherwise) - * indicating filename, line number, and/or other information. - * @internal - */ - - var ReactElement = function ( - type, - key, - ref, - self, - source, - owner, - props, - ) { - var element = { - // Record the component responsible for creating this element. - _owner: owner, - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - key: key, - props: props, - ref: ref, - // Built-in properties that belong on the element - type: type, - } - - { - // The validation flag is currently mutative. We put it on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - element._store = {} // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. - - Object.defineProperty(element._store, `validated`, { - configurable: false, - enumerable: false, - value: false, - writable: true, - }) // self and source are DEV only properties. - - Object.defineProperty(element, `_self`, { - configurable: false, - enumerable: false, - value: self, - writable: false, - }) // Two elements created in two different places should be considered - // equal for testing purposes and therefore we hide it from enumeration. - - Object.defineProperty(element, `_source`, { - configurable: false, - enumerable: false, - value: source, - writable: false, - }) - - if (Object.freeze) { - Object.freeze(element.props) - Object.freeze(element) - } - } - - return element - } - /** - * https://github.com/reactjs/rfcs/pull/107 - * @param {*} type - * @param {object} props - * @param {string} key - */ - - function jsxDEV(type, config, maybeKey, source, self) { - { - var propName // Reserved names are extracted - - var props = {} - var key = null - var ref = null // Currently, key can be spread in as a prop. This causes a potential - // issue if key is also explicitly declared (ie.
- // or
). We want to deprecate key spread, - // but as an intermediary step, we will use jsxDEV for everything except - //
, because we aren't currently able to tell if - // key is explicitly declared to be undefined or not. - - if (maybeKey !== undefined) { - { - checkKeyStringCoercion(maybeKey) - } - - key = `` + maybeKey - } - - if (hasValidKey(config)) { - { - checkKeyStringCoercion(config.key) - } - - key = `` + config.key - } - - if (hasValidRef(config)) { - ref = config.ref - warnIfStringRefCannotBeAutoConverted(config, self) - } // Remaining properties are added to a new props object - - for (propName in config) { - if ( - hasOwnProperty.call(config, propName) && - !RESERVED_PROPS.hasOwnProperty(propName) - ) { - props[propName] = config[propName] - } - } // Resolve default props - - if (type && type.defaultProps) { - var defaultProps = type.defaultProps - - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName] - } - } - } - - if (key || ref) { - var displayName = - typeof type === `function` - ? type.displayName || type.name || `Unknown` - : type - - if (key) { - defineKeyPropWarningGetter(props, displayName) - } - - if (ref) { - defineRefPropWarningGetter(props, displayName) - } - } - - return ReactElement( - type, - key, - ref, - self, - source, - ReactCurrentOwner.current, - props, - ) - } - } - - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner - var ReactDebugCurrentFrame$1 = - ReactSharedInternals.ReactDebugCurrentFrame - - function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner - var stack = describeUnknownElementTypeFrameInDEV( - element.type, - element._source, - owner ? owner.type : null, - ) - ReactDebugCurrentFrame$1.setExtraStackFrame(stack) - } else { - ReactDebugCurrentFrame$1.setExtraStackFrame(null) - } - } - } - - var propTypesMisspellWarningShown - - { - propTypesMisspellWarningShown = false - } - /** - * Verifies the object is a ReactElement. - * See https://reactjs.org/docs/react-api.html#isvalidelement - * @param {?object} object - * @return {boolean} True if `object` is a ReactElement. - * @final - */ - - function isValidElement(object) { - { - return ( - typeof object === `object` && - object !== null && - object.$$typeof === REACT_ELEMENT_TYPE - ) - } - } - - function getDeclarationErrorAddendum() { - { - if (ReactCurrentOwner$1.current) { - var name = getComponentNameFromType( - ReactCurrentOwner$1.current.type, - ) - - if (name) { - return `\n\nCheck the render method of \`` + name + `\`.` - } - } - - return `` - } - } - - function getSourceInfoErrorAddendum(source) { - { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ``) - var lineNumber = source.lineNumber - return ( - `\n\nCheck your code at ` + fileName + `:` + lineNumber + `.` - ) - } - - return `` - } - } - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - var ownerHasKeyUseWarning = {} - - function getCurrentComponentErrorInfo(parentType) { - { - var info = getDeclarationErrorAddendum() - - if (!info) { - var parentName = - typeof parentType === `string` - ? parentType - : parentType.displayName || parentType.name - - if (parentName) { - info = - `\n\nCheck the top-level render call using <` + - parentName + - `>.` - } - } - - return info - } - } - /** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - - function validateExplicitKey(element, parentType) { - { - if ( - !element._store || - element._store.validated || - element.key != null - ) { - return - } - - element._store.validated = true - var currentComponentErrorInfo = - getCurrentComponentErrorInfo(parentType) - - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { - return - } - - ownerHasKeyUseWarning[currentComponentErrorInfo] = true // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - - var childOwner = `` - - if ( - element && - element._owner && - element._owner !== ReactCurrentOwner$1.current - ) { - // Give the component that originally created this child. - childOwner = - ` It was passed a child from ` + - getComponentNameFromType(element._owner.type) + - `.` - } - - setCurrentlyValidatingElement$1(element) - - error( - `Each child in a list should have a unique "key" prop.` + - `%s%s See https://reactjs.org/link/warning-keys for more information.`, - currentComponentErrorInfo, - childOwner, - ) - - setCurrentlyValidatingElement$1(null) - } - } - /** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. - */ - - function validateChildKeys(node, parentType) { - { - if (typeof node !== `object`) { - return - } - - if (isArray(node)) { - for (var i = 0; i < node.length; i++) { - var child = node[i] - - if (isValidElement(child)) { - validateExplicitKey(child, parentType) - } - } - } else if (isValidElement(node)) { - // This element was passed in a valid location. - if (node._store) { - node._store.validated = true - } - } else if (node) { - var iteratorFn = getIteratorFn(node) - - if (typeof iteratorFn === `function`) { - // Entry iterators used to provide implicit keys, - // but now we print a separate warning for them later. - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node) - var step - - while (!(step = iterator.next()).done) { - if (isValidElement(step.value)) { - validateExplicitKey(step.value, parentType) - } - } - } - } - } - } - } - /** - * Given an element, validate that its props follow the propTypes definition, - * provided by the type. - * - * @param {ReactElement} element - */ - - function validatePropTypes(element) { - { - var type = element.type - - if ( - type === null || - type === undefined || - typeof type === `string` - ) { - return - } - - var propTypes - - if (typeof type === `function`) { - propTypes = type.propTypes - } else if ( - typeof type === `object` && - (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. - // Inner props are checked in the reconciler. - type.$$typeof === REACT_MEMO_TYPE) - ) { - propTypes = type.propTypes - } else { - return - } - - if (propTypes) { - // Intentionally inside to avoid triggering lazy initializers: - var name = getComponentNameFromType(type) - checkPropTypes(propTypes, element.props, `prop`, name, element) - } else if ( - type.PropTypes !== undefined && - !propTypesMisspellWarningShown - ) { - propTypesMisspellWarningShown = true // Intentionally inside to avoid triggering lazy initializers: - - var _name = getComponentNameFromType(type) - - error( - `Component %s declared \`PropTypes\` instead of \`propTypes\`. Did you misspell the property assignment?`, - _name || `Unknown`, - ) - } - - if ( - typeof type.getDefaultProps === `function` && - !type.getDefaultProps.isReactClassApproved - ) { - error( - `getDefaultProps is only used on classic React.createClass ` + - `definitions. Use a static property named \`defaultProps\` instead.`, - ) - } - } - } - /** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - function validateFragmentProps(fragment) { - { - var keys = Object.keys(fragment.props) - - for (var i = 0; i < keys.length; i++) { - var key = keys[i] - - if (key !== `children` && key !== `key`) { - setCurrentlyValidatingElement$1(fragment) - - error( - `Invalid prop \`%s\` supplied to \`React.Fragment\`. ` + - `React.Fragment can only have \`key\` and \`children\` props.`, - key, - ) - - setCurrentlyValidatingElement$1(null) - break - } - } - - if (fragment.ref !== null) { - setCurrentlyValidatingElement$1(fragment) - - error(`Invalid attribute \`ref\` supplied to \`React.Fragment\`.`) - - setCurrentlyValidatingElement$1(null) - } - } - } - - function jsxWithValidation( - type, - props, - key, - isStaticChildren, - source, - self, - ) { - { - var validType = isValidElementType(type) // We warn in this case but don't throw. We expect the element creation to - // succeed and there will likely be errors in render. - - if (!validType) { - var info = `` - - if ( - type === undefined || - (typeof type === `object` && - type !== null && - Object.keys(type).length === 0) - ) { - info += - ` You likely forgot to export your component from the file ` + - `it's defined in, or you might have mixed up default and named imports.` - } - - var sourceInfo = getSourceInfoErrorAddendum(source) - - if (sourceInfo) { - info += sourceInfo - } else { - info += getDeclarationErrorAddendum() - } - - var typeString - - if (type === null) { - typeString = `null` - } else if (isArray(type)) { - typeString = `array` - } else if ( - type !== undefined && - type.$$typeof === REACT_ELEMENT_TYPE - ) { - typeString = - `<` + - (getComponentNameFromType(type.type) || `Unknown`) + - ` />` - info = - ` Did you accidentally export a JSX literal instead of a component?` - } else { - typeString = typeof type - } - - error( - `React.jsx: type is invalid -- expected a string (for ` + - `built-in components) or a class/function (for composite ` + - `components) but got: %s.%s`, - typeString, - info, - ) - } - - var element = jsxDEV(type, props, key, source, self) // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - - if (element == null) { - return element - } // Skip key warning if the type isn't valid since our key validation logic - // doesn't expect a non-string/function type and can throw confusing errors. - // We don't want exception behavior to differ between dev and prod. - // (Rendering will throw with a helpful message and as soon as the type is - // fixed, the key warnings will appear.) - - if (validType) { - var children = props.children - - if (children !== undefined) { - if (isStaticChildren) { - if (isArray(children)) { - for (var i = 0; i < children.length; i++) { - validateChildKeys(children[i], type) - } - - if (Object.freeze) { - Object.freeze(children) - } - } else { - error( - `React.jsx: Static children should always be an array. ` + - `You are likely explicitly calling React.jsxs or React.jsxDEV. ` + - `Use the Babel transform instead.`, - ) - } - } else { - validateChildKeys(children, type) - } - } - } - - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element) - } else { - validatePropTypes(element) - } - - return element - } - } // These two functions exist to still get child warnings in dev - - var jsxDEV$1 = jsxWithValidation - - exports.Fragment = REACT_FRAGMENT_TYPE - exports.jsxDEV = jsxDEV$1 - })() +var f = require(`react`), + k = Symbol.for(`react.element`), + l = Symbol.for(`react.fragment`), + m = Object.prototype.hasOwnProperty, + n = + f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, + p = {__self: !0, __source: !0, key: !0, ref: !0} + +function q(c, a, g) { + var b, + d = {}, + e = null, + h = null + void 0 !== g && (e = `` + g) + void 0 !== a.key && (e = `` + a.key) + void 0 !== a.ref && (h = a.ref) + for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]) + if (c && c.defaultProps) + for (b in ((a = c.defaultProps), a)) void 0 === d[b] && (d[b] = a[b]) + return { + _owner: n.current, + $$typeof: k, + key: e, + props: d, + ref: h, + type: c, + } } + +exports.Fragment = l +exports.jsx = q +exports.jsxs = q +exports.jsxDEV = q diff --git a/sources/@roots/bud-support/jsx-runtime/index.cjs b/sources/@roots/bud-support/jsx-runtime/index.cjs index 3d3a0e3ac5..e189aa7b86 100644 --- a/sources/@roots/bud-support/jsx-runtime/index.cjs +++ b/sources/@roots/bud-support/jsx-runtime/index.cjs @@ -7,5 +7,36 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict';var f=require(`react`),k=Symbol.for(`react.element`),l=Symbol.for(`react.fragment`),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={__self:!0,__source:!0,key:!0,ref:!0}; -function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=``+g);void 0!==a.key&&(e=``+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{_owner:n.current,$$typeof:k,key:e,props:d,ref:h,type:c}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q; +var f = require(`react`), + k = Symbol.for(`react.element`), + l = Symbol.for(`react.fragment`), + m = Object.prototype.hasOwnProperty, + n = + f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, + p = {__self: !0, __source: !0, key: !0, ref: !0} + +function q(c, a, g) { + var b, + d = {}, + e = null, + h = null + void 0 !== g && (e = `` + g) + void 0 !== a.key && (e = `` + a.key) + void 0 !== a.ref && (h = a.ref) + for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]) + if (c && c.defaultProps) + for (b in ((a = c.defaultProps), a)) void 0 === d[b] && (d[b] = a[b]) + return { + _owner: n.current, + $$typeof: k, + key: e, + props: d, + ref: h, + type: c, + } +} + +exports.Fragment = l +exports.jsx = q +exports.jsxs = q +exports.jsxDEV = q diff --git a/sources/@roots/bud-support/package.json b/sources/@roots/bud-support/package.json index 388c4b18b8..093e13ff2b 100644 --- a/sources/@roots/bud-support/package.json +++ b/sources/@roots/bud-support/package.json @@ -86,6 +86,7 @@ "./http-proxy-middleware": "./lib/http-proxy-middleware/index.js", "./human-readable": "./lib/human-readable/index.js", "./ink": "./lib/ink/index.js", + "./ink/instance": "./lib/ink/instance/index.js", "./import-meta-resolve": "./lib/import-meta-resolve/index.js", "./isObject": "./lib/isObject/index.js", "./json5": "./lib/json5/index.js", @@ -217,6 +218,9 @@ "ink": [ "./lib/ink/index.d.ts" ], + "ink/instance": [ + "./lib/ink/instance/index.d.ts" + ], "isObject": [ "./lib/isObject/index.d.ts" ], diff --git a/sources/@roots/bud-support/src/ink/instance/index.tsx b/sources/@roots/bud-support/src/ink/instance/index.tsx new file mode 100644 index 0000000000..8f36b8cab0 --- /dev/null +++ b/sources/@roots/bud-support/src/ink/instance/index.tsx @@ -0,0 +1,15 @@ +import * as Ink from '@roots/bud-support/ink' + +let instance: Ink.Instance + +const render = (node: Ink.ReactNode): Ink.Instance => { + if (instance) { + instance.rerender(node) + } else { + instance = Ink.render(node) + } + + return instance +} + +export {instance, render} diff --git a/sources/@roots/bud-swc/src/extension/jsc.ts b/sources/@roots/bud-swc/src/extension/jsc.ts index 75b2f3e00e..f165cc9708 100644 --- a/sources/@roots/bud-swc/src/extension/jsc.ts +++ b/sources/@roots/bud-swc/src/extension/jsc.ts @@ -132,6 +132,10 @@ class BudJSCApi extends Extension { ) { this.setExperimental((experimental = {}) => ({ ...experimental, + plugins: + typeof plugins === `function` + ? plugins(experimental.plugins) + : plugins, })) } } diff --git a/sources/@roots/bud/config/jsconfig.json b/sources/@roots/bud/config/jsconfig.json index 5cb5e178f8..f5d65a4bd7 100644 --- a/sources/@roots/bud/config/jsconfig.json +++ b/sources/@roots/bud/config/jsconfig.json @@ -9,22 +9,22 @@ "isolatedModules": true, "jsx": "preserve", "lib": ["DOM", "DOM.Iterable", "ESNext"], - "module": "esnext", - "moduleResolution": "node", + "module": "NodeNext", + "moduleResolution": "NodeNext", "noEmit": true, "noFallthroughCasesInSwitch": true, "resolveJsonModule": true, "skipLibCheck": true, - "target": "esnext", + "target": "ES6", "types": [ "node", - "@roots/bud-framework", "@roots/bud-api", "@roots/bud-build", "@roots/bud-cache", "@roots/bud-compiler", "@roots/bud-dashboard", "@roots/bud-extensions", + "@roots/bud-framework", "@roots/bud-hooks", "@roots/bud-server", "@roots/bud-support", diff --git a/sources/@roots/bud/config/tsconfig.json b/sources/@roots/bud/config/tsconfig.json index 3a51940f9e..c84a98f536 100644 --- a/sources/@roots/bud/config/tsconfig.json +++ b/sources/@roots/bud/config/tsconfig.json @@ -9,13 +9,13 @@ "isolatedModules": true, "jsx": "preserve", "lib": ["DOM", "DOM.Iterable", "ESNext"], - "module": "esnext", - "moduleResolution": "node", + "module": "NodeNext", + "moduleResolution": "NodeNext", "noEmit": true, "noFallthroughCasesInSwitch": true, "resolveJsonModule": true, "skipLibCheck": true, - "target": "esnext", + "target": "ES6", "types": [ "node", "@roots/bud-api", @@ -24,6 +24,7 @@ "@roots/bud-compiler", "@roots/bud-dashboard", "@roots/bud-extensions", + "@roots/bud-framework", "@roots/bud-hooks", "@roots/bud-server", "@roots/bud-support", diff --git a/sources/@roots/bud/src/cli/app/index.ts b/sources/@roots/bud/src/cli/app/index.ts index 11d67c36fa..c92bae2926 100644 --- a/sources/@roots/bud/src/cli/app/index.ts +++ b/sources/@roots/bud/src/cli/app/index.ts @@ -16,7 +16,7 @@ import BudViewCommand from '@roots/bud/cli/commands/view' import BudWebpackCommand from '@roots/bud/cli/commands/webpack' import {Finder} from '@roots/bud/cli/finder' import getContext, {type Context} from '@roots/bud/context' -import {render as renderError} from '@roots/bud-dashboard/components/error' +import {renderError} from '@roots/bud-dashboard/components/error' import * as args from '@roots/bud-framework/bootstrap/args' import {Builtins, Cli} from '@roots/bud-support/clipanion' import {BudError} from '@roots/bud-support/errors' diff --git a/sources/@roots/bud/src/cli/commands/index.tsx b/sources/@roots/bud/src/cli/commands/index.tsx index 62dcde4381..afd0bbc503 100644 --- a/sources/@roots/bud/src/cli/commands/index.tsx +++ b/sources/@roots/bud/src/cli/commands/index.tsx @@ -33,6 +33,7 @@ import {bind} from '@roots/bud-support/decorators/bind' import {BudError} from '@roots/bud-support/errors' import figures from '@roots/bud-support/figures' import * as Ink from '@roots/bud-support/ink' +import {render} from '@roots/bud-support/ink/instance' import isNumber from '@roots/bud-support/isNumber' import noop from '@roots/bud-support/noop' @@ -104,7 +105,7 @@ export default class BudCommand extends Command { public output = output - public declare notify: typeof notify + public notify = notify public publicPath = publicPath @@ -116,29 +117,11 @@ export default class BudCommand extends Command { public verbose = verbose - public ink?: Ink.Instance - - /** - * Ink {@link Instance} - */ - public static Ink: typeof Ink = Ink - - /** - * Render cli output - */ - public render(El: React.ReactElement) { - if (this.ink) { - this.ink.rerender(El) - } else { - this.ink = BudCommand.Ink.render(El) - } - } - /** * Render static cli output */ public renderStatic(el: React.ReactElement) { - return this.render( + return render( {(e, i) => {el}} , @@ -253,7 +236,7 @@ export default class BudCommand extends Command { }) } - this.render() + render() if ((!this.bud || this.bud.isProduction) && this.ignoreErrors !== true) exit(1) @@ -264,7 +247,7 @@ export default class BudCommand extends Command { */ public async execute(): Promise { const {Menu} = await import(`@roots/bud/cli/components/Menu`) - this.render() + render() } /** @@ -275,8 +258,8 @@ export default class BudCommand extends Command { this.context = { ...this.context, dry: this.dry, + ignoreErrors: this.ignoreErrors, mode: this.mode ?? this.context.mode ?? `production`, - render: this.render, silent: this.silent, } diff --git a/sources/@roots/bud/src/cli/commands/repl/index.tsx b/sources/@roots/bud/src/cli/commands/repl/index.tsx index 0e91922f58..70bff89429 100644 --- a/sources/@roots/bud/src/cli/commands/repl/index.tsx +++ b/sources/@roots/bud/src/cli/commands/repl/index.tsx @@ -2,7 +2,7 @@ import BudCommand from '@roots/bud/cli/commands' import indent from '@roots/bud/cli/flags/indent' import {bind} from '@roots/bud-framework/extension/decorators' import {Command, Option} from '@roots/bud-support/clipanion' -import {render} from '@roots/bud-support/ink' +import {render} from '@roots/bud-support/ink/instance' import logger from '@roots/bud-support/logger' /** diff --git a/sources/@roots/bud/src/context/index.ts b/sources/@roots/bud/src/context/index.ts index 5bc0710ce0..b8b29ff85a 100644 --- a/sources/@roots/bud/src/context/index.ts +++ b/sources/@roots/bud/src/context/index.ts @@ -11,7 +11,6 @@ import * as projectEnv from '@roots/bud-framework/bootstrap/env' import * as projectFiles from '@roots/bud-framework/bootstrap/files' import * as projectPaths from '@roots/bud-framework/bootstrap/paths' import * as filesystem from '@roots/bud-support/filesystem' -import {render} from '@roots/bud-support/ink' import logger from '@roots/bud-support/logger' import whichPm from '@roots/bud-support/which-pm' @@ -82,7 +81,6 @@ export default async function make( mode: options?.mode ?? `production`, paths: {...paths, ...(options?.paths ?? {})}, pm: args?.pm ?? options?.pm ?? `npm`, - render: options?.render ?? render, services: [...(services ?? []), ...(options?.services ?? [])], stderr: options?.stderr ?? stderr, stdin: options?.stdin ?? stdin, diff --git a/sources/@roots/bud/test/cli-flag-cache/cache-flag.test.ts b/sources/@roots/bud/test/cli-flag-cache/cache-flag.test.ts index f15fdb526a..92146702d6 100644 --- a/sources/@roots/bud/test/cli-flag-cache/cache-flag.test.ts +++ b/sources/@roots/bud/test/cli-flag-cache/cache-flag.test.ts @@ -24,7 +24,7 @@ describe(`--cache`, async () => { it(`should generate cache by default`, async () => { await execa(`yarn`, [`bud`, `build`], opts) const {stdout} = await execa(`yarn`, [`bud`, `build`, `--log`], opts) - expect(stdout).toMatch(/4\/4 modules cached/) + expect(stdout).toMatch(/1\/1 modules cached/) expect(stdout).toMatch(/Cache: filesystem/) }) @@ -34,7 +34,7 @@ describe(`--cache`, async () => { [`bud`, `build`, `--no-cache`, `--log`], opts, ) - expect(stdout).toMatch(/0\/4 modules cached/) + expect(stdout).toMatch(/0\/1 modules cached/) expect(stdout).toMatch(/Cache: disabled/) }) @@ -44,7 +44,7 @@ describe(`--cache`, async () => { [`bud`, `build`, `--cache=false`, `--log`], opts, ) - expect(stdout).toMatch(/0\/4 modules cached/) + expect(stdout).toMatch(/0\/1 modules cached/) expect(stdout).toMatch(/Cache: disabled/) }) diff --git a/tests/integration/__snapshots__/babel.test.ts.snap b/tests/integration/__snapshots__/babel.test.ts.snap index f12f4e133a..0f5a65d786 100644 --- a/tests/integration/__snapshots__/babel.test.ts.snap +++ b/tests/integration/__snapshots__/babel.test.ts.snap @@ -14,6 +14,10 @@ exports[`examples/babel > should emit entrypoints.json 1`] = ` } `; +exports[`examples/babel > should emit main.css 1`] = `"body,html{margin:0;padding:0}#root{align-items:center;background:#5813d5;color:#fff;display:flex;font-family:sans-serif;height:100vh;justify-content:center;letter-spacing:.2em;text-align:center;text-transform:uppercase;width:100vw}"`; + +exports[`examples/babel > should emit main.js 1`] = `""use strict";(self.webpackChunk_roots_bud=self.webpackChunk_roots_bud||[]).push([[792],{"./index.js":()=>{var s;null===(s=document.querySelector("#root"))||void 0===s||s.classList.add("init")}},s=>{var e;e="./index.js",s(s.s=e)}]);"`; + exports[`examples/babel > should emit manifest.json 1`] = ` { "entrypoints.json": "entrypoints.json", @@ -23,10 +27,4 @@ exports[`examples/babel > should emit manifest.json 1`] = ` } `; -exports[`examples/babel > should emit stdout 1`] = ` -"│ -│ main -│ ◉ js/runtime.js ✔ 904 bytes -│ ◉ css/main.css ✔ 231 bytes -│ ◉ js/main.js ✔ 231 bytes" -`; +exports[`examples/babel > should emit runtime.js 1`] = `"(()=>{"use strict";var r,e={},o={};function t(r){var n=o[r];if(void 0!==n)return n.exports;var s=o[r]={exports:{}};return e[r](s,s.exports,t),s.exports}t.m=e,r=[],t.O=(e,o,n,s)=>{if(!o){var a=1/0;for(u=0;u=s)&&Object.keys(t.O).every((r=>t.O[r](o[f])))?o.splice(f--,1):(i=!1,s0&&r[u-1][2]>s;u--)r[u]=r[u-1];r[u]=[o,n,s]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={121:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var n,s,[a,i,f]=o,l=0;if(a.some((e=>0!==r[e]))){for(n in i)t.o(i,n)&&(t.m[n]=i[n]);if(f)var u=f(t)}for(e&&e(o);l should emit entrypoints.json 1`] = ` } `; +exports[`examples/basic > should emit main.css 1`] = `"body{background-color:#fff}"`; + +exports[`examples/basic > should emit main.js 1`] = `""use strict";(self.webpackChunk_roots_bud=self.webpackChunk_roots_bud||[]).push([[792],{"./index.js":()=>{document.querySelector("#root")?.classList.add("init")}},s=>{var e;e="./index.js",s(s.s=e)}]);"`; + exports[`examples/basic > should emit manifest.json 1`] = ` { "entrypoints.json": "entrypoints.json", @@ -23,10 +27,4 @@ exports[`examples/basic > should emit manifest.json 1`] = ` } `; -exports[`examples/basic > should emit stdout 1`] = ` -"│ -│ main -│ ◉ js/runtime.js ✔ 904 bytes -│ ◉ css/main.css ✔ 27 bytes -│ ◉ js/main.js ✔ 200 bytes" -`; +exports[`examples/basic > should emit runtime.js 1`] = `"(()=>{"use strict";var r,e={},o={};function t(r){var n=o[r];if(void 0!==n)return n.exports;var s=o[r]={exports:{}};return e[r](s,s.exports,t),s.exports}t.m=e,r=[],t.O=(e,o,n,s)=>{if(!o){var a=1/0;for(u=0;u=s)&&Object.keys(t.O).every((r=>t.O[r](o[f])))?o.splice(f--,1):(i=!1,s0&&r[u-1][2]>s;u--)r[u]=r[u-1];r[u]=[o,n,s]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={121:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var n,s,[a,i,f]=o,l=0;if(a.some((e=>0!==r[e]))){for(n in i)t.o(i,n)&&(t.m[n]=i[n]);if(f)var u=f(t)}for(e&&e(o);l should emit manifest.json 1`] = ` `; exports[`examples/critical-css > should emit runtime.js 1`] = `"(()=>{"use strict";var r,e={},o={};function t(r){var n=o[r];if(void 0!==n)return n.exports;var s=o[r]={exports:{}};return e[r](s,s.exports,t),s.exports}t.m=e,r=[],t.O=(e,o,n,s)=>{if(!o){var a=1/0;for(u=0;u=s)&&Object.keys(t.O).every((r=>t.O[r](o[f])))?o.splice(f--,1):(i=!1,s0&&r[u-1][2]>s;u--)r[u]=r[u-1];r[u]=[o,n,s]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={121:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var n,s,[a,i,f]=o,l=0;if(a.some((e=>0!==r[e]))){for(n in i)t.o(i,n)&&(t.m[n]=i[n]);if(f)var u=f(t)}for(e&&e(o);l should emit stdout 1`] = ` -"│ -│ app -│ ◉ js/runtime.js ✔ 904 bytes -│ ◉ css/app.css ✔ 2.78 kB -│ -│ app2 -│ ◉ js/runtime.js ✔ 904 bytes -│ ◉ css/app2.css ✔ 2.75 kB -│ -│ assets -│ ◉ index.html 307 bytes -│ … 7 additional assets not shown" -`; diff --git a/tests/integration/__snapshots__/node-api.test.ts.snap b/tests/integration/__snapshots__/node-api.test.ts.snap index 8a7a92f502..31697cdaf0 100644 --- a/tests/integration/__snapshots__/node-api.test.ts.snap +++ b/tests/integration/__snapshots__/node-api.test.ts.snap @@ -1,101 +1,48 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`node-api snapshots .budfiles/bud.webpack.config.js 1`] = ` -Object { - "app": Object { - "import": Array [ - "index.js", +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`examples/node-api > when using the node api directly > should emit entrypoints.json 1`] = ` +{ + "main": { + "js": [ + "js/runtime.js", + "js/main.js", ], }, } `; -exports[`node-api snapshots .budfiles/bud.webpack.config.js 2`] = `"production"`; +exports[`examples/node-api > when using the node api directly > should emit main.js 1`] = `""use strict";(self.webpackChunk_roots_bud=self.webpackChunk_roots_bud||[]).push([[792],{"./index.js":()=>{console.log("hello"),console.log("world")}},o=>{var s;s="./index.js",o(o.s=s)}]);"`; -exports[`node-api snapshots .budfiles/bud.webpack.config.js 3`] = ` -Object { - "minimize": true, - "minimizer": Array [ - "...", - Object { - "options": Object { - "minify": "<>", - "minimizerOptions": Object { - "preset": Array [ - "default", - Object { - "discardComments": Object { - "removeAll": true, - }, - }, - ], - }, - "parallel": true, - "test": /\\\\\\.css\\(\\\\\\?\\.\\*\\)\\?\\$/i, - "warningsFilter": "<>", - }, - }, - ], - "moduleIds": "deterministic", - "splitChunks": Object { - "cacheGroups": Object { - "bud": Object { - "chunks": "all", - "name": "<>", - "priority": -10, - "reuseExistingChunk": true, - "test": /\\(\\[\\\\\\\\/\\]@roots\\|webpack\\|style-loader\\|tslib\\|ansi\\|html-entities\\|css-loader\\)/, - }, - "vendor": Object { - "chunks": "all", - "name": "<>", - "priority": -20, - "reuseExistingChunk": true, - "test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]/, - }, - }, - "defaultSizeTypes": Array [ - "...", - ], - }, +exports[`examples/node-api > when using the node api directly > should emit manifest.json 1`] = ` +{ + "entrypoints.json": "entrypoints.json", + "main.js": "js/main.js", + "runtime.js": "js/runtime.js", } `; -exports[`node-api snapshots .budfiles/bud.webpack.config.js 4`] = `true`; +exports[`examples/node-api > when using the node api directly > should emit runtime.js 1`] = `"(()=>{"use strict";var r,e={},o={};function t(r){var n=o[r];if(void 0!==n)return n.exports;var s=o[r]={exports:{}};return e[r](s,s.exports,t),s.exports}t.m=e,r=[],t.O=(e,o,n,s)=>{if(!o){var a=1/0;for(u=0;u=s)&&Object.keys(t.O).every((r=>t.O[r](o[f])))?o.splice(f--,1):(i=!1,s0&&r[u-1][2]>s;u--)r[u]=r[u-1];r[u]=[o,n,s]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={121:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var n,s,[a,i,f]=o,l=0;if(a.some((e=>0!==r[e]))){for(n in i)t.o(i,n)&&(t.m[n]=i[n]);if(f)var u=f(t)}for(e&&e(o);l when using the webpack cli > should emit entrypoints.json 1`] = ` +{ + "main": { + "js": [ + "js/runtime.js", + "js/main.js", + ], + }, } `; -exports[`node-api snapshots dist/app.js 1`] = `"console.log(\\"hello\\"),console.log(\\"world\\");"`; +exports[`examples/node-api > when using the webpack cli > should emit main.js 1`] = `""use strict";(self.webpackChunk_roots_bud=self.webpackChunk_roots_bud||[]).push([[792],{"./index.js":()=>{console.log("hello"),console.log("world")}},o=>{var s;s="./index.js",o(o.s=s)}]);"`; -exports[`node-api snapshots dist/manifest.json 1`] = ` -"{ - \\"app.js\\": \\"app.js\\" -}" -`; - -exports[`node-api snapshots package.json 1`] = ` -"{ - \\"name\\": \\"example-node-api\\", - \\"private\\": true, - \\"browserslist\\": { - \\"production\\": [ - \\">0.5%\\", - \\"not dead\\", - \\"not op_mini all\\" - ], - \\"development\\": [ - \\"last 1 chrome version\\", - \\"last 1 firefox version\\", - \\"last 1 safari version\\" - ] - }, - \\"devDependencies\\": { - \\"@roots/bud\\": \\"workspace:sources/@roots/bud\\" - } +exports[`examples/node-api > when using the webpack cli > should emit manifest.json 1`] = ` +{ + "entrypoints.json": "entrypoints.json", + "index.html": "index.html", + "main.js": "js/main.js", + "runtime.js": "js/runtime.js", } -" `; + +exports[`examples/node-api > when using the webpack cli > should emit runtime.js 1`] = `"(()=>{"use strict";var r,e={},o={};function t(r){var n=o[r];if(void 0!==n)return n.exports;var s=o[r]={exports:{}};return e[r](s,s.exports,t),s.exports}t.m=e,r=[],t.O=(e,o,n,s)=>{if(!o){var a=1/0;for(u=0;u=s)&&Object.keys(t.O).every((r=>t.O[r](o[f])))?o.splice(f--,1):(i=!1,s0&&r[u-1][2]>s;u--)r[u]=r[u-1];r[u]=[o,n,s]},t.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={121:0};t.O.j=e=>0===r[e];var e=(e,o)=>{var n,s,[a,i,f]=o,l=0;if(a.some((e=>0!==r[e]))){for(n in i)t.o(i,n)&&(t.m[n]=i[n]);if(f)var u=f(t)}for(e&&e(o);l { diff --git a/tests/integration/babel.test.ts b/tests/integration/babel.test.ts index cee87bf236..1e588f2708 100644 --- a/tests/integration/babel.test.ts +++ b/tests/integration/babel.test.ts @@ -1,5 +1,4 @@ import setup from '@repo/test-kit/setup' -import {testIsCompiledCss, testIsCompiledJs} from '@repo/test-kit/tests' import {beforeAll, describe, expect, it} from 'vitest' describe(`examples/babel`, () => { @@ -11,12 +10,11 @@ describe(`examples/babel`, () => { }) it(`should emit stdout`, async () => { - expect( - (await test.read(`build.stdout.log`)) - .split(`\n`) - .slice(2, -3) - .join(`\n`), - ).toMatchSnapshot() + const stdout = await test.read(`build.stdout.log`) + + expect(stdout).toMatch(/│ ◉ js\/runtime\.js\s*✔ 904 bytes/) + expect(stdout).toMatch(/│ ◉ css\/main\.css\s*✔ 231 bytes/) + expect(stdout).toMatch(/│ ◉ js\/main\.js\s*✔ 231 bytes/) }) it(`should not emit stderr`, async () => { @@ -31,9 +29,15 @@ describe(`examples/babel`, () => { expect(test.entrypoints).toMatchSnapshot() }) - it(`should compile js as expected`, async () => { - testIsCompiledJs(test.getAsset(`main.js`)) - testIsCompiledJs(test.getAsset(`runtime.js`)) - testIsCompiledCss(test.getAsset(`main.css`)) + it(`should emit main.js`, async () => { + expect(test.getAsset(`main.js`)).toMatchSnapshot() + }) + + it(`should emit runtime.js`, async () => { + expect(test.getAsset(`runtime.js`)).toMatchSnapshot() + }) + + it(`should emit main.css`, async () => { + expect(test.getAsset(`main.css`)).toMatchSnapshot() }) }) diff --git a/tests/integration/basic.test.ts b/tests/integration/basic.test.ts index 44b828ac62..0891352933 100644 --- a/tests/integration/basic.test.ts +++ b/tests/integration/basic.test.ts @@ -11,12 +11,11 @@ describe(`examples/basic`, () => { }) it(`should emit stdout`, async () => { - expect( - (await test.read(`build.stdout.log`)) - .split(`\n`) - .slice(2, -3) - .join(`\n`), - ).toMatchSnapshot() + const stdout = await test.read(`build.stdout.log`) + + expect(stdout).toMatch(/│ ◉ js\/runtime\.js\s*✔ 904 bytes/) + expect(stdout).toMatch(/│ ◉ css\/main\.css\s*✔ 27 bytes/) + expect(stdout).toMatch(/│ ◉ js\/main\.js\s*✔ 200 bytes/) }) it(`should not emit stderr`, async () => { @@ -31,9 +30,15 @@ describe(`examples/basic`, () => { expect(test.entrypoints).toMatchSnapshot() }) - it(`should compile js as expected`, async () => { - testIsCompiledJs(test.getAsset(`main.js`)) - testIsCompiledJs(test.getAsset(`runtime.js`)) - testIsCompiledCss(test.getAsset(`main.css`)) + it(`should emit main.js`, async () => { + expect(test.getAsset(`main.js`)).toMatchSnapshot() + }) + + it(`should emit runtime.js`, async () => { + expect(test.getAsset(`runtime.js`)).toMatchSnapshot() + }) + + it(`should emit main.css`, async () => { + expect(test.getAsset(`main.css`)).toMatchSnapshot() }) }) diff --git a/tests/integration/critical-css.test.ts b/tests/integration/critical-css.test.ts index 7859bc794b..997373d860 100644 --- a/tests/integration/critical-css.test.ts +++ b/tests/integration/critical-css.test.ts @@ -10,12 +10,15 @@ describe(`examples/critical-css`, {retry: 2, timeout: 240000}, () => { }) it(`should emit stdout`, async () => { - expect( - (await test.read(`build.stdout.log`)) - .split(`\n`) - .slice(2, -3) - .join(`\n`), - ).toMatchSnapshot() + const stdout = await test.read(`build.stdout.log`) + + expect(stdout).toMatch(/│ app\n│ ◉ js\/runtime\.js\s*✔ 904 bytes/) + expect(stdout).toMatch(/│ ◉ css\/app\.css\s*✔ 2.78 kB/) + + expect(stdout).toMatch(/│ app2\n│ ◉ js\/runtime\.js\s*✔ 904 bytes/) + expect(stdout).toMatch(/│ ◉ css\/app2\.css\s*✔ 2.75 kB/) + + expect(stdout).toMatch(/│ assets\n│ ◉ index\.html\s*307 bytes/) }) it(`should not emit stderr`, async () => { diff --git a/tests/integration/node-api.test.ts b/tests/integration/node-api.test.ts index 2618af5c2c..0d389eacbb 100644 --- a/tests/integration/node-api.test.ts +++ b/tests/integration/node-api.test.ts @@ -1,52 +1,64 @@ -import {join} from 'path' - -import {path} from '@repo/constants' -import {execa} from 'execa' -import fs from 'fs-jetpack' +import setup from '@repo/test-kit/setup' import {beforeAll, describe, expect, it} from 'vitest' -const exampleProjectDir = path(`examples/node-api`) -const tmpProjectDir = path(`storage/fixtures/node-api`) - -describe.skip(`node-api`, () => { - beforeAll(async () => { - try { - await fs.remove(tmpProjectDir) - await fs.copy(exampleProjectDir, tmpProjectDir) - await execa( - `yarn`, - [`install`, `--registry=http://localhost:4873`], - { - cwd: tmpProjectDir, - }, - ) - await execa(`node`, [`node_modules/.bin/webpack`], { - cwd: tmpProjectDir, - }) - } catch (error) { - throw error - } - }) +describe(`examples/node-api`, () => { + describe(`when using the node api directly`, async () => { + let test = setup({ + buildCommand: [`node`, [`node-script.js`]], + dist: `dist/build-a`, + integrationBuildCommand: [`node`, [`node-script.js`]], + label: `@examples/node-api`, + }) - it(`package.json`, async () => { - const artifact = ( - await fs.readAsync(join(tmpProjectDir, `package.json`)) - )?.toString() + beforeAll(async () => { + await test.install() + await test.build() + }) - expect(artifact).toMatchSnapshot() - }) + it(`should emit manifest.json`, async () => { + expect(test.manifest).toMatchSnapshot() + }) + + it(`should emit entrypoints.json`, async () => { + expect(test.entrypoints).toMatchSnapshot() + }) + + it(`should emit runtime.js`, async () => { + expect(test.getAsset(`runtime.js`)).toMatchSnapshot() + }) - it(`dist/manifest.json`, async () => { - const artifact = await fs.readAsync( - join(tmpProjectDir, `dist/manifest.json`), - ) - expect(artifact?.toString()).toMatchSnapshot() + it(`should emit main.js`, async () => { + expect(test.getAsset(`main.js`)).toMatchSnapshot() + }) }) - it(`dist/app.js`, async () => { - const artifact = await fs.readAsync( - join(tmpProjectDir, `dist/js/app.js`), - ) - expect(artifact?.toString()).toMatchSnapshot() + describe(`when using the webpack cli`, async () => { + let test = setup({ + buildCommand: [`yarn`, [`webpack`, `build`]], + dist: `dist/build-b`, + integrationBuildCommand: [`npx`, [`webpack`, `build`]], + label: `@examples/node-api`, + }) + + beforeAll(async () => { + await test.install() + await test.build() + }) + + it(`should emit manifest.json`, async () => { + expect(test.manifest).toMatchSnapshot() + }) + + it(`should emit entrypoints.json`, async () => { + expect(test.entrypoints).toMatchSnapshot() + }) + + it(`should emit runtime.js`, async () => { + expect(test.getAsset(`runtime.js`)).toMatchSnapshot() + }) + + it(`should emit main.js`, async () => { + expect(test.getAsset(`main.js`)).toMatchSnapshot() + }) }) -}, 240000) +}) diff --git a/tests/integration/webpack-plugin.test.ts b/tests/integration/webpack-plugin.test.ts index 64db6b8961..a0f0dcab23 100644 --- a/tests/integration/webpack-plugin.test.ts +++ b/tests/integration/webpack-plugin.test.ts @@ -5,7 +5,21 @@ import {describe, expect, it} from 'vitest' describe(`examples/webpack-plugin`, () => { it(`should compile assets as expected`, async () => { const test = setup({ - buildCommand: [`npx`, [`bud`, `build`, `--debug`, `--force`]], + buildCommand: [ + `yarn`, + [ + `bud`, + `--basedir`, + `examples/webpack-plugin`, + `build`, + `--debug`, + `--force`, + ], + ], + integrationBuildCommand: [ + `npx`, + [`bud`, `build`, `--debug`, `--force`], + ], label: `@examples/webpack-plugin`, }) @@ -39,11 +53,8 @@ describe(`examples/webpack-plugin`, () => { await fs.read(test.getPath(`.storage`, `inline-plugin-output`)), ).toEqual(`inline-plugin-test-success`) - expect(await fs.read(test.getPath(`build.stdout.log`))) - .toMatch(`\ -WebpackPlugin applied! -inline-plugin applied! -array-plugin-1 applied! -array-plugin-2 applied!`) + expect(await fs.read(test.getPath(`build.stdout.log`))).toMatch( + /WebpackPlugin applied!\ninline-plugin applied!\narray-plugin-1 applied!\narray-plugin-2 applied!/, + ) }) }) diff --git a/yarn.lock b/yarn.lock index e8ed5165cd..052d156b8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8535,6 +8535,7 @@ __metadata: "@roots/bud-swc": "workspace:*" webpack: "npm:5.91.0" webpack-cli: "npm:5.1.4" + webpack-dev-server: "npm:5.0.4" languageName: unknown linkType: soft @@ -8732,7 +8733,9 @@ __metadata: "@roots/bud": "workspace:*" "@roots/bud-babel": "workspace:*" "@roots/bud-typescript": "workspace:*" + "@types/node": "npm:20.14.2" ts-node: "npm:10.9.2" + typescript: "npm:5.4.5" languageName: unknown linkType: soft @@ -13829,6 +13832,15 @@ __metadata: languageName: node linkType: hard +"@types/bonjour@npm:^3.5.13": + version: 3.5.13 + resolution: "@types/bonjour@npm:3.5.13" + dependencies: + "@types/node": "npm:*" + checksum: eebedbca185ac3c39dd5992ef18d9e2a9f99e7f3c2f52f5561f90e9ed482c5d224c7962db95362712f580ed5713264e777a98d8f0bd8747f4eadf62937baed16 + languageName: node + linkType: hard + "@types/bonjour@npm:^3.5.9": version: 3.5.10 resolution: "@types/bonjour@npm:3.5.10" @@ -13867,6 +13879,16 @@ __metadata: languageName: node linkType: hard +"@types/connect-history-api-fallback@npm:^1.5.4": + version: 1.5.4 + resolution: "@types/connect-history-api-fallback@npm:1.5.4" + dependencies: + "@types/express-serve-static-core": "npm:*" + "@types/node": "npm:*" + checksum: 1b4035b627dcd714b05a22557f942e24a57ca48e7377dde0d2f86313fe685bc0a6566512a73257a55b5665b96c3041fb29228ac93331d8133011716215de8244 + languageName: node + linkType: hard + "@types/connect@npm:*": version: 3.4.35 resolution: "@types/connect@npm:3.4.35" @@ -14006,7 +14028,7 @@ __metadata: languageName: node linkType: hard -"@types/express@npm:4.17.21": +"@types/express@npm:4.17.21, @types/express@npm:^4.17.21": version: 4.17.21 resolution: "@types/express@npm:4.17.21" dependencies: @@ -14106,6 +14128,13 @@ __metadata: languageName: node linkType: hard +"@types/http-errors@npm:*": + version: 2.0.4 + resolution: "@types/http-errors@npm:2.0.4" + checksum: 494670a57ad4062fee6c575047ad5782506dd35a6b9ed3894cea65830a94367bd84ba302eb3dde331871f6d70ca287bfedb1b2cf658e6132cd2cbd427ab56836 + languageName: node + linkType: hard + "@types/http-proxy@npm:^1.17.10, @types/http-proxy@npm:^1.17.8": version: 1.17.10 resolution: "@types/http-proxy@npm:1.17.10" @@ -14342,6 +14371,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:20.14.2": + version: 20.14.2 + resolution: "@types/node@npm:20.14.2" + dependencies: + undici-types: "npm:~5.26.4" + checksum: 2d86e5f2227aaa42212e82ea0affe72799111b888ff900916376450b02b09b963ca888b20d9c332d8d2b833ed4781987867a38eaa2e4863fa8439071468b0a6f + languageName: node + linkType: hard + "@types/node@npm:^17.0.5": version: 17.0.27 resolution: "@types/node@npm:17.0.27" @@ -14538,6 +14576,13 @@ __metadata: languageName: node linkType: hard +"@types/retry@npm:0.12.2": + version: 0.12.2 + resolution: "@types/retry@npm:0.12.2" + checksum: 07481551a988cc90b423351919928b9ddcd14e3f5591cac3ab950851bb20646e55a10e89141b38bc3093d2056d4df73700b22ff2612976ac86a6367862381884 + languageName: node + linkType: hard + "@types/safe-json-stringify@npm:1.1.5": version: 1.1.5 resolution: "@types/safe-json-stringify@npm:1.1.5" @@ -14606,6 +14651,15 @@ __metadata: languageName: node linkType: hard +"@types/serve-index@npm:^1.9.4": + version: 1.9.4 + resolution: "@types/serve-index@npm:1.9.4" + dependencies: + "@types/express": "npm:*" + checksum: 94c1b9e8f1ea36a229e098e1643d5665d9371f8c2658521718e259130a237c447059b903bac0dcc96ee2c15fd63f49aa647099b7d0d437a67a6946527a837438 + languageName: node + linkType: hard + "@types/serve-static@npm:*, @types/serve-static@npm:^1.13.10": version: 1.13.10 resolution: "@types/serve-static@npm:1.13.10" @@ -14616,6 +14670,17 @@ __metadata: languageName: node linkType: hard +"@types/serve-static@npm:^1.15.5": + version: 1.15.7 + resolution: "@types/serve-static@npm:1.15.7" + dependencies: + "@types/http-errors": "npm:*" + "@types/node": "npm:*" + "@types/send": "npm:*" + checksum: 26ec864d3a626ea627f8b09c122b623499d2221bbf2f470127f4c9ebfe92bd8a6bb5157001372d4c4bd0dd37a1691620217d9dc4df5aa8f779f3fd996b1c60ae + languageName: node + linkType: hard + "@types/signale@npm:1.4.7": version: 1.4.7 resolution: "@types/signale@npm:1.4.7" @@ -14634,6 +14699,15 @@ __metadata: languageName: node linkType: hard +"@types/sockjs@npm:^0.3.36": + version: 0.3.36 + resolution: "@types/sockjs@npm:0.3.36" + dependencies: + "@types/node": "npm:*" + checksum: b20b7820ee813f22de4f2ce98bdd12c68c930e016a8912b1ed967595ac0d8a4cbbff44f4d486dd97f77f5927e7b5725bdac7472c9ec5b27f53a5a13179f0612f + languageName: node + linkType: hard + "@types/source-list-map@npm:*": version: 0.1.2 resolution: "@types/source-list-map@npm:0.1.2" @@ -14786,7 +14860,7 @@ __metadata: languageName: node linkType: hard -"@types/ws@npm:^8.5.5": +"@types/ws@npm:^8.5.10, @types/ws@npm:^8.5.5": version: 8.5.10 resolution: "@types/ws@npm:8.5.10" dependencies: @@ -19587,6 +19661,16 @@ __metadata: languageName: node linkType: hard +"bonjour-service@npm:^1.2.1": + version: 1.2.1 + resolution: "bonjour-service@npm:1.2.1" + dependencies: + fast-deep-equal: "npm:^3.1.3" + multicast-dns: "npm:^7.2.5" + checksum: 953cbfc27fc9e36e6f988012993ab2244817d82426603e0390d4715639031396c932b6657b1aa4ec30dbb5fa903d6b2c7f1be3af7a8ba24165c93e987c849730 + languageName: node + linkType: hard + "boolbase@npm:^1.0.0": version: 1.0.0 resolution: "boolbase@npm:1.0.0" @@ -19905,6 +19989,15 @@ __metadata: languageName: node linkType: hard +"bundle-name@npm:^4.1.0": + version: 4.1.0 + resolution: "bundle-name@npm:4.1.0" + dependencies: + run-applescript: "npm:^7.0.0" + checksum: 8e575981e79c2bcf14d8b1c027a3775c095d362d1382312f444a7c861b0e21513c0bd8db5bd2b16e50ba0709fa622d4eab6b53192d222120305e68359daece29 + languageName: node + linkType: hard + "byline@npm:^5.0.0": version: 5.0.0 resolution: "byline@npm:5.0.0" @@ -22483,6 +22576,13 @@ __metadata: languageName: node linkType: hard +"default-browser-id@npm:^5.0.0": + version: 5.0.0 + resolution: "default-browser-id@npm:5.0.0" + checksum: 957fb886502594c8e645e812dfe93dba30ed82e8460d20ce39c53c5b0f3e2afb6ceaec2249083b90bdfbb4cb0f34e1f73fde3d68cac00becdbcfd894156b5ead + languageName: node + linkType: hard + "default-browser@npm:^4.0.0": version: 4.0.0 resolution: "default-browser@npm:4.0.0" @@ -22495,6 +22595,16 @@ __metadata: languageName: node linkType: hard +"default-browser@npm:^5.2.1": + version: 5.2.1 + resolution: "default-browser@npm:5.2.1" + dependencies: + bundle-name: "npm:^4.1.0" + default-browser-id: "npm:^5.0.0" + checksum: 73f17dc3c58026c55bb5538749597db31f9561c0193cd98604144b704a981c95a466f8ecc3c2db63d8bfd04fb0d426904834cfc91ae510c6aeb97e13c5167c4d + languageName: node + linkType: hard + "default-gateway@npm:^6.0.3": version: 6.0.3 resolution: "default-gateway@npm:6.0.3" @@ -26629,6 +26739,21 @@ __metadata: languageName: node linkType: hard +"glob@npm:^10.3.7": + version: 10.4.1 + resolution: "glob@npm:10.4.1" + dependencies: + foreground-child: "npm:^3.1.0" + jackspeak: "npm:^3.1.2" + minimatch: "npm:^9.0.4" + minipass: "npm:^7.1.2" + path-scurry: "npm:^1.11.1" + bin: + glob: dist/esm/bin.mjs + checksum: 77f2900ed98b9cc2a0e1901ee5e476d664dae3cd0f1b662b8bfd4ccf00d0edc31a11595807706a274ca10e1e251411bbf2e8e976c82bed0d879a9b89343ed379 + languageName: node + linkType: hard + "glob@npm:^6.0.1": version: 6.0.4 resolution: "glob@npm:6.0.4" @@ -27638,6 +27763,13 @@ __metadata: languageName: node linkType: hard +"html-entities@npm:^2.4.0": + version: 2.5.2 + resolution: "html-entities@npm:2.5.2" + checksum: f20ffb4326606245c439c231de40a7c560607f639bf40ffbfb36b4c70729fd95d7964209045f1a4e62fe17f2364cef3d6e49b02ea09016f207fde51c2211e481 + languageName: node + linkType: hard + "html-escaper@npm:^2.0.0, html-escaper@npm:^2.0.2": version: 2.0.2 resolution: "html-escaper@npm:2.0.2" @@ -28533,6 +28665,13 @@ __metadata: languageName: node linkType: hard +"ipaddr.js@npm:^2.1.0": + version: 2.2.0 + resolution: "ipaddr.js@npm:2.2.0" + checksum: e4ee875dc1bd92ac9d27e06cfd87cdb63ca786ff9fd7718f1d4f7a8ef27db6e5d516128f52d2c560408cbb75796ac2f83ead669e73507c86282d45f84c5abbb6 + languageName: node + linkType: hard + "ipx@npm:2.1.0": version: 2.1.0 resolution: "ipx@npm:2.1.0" @@ -28998,6 +29137,13 @@ __metadata: languageName: node linkType: hard +"is-network-error@npm:^1.0.0": + version: 1.1.0 + resolution: "is-network-error@npm:1.1.0" + checksum: 89eef83c2a4cf43d853145ce175d1cf43183b7a58d48c7a03e7eed4eb395d0934c1f6d101255cdd8c8c2980ab529bfbe5dd9edb24e1c3c28d2b3c814469b5b7d + languageName: node + linkType: hard + "is-node-process@npm:^1.2.0": version: 1.2.0 resolution: "is-node-process@npm:1.2.0" @@ -29538,6 +29684,19 @@ __metadata: languageName: node linkType: hard +"jackspeak@npm:^3.1.2": + version: 3.4.0 + resolution: "jackspeak@npm:3.4.0" + dependencies: + "@isaacs/cliui": "npm:^8.0.2" + "@pkgjs/parseargs": "npm:^0.11.0" + dependenciesMeta: + "@pkgjs/parseargs": + optional: true + checksum: 7e42d1ea411b4d57d43ea8a6afbca9224382804359cb72626d0fc45bb8db1de5ad0248283c3db45fe73e77210750d4fcc7c2b4fe5d24fda94aaa24d658295c5f + languageName: node + linkType: hard + "jest-get-type@npm:^27.5.1": version: 27.5.1 resolution: "jest-get-type@npm:27.5.1" @@ -30140,7 +30299,7 @@ __metadata: languageName: node linkType: hard -"launch-editor@npm:^2.6.0": +"launch-editor@npm:^2.6.0, launch-editor@npm:^2.6.1": version: 2.6.1 resolution: "launch-editor@npm:2.6.1" dependencies: @@ -32320,6 +32479,13 @@ __metadata: languageName: node linkType: hard +"minipass@npm:^7.1.2": + version: 7.1.2 + resolution: "minipass@npm:7.1.2" + checksum: b0fd20bb9fb56e5fa9a8bfac539e8915ae07430a619e4b86ff71f5fc757ef3924b23b2c4230393af1eda647ed3d75739e4e0acb250a6b1eb277cf7f8fe449557 + languageName: node + linkType: hard + "minizlib@npm:^2.0.0, minizlib@npm:^2.1.1": version: 2.1.2 resolution: "minizlib@npm:2.1.2" @@ -32534,6 +32700,18 @@ __metadata: languageName: node linkType: hard +"multicast-dns@npm:^7.2.5": + version: 7.2.5 + resolution: "multicast-dns@npm:7.2.5" + dependencies: + dns-packet: "npm:^5.2.2" + thunky: "npm:^1.0.2" + bin: + multicast-dns: cli.js + checksum: 5120171d4bdb1577764c5afa96e413353bff530d1b37081cb29cccc747f989eb1baf40574fe8e27060fc1aef72b59c042f72b9b208413de33bcf411343c69057 + languageName: node + linkType: hard + "multiparty@npm:4.2.3": version: 4.2.3 resolution: "multiparty@npm:4.2.3" @@ -33669,6 +33847,18 @@ __metadata: languageName: node linkType: hard +"open@npm:^10.0.3": + version: 10.1.0 + resolution: "open@npm:10.1.0" + dependencies: + default-browser: "npm:^5.2.1" + define-lazy-prop: "npm:^3.0.0" + is-inside-container: "npm:^1.0.0" + is-wsl: "npm:^3.1.0" + checksum: c86d0b94503d5f735f674158d5c5d339c25ec2927562f00ee74590727292ed23e1b8d9336cb41ffa7e1fa4d3641d29b199b4ea37c78cb557d72b511743e90ebb + languageName: node + linkType: hard + "open@npm:^8.0.4, open@npm:^8.0.9, open@npm:^8.4.0": version: 8.4.0 resolution: "open@npm:8.4.0" @@ -34019,6 +34209,17 @@ __metadata: languageName: node linkType: hard +"p-retry@npm:^6.2.0": + version: 6.2.0 + resolution: "p-retry@npm:6.2.0" + dependencies: + "@types/retry": "npm:0.12.2" + is-network-error: "npm:^1.0.0" + retry: "npm:^0.13.1" + checksum: 3277f2a8450fb1429c29c432d24c5965b32f187228f1beea56f5d49209717588a7dc0415def1c653f60e0d15ed72c56dacaa2d5fdfa71b0f860592b0aa6ce823 + languageName: node + linkType: hard + "p-timeout@npm:^3.1.0": version: 3.2.0 resolution: "p-timeout@npm:3.2.0" @@ -34418,6 +34619,16 @@ __metadata: languageName: node linkType: hard +"path-scurry@npm:^1.11.1": + version: 1.11.1 + resolution: "path-scurry@npm:1.11.1" + dependencies: + lru-cache: "npm:^10.2.0" + minipass: "npm:^5.0.0 || ^6.0.2 || ^7.0.0" + checksum: 32a13711a2a505616ae1cc1b5076801e453e7aae6ac40ab55b388bb91b9d0547a52f5aaceff710ea400205f18691120d4431e520afbe4266b836fadede15872d + languageName: node + linkType: hard + "path-to-regexp@npm:0.1.7": version: 0.1.7 resolution: "path-to-regexp@npm:0.1.7" @@ -38011,6 +38222,17 @@ __metadata: languageName: node linkType: hard +"rimraf@npm:^5.0.5": + version: 5.0.7 + resolution: "rimraf@npm:5.0.7" + dependencies: + glob: "npm:^10.3.7" + bin: + rimraf: dist/esm/bin.mjs + checksum: bd6dbfaa98ae34ce1e54d1e06045d2d63e8859d9a1979bb4a4628b652b459a2d17b17dc20ee072b034bd2d09bd691e801d24c4d9cfe94e16fdbcc8470a1d4807 + languageName: node + linkType: hard + "rimraf@npm:~2.4.0": version: 2.4.5 resolution: "rimraf@npm:2.4.5" @@ -38109,6 +38331,13 @@ __metadata: languageName: node linkType: hard +"run-applescript@npm:^7.0.0": + version: 7.0.0 + resolution: "run-applescript@npm:7.0.0" + checksum: bd821bbf154b8e6c8ecffeaf0c33cebbb78eb2987476c3f6b420d67ab4c5301faa905dec99ded76ebb3a7042b4e440189ae6d85bbbd3fc6e8d493347ecda8bfe + languageName: node + linkType: hard + "run-async@npm:^2.2.0, run-async@npm:^2.4.0": version: 2.4.1 resolution: "run-async@npm:2.4.1" @@ -38433,7 +38662,7 @@ __metadata: languageName: node linkType: hard -"selfsigned@npm:^2.1.1": +"selfsigned@npm:^2.1.1, selfsigned@npm:^2.4.1": version: 2.4.1 resolution: "selfsigned@npm:2.4.1" dependencies: @@ -43195,7 +43424,7 @@ __metadata: languageName: node linkType: hard -"webpack-dev-middleware@npm:7.2.1": +"webpack-dev-middleware@npm:7.2.1, webpack-dev-middleware@npm:^7.1.0": version: 7.2.1 resolution: "webpack-dev-middleware@npm:7.2.1" dependencies: @@ -43229,6 +43458,53 @@ __metadata: languageName: node linkType: hard +"webpack-dev-server@npm:5.0.4": + version: 5.0.4 + resolution: "webpack-dev-server@npm:5.0.4" + dependencies: + "@types/bonjour": "npm:^3.5.13" + "@types/connect-history-api-fallback": "npm:^1.5.4" + "@types/express": "npm:^4.17.21" + "@types/serve-index": "npm:^1.9.4" + "@types/serve-static": "npm:^1.15.5" + "@types/sockjs": "npm:^0.3.36" + "@types/ws": "npm:^8.5.10" + ansi-html-community: "npm:^0.0.8" + bonjour-service: "npm:^1.2.1" + chokidar: "npm:^3.6.0" + colorette: "npm:^2.0.10" + compression: "npm:^1.7.4" + connect-history-api-fallback: "npm:^2.0.0" + default-gateway: "npm:^6.0.3" + express: "npm:^4.17.3" + graceful-fs: "npm:^4.2.6" + html-entities: "npm:^2.4.0" + http-proxy-middleware: "npm:^2.0.3" + ipaddr.js: "npm:^2.1.0" + launch-editor: "npm:^2.6.1" + open: "npm:^10.0.3" + p-retry: "npm:^6.2.0" + rimraf: "npm:^5.0.5" + schema-utils: "npm:^4.2.0" + selfsigned: "npm:^2.4.1" + serve-index: "npm:^1.9.1" + sockjs: "npm:^0.3.24" + spdy: "npm:^4.0.2" + webpack-dev-middleware: "npm:^7.1.0" + ws: "npm:^8.16.0" + peerDependencies: + webpack: ^5.0.0 + peerDependenciesMeta: + webpack: + optional: true + webpack-cli: + optional: true + bin: + webpack-dev-server: bin/webpack-dev-server.js + checksum: f3b5ffac798bdfdb7cc3d24000bde49816eab42fc6062641e6e61cd0057e8c268d495f8162fb97aeaee5e273c91457e90a99ba780526744ad2002e9e99e57036 + languageName: node + linkType: hard + "webpack-dev-server@npm:^4.15.1": version: 4.15.1 resolution: "webpack-dev-server@npm:4.15.1" @@ -43899,6 +44175,21 @@ __metadata: languageName: node linkType: hard +"ws@npm:^8.16.0": + version: 8.17.0 + resolution: "ws@npm:8.17.0" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ">=5.0.2" + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 55241ec93a66fdfc4bf4f8bc66c8eb038fda2c7a4ee8f6f157f2ca7dc7aa76aea0c0da0bf3adb2af390074a70a0e45456a2eaf80e581e630b75df10a64b0a990 + languageName: node + linkType: hard + "ws@npm:~7.4.0": version: 7.4.6 resolution: "ws@npm:7.4.6"