From 4bec47519dd562d6b5fb05548dac3cd52eb94ba9 Mon Sep 17 00:00:00 2001 From: Hung Luu Date: Fri, 26 Jan 2024 11:26:40 +0700 Subject: [PATCH 1/4] chore: use tsup builder --- package.json | 6 +- packages/builder/index.d.ts | 119 ---- packages/builder/package.json | 11 +- .../builder/src/cmd/init/updatePackageJson.ts | 4 +- packages/builder/tsconfig.build.json | 4 + packages/dts/index.d.ts | 48 -- packages/dts/package.json | 23 +- packages/dts/tsconfig.build.json | 4 + packages/logger/index.d.ts | 120 ---- packages/logger/package.json | 17 +- packages/logger/tsconfig.build.json | 4 + packages/paths/index.d.ts | 33 - packages/paths/package.json | 15 +- packages/paths/tsconfig.build.json | 4 + packages/resolve/index.d.ts | 63 -- packages/resolve/package.json | 22 +- packages/resolve/tsconfig.build.json | 4 + packages/tasks/index.d.ts | 86 --- packages/tasks/package.json | 16 +- packages/tasks/tsconfig.build.json | 4 + packages/webpack-dts/index.d.ts | 15 - packages/webpack-dts/tsconfig.build.json | 4 + pnpm-lock.yaml | 588 ++++++++++++++++-- tests/spec/config.js | 8 +- tests/spec/setup.js | 2 +- tsconfig.json | 27 +- tsup.config.ts | 181 ++++++ webpack.config.js | 64 +- 28 files changed, 876 insertions(+), 620 deletions(-) delete mode 100644 packages/builder/index.d.ts create mode 100644 packages/builder/tsconfig.build.json delete mode 100644 packages/dts/index.d.ts create mode 100644 packages/dts/tsconfig.build.json delete mode 100644 packages/logger/index.d.ts create mode 100644 packages/logger/tsconfig.build.json delete mode 100644 packages/paths/index.d.ts create mode 100644 packages/paths/tsconfig.build.json delete mode 100644 packages/resolve/index.d.ts create mode 100644 packages/resolve/tsconfig.build.json delete mode 100644 packages/tasks/index.d.ts create mode 100644 packages/tasks/tsconfig.build.json delete mode 100644 packages/webpack-dts/index.d.ts create mode 100644 packages/webpack-dts/tsconfig.build.json create mode 100644 tsup.config.ts diff --git a/package.json b/package.json index 9051679..b962069 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,15 @@ "name": "source", "private": true, "scripts": { - "start": "rimraf packages/resolve/index.js && webpack", - "build": "rimraf packages/resolve/index.js && webpack --node-env production", - "components": "webpack -c webpack.components.config.js", + "start": "tsup --watch", + "build": "tsup --env.NODE_ENV=production", "test": "jest -c tests/spec/config.js", "lint": "eslint packages --ext ts", "resolve": "pnpm --filter resolve", "builder": "pnpm --filter builder" }, "dependencies": { + "tsup": "^8.0.1", "@abxvn/webpack-dts": "workspace:^", "@changesets/cli": "^2.27.1", "typescript": "~5.0.4", diff --git a/packages/builder/index.d.ts b/packages/builder/index.d.ts deleted file mode 100644 index b1b75fc..0000000 --- a/packages/builder/index.d.ts +++ /dev/null @@ -1,119 +0,0 @@ -declare module '@abxvn/builder/cli/index' { - export type { IFilter, IBuilderCustomOptions } from '@abxvn/builder/src/interfaces'; -} -declare module '@abxvn/builder/src/interfaces' { - import type { Configuration, WebpackPluginInstance, WebpackOptionsNormalized, ExternalsPlugin } from 'webpack'; - export type IBuildEnvironment = 'development' | 'production'; - export type IBuildTarget = 'web' | 'node'; - export type IDevServerOptions = WebpackOptionsNormalized['devServer']; - export interface IDevServerCustomOption { - pattern: RegExp | string; - options: Partial; - } - export interface IReplacementOption { - pattern?: RegExp | string; - map: IImportReplacementMap; - } - export type IFileFilter = string | RegExp; - export interface IBuilderOptions { - envName: IBuildEnvironment; - rootPath: string; - entryPatterns: string[]; - replacements: IReplacementOption[]; - devs: IDevServerCustomOption[]; - ignores: IFileFilter[]; - } - export type IBuilderCustomOptions = Partial; - export interface IConfigCustomizer { - updateEntries: (entryFilter: IEntryFilter) => void; - updateOptions: (customOptions: IBuilderCustomOptions) => void; - filter: (filterName: string, filter: IFilter | null) => void; - } - export interface IConfigEditorParams { - envName: IBuildEnvironment; - rootPath: string; - filters?: Record; - deps?: IConfigDeps; - } - export interface IConfigEditor extends IConfigCustomizer { - readonly path: IPathResolver; - readonly configs: IWebpackConfigs; - readonly entries: ITargetedExpandedEntries; - readonly options: IBuilderOptions; - } - export type IEntryFilter = (targetEntries: ITargetedExpandedEntries) => Promise; - export interface IFilterOptions { - editor: IConfigEditor; - deps: IConfigDeps; - } - export interface IFilterOutput { - configs: IWebpackConfigs; - } - export type IFilter = (options: IFilterOptions) => Promise; - export interface IWebpackConfig extends Omit { - name: string; - entry: IEntries; - target: IBuildTarget; - plugins: WebpackPluginInstance[]; - devServer?: IDevServerOptions; - externals?: Exclude; - } - export type IWebpackConfigs = IWebpackConfig[]; - export type ITargetedExpandedEntries = Record; - export type IEntries = Record; - export interface IEntry { - import: string; - filename?: string; - dependOn?: string[]; - library?: { - name?: string; - type?: 'var' | 'assign' | 'this' | 'window' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'amd' | 'umd' | 'umd2' | 'jsonp' | 'system' | 'promise'; - export?: string[] | string; - }; - runtime?: string | (() => string); - } - export type IImportReplacementMap = Record; - export interface IDtsGeneratorModule { - importedModuleId: string; - currentModuleId: string; - isDeclaredExternalModule: boolean; - } - export interface IPathResolver { - rootPath: string; - resolve: (...paths: string[]) => string; - relative: (fullPath: string) => string; - includes: (fullPath: string) => boolean; - resolveList: (paths: string[]) => string[]; - dir: () => IPathResolver; - res: (...paths: string[]) => IPathResolver; - } - export type IDepVersion = string; - export interface IDep { - name: string; - version: IDepVersion; - dev?: boolean; - } - export interface IDepWithDeps extends IDep { - dependencies?: IDep[]; - } - export type IConfigDepsSetData = Partial>; - export interface IConfigDeps { - dependencies: string[]; - requires: (name: string) => boolean; - get: (name: string) => IDepWithDeps | undefined; - set: (name: string, data: IConfigDepsSetData) => IDepWithDeps; - unset: (name: string) => void; - } - export interface IApp { - readonly appName: string; - readonly appVersion: string; - } -} -declare module '@abxvn/builder/src/filters/replaceVars' { - import type { IFilter } from '@abxvn/builder/src/interfaces' - const replaceVars: IFilter; - export default replaceVars; -} -declare module '@abxvn/builder' { - export * from '@abxvn/builder/cli/index' -} diff --git a/packages/builder/package.json b/packages/builder/package.json index 929362a..bf38f96 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -3,9 +3,6 @@ "version": "1.1.1", "description": "Quick scaffolding code base to build web apps and games", "license": "MIT", - "main": "./cli/index.js", - "bin": "./cli/index.js", - "types": "index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/abxvn/source.git", @@ -54,12 +51,12 @@ "@types/webpack": "^5.28.0", "@types/webpack-node-externals": "^3.0.0" }, + "bin": "./dist/index.js", + "main": "./dist/cli/index.js", "files": [ - "cli/index.js", - "src/**/index.js", - "index.d.ts", "config", "README.md", - "LICENSE" + "LICENSE", + "dist" ] } diff --git a/packages/builder/src/cmd/init/updatePackageJson.ts b/packages/builder/src/cmd/init/updatePackageJson.ts index bf69df5..ef7ebae 100644 --- a/packages/builder/src/cmd/init/updatePackageJson.ts +++ b/packages/builder/src/cmd/init/updatePackageJson.ts @@ -26,7 +26,7 @@ export const updatePackageJson = async ({ modify = true, deps, editor, pm }: IUp if (useEslint) { info(`Essential config for linting command: - ${italic('"lint": "eslint packages --ext ts"')}`) + ${italic('"lint": "eslint packages --ext ts --ext tsx"')}`) } if (useJest) { @@ -56,7 +56,7 @@ export const updatePackageJson = async ({ modify = true, deps, editor, pm }: IUp if (useEslint) { logProgress('config script "lint"') - scripts.lint = 'eslint packages/**/*.{ts,tsx}' + scripts.lint = 'eslint packages --ext ts --ext tsx' } if (useJest) { logProgress('config script "test"') diff --git a/packages/builder/tsconfig.build.json b/packages/builder/tsconfig.build.json new file mode 100644 index 0000000..9807382 --- /dev/null +++ b/packages/builder/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["**/*.ts"] +} diff --git a/packages/dts/index.d.ts b/packages/dts/index.d.ts deleted file mode 100644 index 7a4ccd7..0000000 --- a/packages/dts/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -declare module '@abxvn/dts/lib/interfaces' { - import type { Node } from 'typescript'; - export interface IDtsFilters { - filePatterns?: string[]; - } - export interface IGenerateOptions { - name: string; - inputDir: string; - main?: string; - projectPath?: string; - outputPath?: string; - files?: string[]; - references?: string[]; - filePatterns?: string[]; - } - export interface IDtsWriterOptions { - name: string; - main?: string; - outputPath: string; - references?: string[]; - excludedPatterns?: string[]; - resolvedModule?: (resolution: IModuleResolution) => string; - resolvedImport?: (resolution: IModuleImportResolution) => string; - } - export interface IModuleResolution { - currentModule: string; - } - export interface IModuleImportResolution { - currentModule: string; - importedModule: string; - isExternal?: boolean; - } - export type IReplacer = (node: Node) => string | undefined; -} -declare module '@abxvn/dts/lib/Dts' { - /// - import EventEmitter from 'events'; - import type { IGenerateOptions } from '@abxvn/dts/lib/interfaces'; - export class Dts extends EventEmitter { - generate ({ name, main, inputDir, projectPath, outputPath, files, references, filePatterns, }: IGenerateOptions): Promise; - } -} -declare module '@abxvn/dts/index' { - export * from '@abxvn/dts/lib/Dts'; -} -declare module '@abxvn/dts' { - export * from '@abxvn/dts/index' -} diff --git a/packages/dts/package.json b/packages/dts/package.json index d74f91a..40df334 100644 --- a/packages/dts/package.json +++ b/packages/dts/package.json @@ -2,7 +2,6 @@ "name": "@abxvn/dts", "description": "Simple and fast typescript declaration (dts) file generator", "version": "1.0.1", - "types": "index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/abxvn/source.git", @@ -26,12 +25,6 @@ "url": "https://github.com/abxvn/source/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3Adts%22" }, "homepage": "https://github.com/abxvn/source/tree/main/packages/dts#readme", - "files": [ - "index.js", - "index.d.ts", - "README.md", - "LICENSE" - ], "dependencies": { "@abxvn/paths": "workspace:^", "fs-extra": "^11.1.1", @@ -40,5 +33,19 @@ }, "devDependencies": { "@types/fs-extra": "^11.0.1" - } + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js" + } + }, + "files": [ + "README.md", + "LICENSE", + "dist" + ] } diff --git a/packages/dts/tsconfig.build.json b/packages/dts/tsconfig.build.json new file mode 100644 index 0000000..9807382 --- /dev/null +++ b/packages/dts/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["**/*.ts"] +} diff --git a/packages/logger/index.d.ts b/packages/logger/index.d.ts deleted file mode 100644 index 559278a..0000000 --- a/packages/logger/index.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -declare module '@abxvn/logger/index' { - import type { IStyles, IUnstyler, ILoggers } from '@abxvn/logger/lib/styles/interfaces'; - export const unstyle: IUnstyler; - export const styles: IStyles; - export const loggers: ILoggers; -} -declare module '@abxvn/logger/lib/styles/interfaces' { - export const Modifiers: { - bold: string; - underline: string; - italic: string; - }; - export type IModifierName = keyof typeof Modifiers; - export type IModifier = typeof Modifiers[IModifierName]; - export interface IFormatState { - modified?: boolean; - bold: boolean; - italic: boolean; - underline: boolean; - bgColor: string; - color: string; - } - export type IFormatStateKey = keyof IFormatState; - export interface IStyledCssLog { - text: string; - css: string[]; - } - export interface IStyles { - (text: string): string; - bold: IStyles; - italic: IStyles; - underline: IStyles; - black: IStyles; - bgBlack: IStyles; - gray: IStyles; - bgGray: IStyles; - red: IStyles; - redBright: IStyles; - bgRed: IStyles; - bgRedBright: IStyles; - white: IStyles; - whiteBright: IStyles; - green: IStyles; - greenBright: IStyles; - yellow: IStyles; - yellowBright: IStyles; - blue: IStyles; - blueBright: IStyles; - cyan: IStyles; - cyanBright: IStyles; - magenta: IStyles; - magentaBright: IStyles; - bgGreen: IStyles; - bgGreenBright: IStyles; - bgYellow: IStyles; - bgYellowBright: IStyles; - bgBlue: IStyles; - bgBlueBright: IStyles; - bgCyan: IStyles; - bgCyanBright: IStyles; - bgMagenta: IStyles; - bgMagentaBright: IStyles; - } - export type ILogger = (...items: any[]) => void; - export type IUnstyler = (formattedText: string) => string; - export type ILogStyler = (formattedText: string) => IStyledCssLog; - export type ITextEffectColor = 'green' | 'greenBright' | 'yellow' | 'yellowBright' | 'blue' | 'blueBright' | 'cyan' | 'cyanBright' | 'magenta' | 'magentaBright'; - export type IBadgeEffectColor = 'bgGreen' | 'bgGreenBright' | 'bgYellow' | 'bgYellowBright' | 'bgBlue' | 'bgBlueBright' | 'bgCyan' | 'bgCyanBright' | 'bgMagenta' | 'bgMagentaBright'; - export interface ILoggers { - log: ILogger; - info: ILogger; - warn: ILogger; - progress: ILogger; - success: ILogger; - error: ILogger; - color: (message: string, textColor?: ITextEffectColor | number | 'red' | 'redBright' | 'gray' | 'black' | 'white' | 'whiteBright') => string; - badge: (label: string, bgColor?: ITextEffectColor | number | 'red' | 'redBright' | 'gray' | 'black', textColor?: ITextEffectColor | number | 'red' | 'redBright' | 'gray' | 'black' | 'white' | 'whiteBright') => string; - } -} -declare module '@abxvn/logger/lib/interfaces' { - /// - /// - import type { Writable } from 'stream'; - export type IWriteParams = [ - chunk: any, - encoding: BufferEncoding, - callback: (error?: Error | null) => void - ]; - export type IWrite = (chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void) => void; - export interface IWritable { - on: (...args: any[]) => void; - _write: IWrite; - } - export type IWatchCallback = (data: Buffer) => void; - export interface ICollapsible extends Writable { - expand: () => void; - collapse: (clean?: boolean) => void; - isCollapsible: boolean; - width: number; - count: number; - } -} -declare module '@abxvn/logger/cli' { - /// - /// - /// - /// - /// - import type { ICollapsible } from '@abxvn/logger/lib/interfaces'; - import type { ILoggers, IStyles, IUnstyler } from '@abxvn/logger/lib/styles/interfaces'; - export type { ICollapsible } from '@abxvn/logger/lib/interfaces'; - export const collapsible: (stream?: NodeJS.WriteStream, collectFromStream?: boolean) => ICollapsible; - export const collapse: ICollapsible; - export const unstyle: IUnstyler; - export const styles: IStyles; - export const loggers: ILoggers; -} -declare module '@abxvn/logger' { - export * from '@abxvn/logger/index' -} diff --git a/packages/logger/package.json b/packages/logger/package.json index 2c50ee9..68e83e0 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -3,8 +3,6 @@ "description": "Logger helpers and collapsible logs", "version": "2.0.1", "license": "MIT", - "main": "index.js", - "types": "index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/abxvn/source.git", @@ -29,11 +27,18 @@ "@types/node": "^20.1.3", "ansi-colors": "^4.1.3" }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js" + } + }, "files": [ - "index.js", - "index.d.ts", - "cli/index.js", "README.md", - "LICENSE" + "LICENSE", + "dist" ] } diff --git a/packages/logger/tsconfig.build.json b/packages/logger/tsconfig.build.json new file mode 100644 index 0000000..9807382 --- /dev/null +++ b/packages/logger/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["**/*.ts"] +} diff --git a/packages/paths/index.d.ts b/packages/paths/index.d.ts deleted file mode 100644 index a82aa14..0000000 --- a/packages/paths/index.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -declare module '@abxvn/paths/index' { - export interface IPathResolver { - rootPath: string; - resolve: (...paths: string[]) => string; - relative: (fullPath: string) => string; - includes: (fullPath: string) => boolean; - resolveList: (paths: string[]) => string[]; - dir: () => IPathResolver; - res: (...paths: string[]) => IPathResolver; - } - export class PathResolver implements IPathResolver { - readonly rootPath: string; - constructor (rootPath: string); - relative (fullPath: string): string; - relativeList (fullPaths: string[]): string[]; - includes (fullPath: string): boolean; - resolve (...paths: string[]): string; - resolveList (paths: string[]): string[]; - dir (): IPathResolver; - res (...paths: string[]): IPathResolver; - } - export const normalize: (path: string) => string; - export const getDir: (path: string) => string; - export const getName: (path: string) => string; - export const resolver: (rootPath: string) => IPathResolver; - export const resolve: (path: string) => string; - export const merge: (...paths: string[]) => string; - export const removeExt: (path: string) => string; - export const getLocalPackagePath: (relativePath: string) => string; -} -declare module '@abxvn/paths' { - export * from '@abxvn/paths/index' -} diff --git a/packages/paths/package.json b/packages/paths/package.json index 6a1208c..dd9e428 100644 --- a/packages/paths/package.json +++ b/packages/paths/package.json @@ -2,7 +2,6 @@ "name": "@abxvn/paths", "version": "1.0.1", "description": "A cross-platform path resolving utility", - "types": "index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/abxvn/source.git", @@ -21,10 +20,18 @@ "url": "https://github.com/abxvn/source/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3Apaths%22" }, "homepage": "https://github.com/abxvn/source/tree/main/packages/paths#readme", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js" + } + }, "files": [ - "index.js", - "index.d.ts", "README.md", - "LICENSE" + "LICENSE", + "dist" ] } diff --git a/packages/paths/tsconfig.build.json b/packages/paths/tsconfig.build.json new file mode 100644 index 0000000..9807382 --- /dev/null +++ b/packages/paths/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["**/*.ts"] +} diff --git a/packages/resolve/index.d.ts b/packages/resolve/index.d.ts deleted file mode 100644 index d6a0551..0000000 --- a/packages/resolve/index.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -declare module '@abxvn/resolve/src/lib/interfaces' { - export interface IModule { - exists: boolean; - query: string; - path: string; - main: string; - name: string; - version: string; - dependencies: string[]; - error?: Error; - } - export type IResolvedFileType = 'file' | 'directory' | null; - export interface IFsPathType { - path: string; - type: IResolvedFileType; - } - export interface IResolveOptions { - callerPath?: string; - moduleDirs?: string[]; - usePnpFallback?: boolean; - } - interface PnpResolveToUnqualifiedOptions { - considerBuiltins?: boolean; - } - interface PnpResolveUnqualifiedOptions { - extensions?: string[]; - conditions?: Set; - } - type PnpResolveRequestOptions = PnpResolveToUnqualifiedOptions & PnpResolveUnqualifiedOptions; - export interface PnpApi { - resolveRequest: (request: string, issuer: string | null, options?: PnpResolveRequestOptions) => string | null; - } - export type IMaybePromise = T | Promise; - export type IResolveTrace = Map; -} -declare module '@abxvn/resolve/src/resolveSync' { - import type { IResolveOptions } from '@abxvn/resolve/src/lib/interfaces'; - export const resolveSync: (path: string, options?: IResolveOptions) => string; -} -declare module '@abxvn/resolve/src/resolveModule' { - import type { IModule, IResolveOptions } from '@abxvn/resolve/src/lib/interfaces'; - export const resolveModule: (moduleOrDirPath: string, options?: IResolveOptions) => Promise; -} -declare module '@abxvn/resolve/src/resolve' { - import type { IResolveOptions } from '@abxvn/resolve/src/lib/interfaces'; - export const resolve: (path: string, options?: IResolveOptions) => Promise; -} -declare module '@abxvn/resolve/src/lib/pnp' { - import type { PnpApi } from '@abxvn/resolve/src/lib/interfaces'; - export const pnpApi: PnpApi | null; - export const isPnpEnabled: () => boolean; - export const resolvePnpPackage: PnpApi['resolveRequest']; -} -declare module '@abxvn/resolve/index' { - export { isPnpEnabled, pnpApi } from '@abxvn/resolve/src/lib/pnp'; - export { resolve } from '@abxvn/resolve/src/resolve'; - export { resolveModule } from '@abxvn/resolve/src/resolveModule'; - export { resolveSync } from '@abxvn/resolve/src/resolveSync'; - export type { IModule, IResolveOptions } from '@abxvn/resolve/src/lib/interfaces'; -} -declare module '@abxvn/resolve' { - export * from '@abxvn/resolve/index' -} diff --git a/packages/resolve/package.json b/packages/resolve/package.json index 2fc1df7..4c90b5c 100644 --- a/packages/resolve/package.json +++ b/packages/resolve/package.json @@ -3,9 +3,6 @@ "version": "2.0.1", "description": "Async resolve with pnp supports", "license": "MIT", - "main": "index.js", - "bin": "./cli/index.js", - "types": "index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/abxvn/source.git", @@ -38,11 +35,22 @@ "@types/jest": "^29.5.1", "@types/node": "^18.16.0" }, + "bin": "./dist/cli/index.js", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js" + }, + "./cli": { + "require": "./dist/cli/index.js" + } + }, "files": [ - "index.js", - "index.d.ts", - "cli/index.js", "README.md", - "LICENSE" + "LICENSE", + "dist" ] } diff --git a/packages/resolve/tsconfig.build.json b/packages/resolve/tsconfig.build.json new file mode 100644 index 0000000..9807382 --- /dev/null +++ b/packages/resolve/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["**/*.ts"] +} diff --git a/packages/tasks/index.d.ts b/packages/tasks/index.d.ts deleted file mode 100644 index 0fc5c93..0000000 --- a/packages/tasks/index.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -declare module '@abxvn/tasks/lib/storage/interfaces' { - export interface IHeapItem { - id: number; - sortId: number; - data?: TData; - } - export type IHeapPushParams = Omit, 'id'>; - export interface IHeap { - top: () => IHeapItem | undefined; - shift: () => IHeapItem | undefined; - push: (...items: Array>) => number; - compare: (itemA: IHeapItem, itemB: IHeapItem) => number; - } -} -declare module '@abxvn/tasks/lib/storage/MinHeap' { - import { type IHeapPushParams, type IHeap, type IHeapItem } from '@abxvn/tasks/lib/storage/interfaces'; - export class MinHeap extends Array> implements IHeap { - push (...items: Array>): number; - top (): IHeapItem; - shift (): IHeapItem; - compare (itemA: IHeapItem, itemB: IHeapItem): number; - } -} -declare module '@abxvn/tasks/lib/interfaces' { - import { type TaskPriority, type TaskStatus } from '@abxvn/tasks/lib/consts'; - export type ITaskPriority = typeof TaskPriority[keyof typeof TaskPriority]; - export type ITaskStatus = typeof TaskStatus[keyof typeof TaskStatus]; - export interface ITask { - status: ITaskStatus; - execute: ((context: TTaskContext) => Promise | any) | ((context: TTaskContext) => void); - context: TTaskContext; - id?: string; - priority?: TPriority; - } - export interface ITaskEmitterOptions { - concurrency: number; - onItemDone?: (item: TTask) => void; - onItemError?: (item: TTask, error: Error) => void; - } - export interface ITaskEmitter = ITask> { - readonly count: number; - readonly pendingCount: number; - add: (item: Omit) => void; - next: () => void; - } -} -declare module '@abxvn/tasks/lib/consts' { - export const TaskPriority: { - readonly INSTANT: 1; - readonly HIGH: 2; - readonly NORMAL: 3; - readonly LOW: 4; - readonly IDLE: 5; - }; - export const TaskStatus: { - readonly PENDING: 1; - readonly WORKING: 2; - readonly RETRYING: 3; - readonly DONE: 4; - readonly ERROR: 5; - }; - export const INSTANT_PRIORITY_TIMEOUT = -1; - export const HIGH_PRIORITY_TIMEOUT = 250; - export const NORMAL_PRIORITY_TIMEOUT = 5000; - export const LOW_PRIORITY_TIMEOUT = 10000; - export const IDLE_PRIORITY_TIMEOUT = 1073741823; -} -declare module '@abxvn/tasks/lib/TaskEmitter' { - import type { ITaskEmitter, ITask, ITaskPriority, ITaskEmitterOptions } from '@abxvn/tasks/lib/interfaces'; - import { MinHeap } from '@abxvn/tasks/lib/storage/MinHeap'; - export class TaskEmitter = ITask> implements ITaskEmitter { - constructor (options?: Partial>); - get pendingCount (): number; - get count (): number; - next (): void; - add (item: Omit): void; - } -} -declare module '@abxvn/tasks/index' { - export { TaskEmitter } from '@abxvn/tasks/lib/TaskEmitter'; - export * from '@abxvn/tasks/lib/consts'; - export type { ITask, ITaskPriority, ITaskEmitter, ITaskStatus } from '@abxvn/tasks/lib/interfaces'; -} -declare module '@abxvn/tasks' { - export * from '@abxvn/tasks/index' -} diff --git a/packages/tasks/package.json b/packages/tasks/package.json index c02697f..aec56cd 100644 --- a/packages/tasks/package.json +++ b/packages/tasks/package.json @@ -3,8 +3,6 @@ "version": "1.0.1", "description": "Light-weight and fast priority based task runner", "license": "MIT", - "main": "./index.js", - "types": "index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/abxvn/source.git", @@ -24,10 +22,18 @@ "url": "https://github.com/abxvn/source/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3Atasks%22" }, "homepage": "https://github.com/abxvn/source/tree/main/packages/tasks#readme", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js" + } + }, "files": [ - "cli/index.js", - "index.d.ts", "README.md", - "LICENSE" + "LICENSE", + "dist" ] } diff --git a/packages/tasks/tsconfig.build.json b/packages/tasks/tsconfig.build.json new file mode 100644 index 0000000..9807382 --- /dev/null +++ b/packages/tasks/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["**/*.ts"] +} diff --git a/packages/webpack-dts/index.d.ts b/packages/webpack-dts/index.d.ts deleted file mode 100644 index 3583b90..0000000 --- a/packages/webpack-dts/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -declare module '@abxvn/webpack-dts/lib/WebpackDtsPlugin' { - import type { Compiler } from 'webpack'; - import { type IPathResolver } from '@abxvn/paths'; - export class WebpackDtsPlugin { - readonly path: IPathResolver; - constructor (rootPath: string); - apply (compiler: Compiler): void; - } -} -declare module '@abxvn/webpack-dts/index' { - export { WebpackDtsPlugin } from '@abxvn/webpack-dts/lib/WebpackDtsPlugin'; -} -declare module '@abxvn/webpack-dts' { - export * from '@abxvn/webpack-dts/index' -} diff --git a/packages/webpack-dts/tsconfig.build.json b/packages/webpack-dts/tsconfig.build.json new file mode 100644 index 0000000..9807382 --- /dev/null +++ b/packages/webpack-dts/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["**/*.ts"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f0a6e1e..ba717f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,12 +14,15 @@ importers: '@changesets/cli': specifier: ^2.27.1 version: 2.27.1 + tsup: + specifier: ^8.0.1 + version: 8.0.1(typescript@5.0.4) typescript: specifier: ~5.0.4 version: 5.0.4 webpack: specifier: ^5.89.0 - version: 5.89.0(webpack-cli@5.1.4) + version: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) devDependencies: '@types/fs-extra': specifier: ^11.0.4 @@ -77,10 +80,10 @@ importers: version: 5.0.5 terser-webpack-plugin: specifier: ^5.3.9 - version: 5.3.9(webpack@5.89.0) + version: 5.3.9(esbuild@0.19.12)(webpack@5.89.0) ts-jest: specifier: ^29.1.1 - version: 29.1.1(@babel/core@7.23.6)(jest@29.7.0)(typescript@5.0.4) + version: 29.1.1(@babel/core@7.23.6)(esbuild@0.19.12)(jest@29.7.0)(typescript@5.0.4) ts-loader: specifier: ^9.5.1 version: 9.5.1(typescript@5.0.4)(webpack@5.89.0) @@ -146,7 +149,7 @@ importers: version: 5.0.4 webpack: specifier: ^5.76.3 - version: 5.89.0(webpack-cli@5.1.4) + version: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) webpack-dev-server: specifier: ^4.13.3 version: 4.15.1(bufferutil@4.0.8)(debug@2.6.9)(utf-8-validate@6.0.3)(webpack-cli@5.1.4)(webpack@5.89.0) @@ -165,10 +168,10 @@ importers: version: 6.0.3 '@types/webpack': specifier: ^5.28.0 - version: 5.28.5(webpack-cli@5.1.4) + version: 5.28.5(esbuild@0.19.12)(webpack-cli@5.1.4) '@types/webpack-node-externals': specifier: ^3.0.0 - version: 3.0.4(webpack-cli@5.1.4) + version: 3.0.4(esbuild@0.19.12)(webpack-cli@5.1.4) packages/dts: dependencies: @@ -247,7 +250,7 @@ importers: version: 11.0.4 '@types/webpack': specifier: ^5.28.1 - version: 5.28.5(webpack-cli@5.1.4) + version: 5.28.5(esbuild@0.19.12)(webpack-cli@5.1.4) packages: @@ -784,6 +787,190 @@ packages: resolution: {integrity: sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==} engines: {node: '>=10.0.0'} + /@esbuild/aix-ppc64@0.19.12: + resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + optional: true + + /@esbuild/android-arm64@0.19.12: + resolution: {integrity: sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + optional: true + + /@esbuild/android-arm@0.19.12: + resolution: {integrity: sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + optional: true + + /@esbuild/android-x64@0.19.12: + resolution: {integrity: sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + optional: true + + /@esbuild/darwin-arm64@0.19.12: + resolution: {integrity: sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + optional: true + + /@esbuild/darwin-x64@0.19.12: + resolution: {integrity: sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + optional: true + + /@esbuild/freebsd-arm64@0.19.12: + resolution: {integrity: sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + optional: true + + /@esbuild/freebsd-x64@0.19.12: + resolution: {integrity: sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + optional: true + + /@esbuild/linux-arm64@0.19.12: + resolution: {integrity: sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + optional: true + + /@esbuild/linux-arm@0.19.12: + resolution: {integrity: sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + optional: true + + /@esbuild/linux-ia32@0.19.12: + resolution: {integrity: sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + optional: true + + /@esbuild/linux-loong64@0.19.12: + resolution: {integrity: sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + optional: true + + /@esbuild/linux-mips64el@0.19.12: + resolution: {integrity: sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + optional: true + + /@esbuild/linux-ppc64@0.19.12: + resolution: {integrity: sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + optional: true + + /@esbuild/linux-riscv64@0.19.12: + resolution: {integrity: sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + optional: true + + /@esbuild/linux-s390x@0.19.12: + resolution: {integrity: sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + optional: true + + /@esbuild/linux-x64@0.19.12: + resolution: {integrity: sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + optional: true + + /@esbuild/netbsd-x64@0.19.12: + resolution: {integrity: sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + optional: true + + /@esbuild/openbsd-x64@0.19.12: + resolution: {integrity: sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + optional: true + + /@esbuild/sunos-x64@0.19.12: + resolution: {integrity: sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + optional: true + + /@esbuild/win32-arm64@0.19.12: + resolution: {integrity: sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + optional: true + + /@esbuild/win32-ia32@0.19.12: + resolution: {integrity: sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + optional: true + + /@esbuild/win32-x64@0.19.12: + resolution: {integrity: sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + optional: true + /@eslint-community/eslint-utils@4.4.0(eslint@8.56.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -859,7 +1046,6 @@ packages: strip-ansi-cjs: /strip-ansi@6.0.1 wrap-ansi: 8.1.0 wrap-ansi-cjs: /wrap-ansi@7.0.0 - dev: true /@istanbuljs/load-nyc-config@1.1.0: resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} @@ -1168,7 +1354,110 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} requiresBuild: true - dev: true + optional: true + + /@rollup/rollup-android-arm-eabi@4.9.6: + resolution: {integrity: sha512-MVNXSSYN6QXOulbHpLMKYi60ppyO13W9my1qogeiAqtjb2yR4LSmfU2+POvDkLzhjYLXz9Rf9+9a3zFHW1Lecg==} + cpu: [arm] + os: [android] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-android-arm64@4.9.6: + resolution: {integrity: sha512-T14aNLpqJ5wzKNf5jEDpv5zgyIqcpn1MlwCrUXLrwoADr2RkWA0vOWP4XxbO9aiO3dvMCQICZdKeDrFl7UMClw==} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-darwin-arm64@4.9.6: + resolution: {integrity: sha512-CqNNAyhRkTbo8VVZ5R85X73H3R5NX9ONnKbXuHisGWC0qRbTTxnF1U4V9NafzJbgGM0sHZpdO83pLPzq8uOZFw==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-darwin-x64@4.9.6: + resolution: {integrity: sha512-zRDtdJuRvA1dc9Mp6BWYqAsU5oeLixdfUvkTHuiYOHwqYuQ4YgSmi6+/lPvSsqc/I0Omw3DdICx4Tfacdzmhog==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-linux-arm-gnueabihf@4.9.6: + resolution: {integrity: sha512-oNk8YXDDnNyG4qlNb6is1ojTOGL/tRhbbKeE/YuccItzerEZT68Z9gHrY3ROh7axDc974+zYAPxK5SH0j/G+QQ==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-linux-arm64-gnu@4.9.6: + resolution: {integrity: sha512-Z3O60yxPtuCYobrtzjo0wlmvDdx2qZfeAWTyfOjEDqd08kthDKexLpV97KfAeUXPosENKd8uyJMRDfFMxcYkDQ==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-linux-arm64-musl@4.9.6: + resolution: {integrity: sha512-gpiG0qQJNdYEVad+1iAsGAbgAnZ8j07FapmnIAQgODKcOTjLEWM9sRb+MbQyVsYCnA0Im6M6QIq6ax7liws6eQ==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-linux-riscv64-gnu@4.9.6: + resolution: {integrity: sha512-+uCOcvVmFUYvVDr27aiyun9WgZk0tXe7ThuzoUTAukZJOwS5MrGbmSlNOhx1j80GdpqbOty05XqSl5w4dQvcOA==} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-linux-x64-gnu@4.9.6: + resolution: {integrity: sha512-HUNqM32dGzfBKuaDUBqFB7tP6VMN74eLZ33Q9Y1TBqRDn+qDonkAUyKWwF9BR9unV7QUzffLnz9GrnKvMqC/fw==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-linux-x64-musl@4.9.6: + resolution: {integrity: sha512-ch7M+9Tr5R4FK40FHQk8VnML0Szi2KRujUgHXd/HjuH9ifH72GUmw6lStZBo3c3GB82vHa0ZoUfjfcM7JiiMrQ==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-win32-arm64-msvc@4.9.6: + resolution: {integrity: sha512-VD6qnR99dhmTQ1mJhIzXsRcTBvTjbfbGGwKAHcu+52cVl15AC/kplkhxzW/uT0Xl62Y/meBKDZvoJSJN+vTeGA==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-win32-ia32-msvc@4.9.6: + resolution: {integrity: sha512-J9AFDq/xiRI58eR2NIDfyVmTYGyIZmRcvcAoJ48oDld/NTR8wyiPUu2X/v1navJ+N/FGg68LEbX3Ejd6l8B7MQ==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: false + optional: true + + /@rollup/rollup-win32-x64-msvc@4.9.6: + resolution: {integrity: sha512-jqzNLhNDvIZOrt69Ce4UjGRpXJBzhUBzawMwnaDAwyHriki3XollsewxWzOzz+4yOFDkuJHtTsZFwMxhYJWmLQ==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: false optional: true /@sinclair/typebox@0.27.8: @@ -1440,11 +1729,11 @@ packages: '@types/node': 20.10.5 dev: true - /@types/webpack-node-externals@3.0.4(webpack-cli@5.1.4): + /@types/webpack-node-externals@3.0.4(esbuild@0.19.12)(webpack-cli@5.1.4): resolution: {integrity: sha512-8Z3/edqxE3RRlOJwKSgOFxLZRt/i1qFlv/Bi308ZUKo9jh8oGngd9r8GR0ZNKW5AEJq8QNQE3b17CwghTjQ0Uw==} dependencies: '@types/node': 20.10.5 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) transitivePeerDependencies: - '@swc/core' - esbuild @@ -1452,12 +1741,12 @@ packages: - webpack-cli dev: true - /@types/webpack@5.28.5(webpack-cli@5.1.4): + /@types/webpack@5.28.5(esbuild@0.19.12)(webpack-cli@5.1.4): resolution: {integrity: sha512-wR87cgvxj3p6D0Crt1r5avwqffqPXUkNlnQ1mjU93G7gCuFjufZR4I6j8cz5g1F1tTYpfOOFvly+cmIQwL9wvw==} dependencies: '@types/node': 20.10.5 tapable: 2.2.1 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) transitivePeerDependencies: - '@swc/core' - esbuild @@ -1713,7 +2002,7 @@ packages: webpack: 5.x.x webpack-cli: 5.x.x dependencies: - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack@5.89.0) /@webpack-cli/info@2.0.2(webpack-cli@5.1.4)(webpack@5.89.0): @@ -1723,7 +2012,7 @@ packages: webpack: 5.x.x webpack-cli: 5.x.x dependencies: - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack@5.89.0) /@webpack-cli/serve@2.0.5(webpack-cli@5.1.4)(webpack@5.89.0): @@ -1737,7 +2026,7 @@ packages: webpack-dev-server: optional: true dependencies: - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack@5.89.0) /@xtuc/ieee754@1.2.0: @@ -1885,7 +2174,6 @@ packages: /ansi-regex@6.0.1: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} engines: {node: '>=12'} - dev: true /ansi-styles@2.2.1: resolution: {integrity: sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==} @@ -1912,13 +2200,16 @@ packages: /ansi-styles@6.2.1: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} - dev: true /ansi-wrap@0.1.0: resolution: {integrity: sha512-ZyznvL8k/FZeQHr2T6LzcJ/+vBApDnMNZvfVFy3At0knswWd6rJ3/0Hhmpu8oqa6C92npmozs890sX9Dl6q+Qw==} engines: {node: '>=0.10.0'} dev: true + /any-promise@1.3.0: + resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + dev: false + /anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} @@ -2463,6 +2754,16 @@ packages: semver: 7.5.4 dev: true + /bundle-require@4.0.2(esbuild@0.19.12): + resolution: {integrity: sha512-jwzPOChofl67PSTW2SGubV9HBQAhhR2i6nskiOThauo9dzwDUgOWQScFVaJkjEfYX+UXiD+LEx8EblQMc2wIag==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.17' + dependencies: + esbuild: 0.19.12 + load-tsconfig: 0.2.5 + dev: false + /bytes@3.0.0: resolution: {integrity: sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==} engines: {node: '>= 0.8'} @@ -2473,6 +2774,11 @@ packages: engines: {node: '>= 0.8'} dev: false + /cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + dev: false + /cache-base@1.0.1: resolution: {integrity: sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==} engines: {node: '>=0.10.0'} @@ -2730,6 +3036,11 @@ packages: /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + /commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + dev: false + /commander@8.3.0: resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} engines: {node: '>= 12'} @@ -3214,7 +3525,6 @@ packages: /eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - dev: true /ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} @@ -3243,7 +3553,6 @@ packages: /emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} - dev: true /emojis-list@3.0.0: resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} @@ -3363,6 +3672,36 @@ packages: is-date-object: 1.0.5 is-symbol: 1.0.4 + /esbuild@0.19.12: + resolution: {integrity: sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.19.12 + '@esbuild/android-arm': 0.19.12 + '@esbuild/android-arm64': 0.19.12 + '@esbuild/android-x64': 0.19.12 + '@esbuild/darwin-arm64': 0.19.12 + '@esbuild/darwin-x64': 0.19.12 + '@esbuild/freebsd-arm64': 0.19.12 + '@esbuild/freebsd-x64': 0.19.12 + '@esbuild/linux-arm': 0.19.12 + '@esbuild/linux-arm64': 0.19.12 + '@esbuild/linux-ia32': 0.19.12 + '@esbuild/linux-loong64': 0.19.12 + '@esbuild/linux-mips64el': 0.19.12 + '@esbuild/linux-ppc64': 0.19.12 + '@esbuild/linux-riscv64': 0.19.12 + '@esbuild/linux-s390x': 0.19.12 + '@esbuild/linux-x64': 0.19.12 + '@esbuild/netbsd-x64': 0.19.12 + '@esbuild/openbsd-x64': 0.19.12 + '@esbuild/sunos-x64': 0.19.12 + '@esbuild/win32-arm64': 0.19.12 + '@esbuild/win32-ia32': 0.19.12 + '@esbuild/win32-x64': 0.19.12 + /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -4080,7 +4419,6 @@ packages: dependencies: cross-spawn: 7.0.3 signal-exit: 4.1.0 - dev: true /forwarded@0.2.0: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} @@ -4260,7 +4598,6 @@ packages: minimatch: 9.0.3 minipass: 7.0.4 path-scurry: 1.10.1 - dev: true /glob@3.1.21: resolution: {integrity: sha512-ANhy2V2+tFpRajE3wN4DhkNQ08KDr0Ir1qL12/cUe5+a7STEK8jkW4onUYuY8/06qAFuT5je7mjAqzx0eKI2tQ==} @@ -4631,7 +4968,7 @@ packages: dependencies: html-minifier-terser: 7.2.0 parse5: 7.1.2 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) dev: false /html-minifier-terser@6.1.0: @@ -4679,7 +5016,7 @@ packages: lodash: 4.17.21 pretty-error: 4.0.0 tapable: 2.2.1 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) dev: false /htmlparser2@6.1.0: @@ -5235,7 +5572,6 @@ packages: '@isaacs/cliui': 8.0.2 optionalDependencies: '@pkgjs/parseargs': 0.11.0 - dev: true /jest-changed-files@29.7.0: resolution: {integrity: sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==} @@ -5655,6 +5991,11 @@ packages: - ts-node dev: true + /joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + dev: false + /js-tokens@1.0.1: resolution: {integrity: sha512-WKqed1YxjsT7sGqM2IdbkJHnA3rXHqFqN+4xUy973UeYNjSXZCKM3G/zUmPNYut/6D9QCUbqegDmUCQRdm0lnQ==} dev: true @@ -5832,9 +6173,19 @@ packages: - supports-color dev: true + /lilconfig@3.0.0: + resolution: {integrity: sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==} + engines: {node: '>=14'} + dev: false + /lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + /load-tsconfig@0.2.5: + resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: false + /load-yaml-file@0.2.0: resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==} engines: {node: '>=6'} @@ -5940,6 +6291,10 @@ packages: resolution: {integrity: sha512-L4/arjjuq4noiUJpt3yS6KIKDtJwNe2fIYgMqyYYKoeIfV1iEqvPwhCx23o+R9dzouGihDAPN1dTIRWa7zk8tw==} dev: true + /lodash.sortby@4.7.0: + resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==} + dev: false + /lodash.startcase@4.4.0: resolution: {integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==} dev: false @@ -6000,7 +6355,6 @@ packages: /lru-cache@10.1.0: resolution: {integrity: sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==} engines: {node: 14 || >=16.14} - dev: true /lru-cache@2.7.3: resolution: {integrity: sha512-WpibWJ60c3AgAz8a2iYErDrcT2C7OmKnsWhIcHOjkUHFjkXncJhtLxNSqUmxRxRunpb5I8Vprd7aNSd2NtksJQ==} @@ -6215,7 +6569,6 @@ packages: /minipass@7.0.4: resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} engines: {node: '>=16 || 14 >=14.17'} - dev: true /mixin-deep@1.3.2: resolution: {integrity: sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==} @@ -6264,6 +6617,14 @@ packages: resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} dev: false + /mz@2.7.0: + resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + dependencies: + any-promise: 1.3.0 + object-assign: 4.1.1 + thenify-all: 1.6.0 + dev: false + /nanomatch@1.2.13: resolution: {integrity: sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==} engines: {node: '>=0.10.0'} @@ -6331,7 +6692,7 @@ packages: webpack: ^5.0.0 dependencies: loader-utils: 2.0.4 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) dev: true /node-releases@2.0.14: @@ -6382,7 +6743,6 @@ packages: /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} - dev: true /object-copy@0.1.0: resolution: {integrity: sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ==} @@ -6728,7 +7088,6 @@ packages: dependencies: lru-cache: 10.1.0 minipass: 7.0.4 - dev: true /path-to-regexp@0.1.7: resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} @@ -6753,7 +7112,6 @@ packages: /pirates@4.0.6: resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} engines: {node: '>= 6'} - dev: true /pkg-dir@4.2.0: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} @@ -6766,6 +7124,22 @@ packages: engines: {node: '>=0.10.0'} dev: true + /postcss-load-config@4.0.2: + resolution: {integrity: sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==} + engines: {node: '>= 14'} + peerDependencies: + postcss: '>=8.0.9' + ts-node: '>=9.0.0' + peerDependenciesMeta: + postcss: + optional: true + ts-node: + optional: true + dependencies: + lilconfig: 3.0.0 + yaml: 2.3.4 + dev: false + /preferred-pm@3.1.2: resolution: {integrity: sha512-nk7dKrcW8hfCZ4H6klWcdRknBOXWzNQByJ0oJyX97BOupsYD+FzLS4hflgEu/uPUEHZCuRfMxzCBsuWd7OzT8Q==} engines: {node: '>=10'} @@ -7220,6 +7594,29 @@ packages: glob: 10.3.10 dev: true + /rollup@4.9.6: + resolution: {integrity: sha512-05lzkCS2uASX0CiLFybYfVkwNbKZG5NFQ6Go0VWyogFTXXbR039UVsegViTntkk4OglHBdF54ccApXRRuXRbsg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + dependencies: + '@types/estree': 1.0.5 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.9.6 + '@rollup/rollup-android-arm64': 4.9.6 + '@rollup/rollup-darwin-arm64': 4.9.6 + '@rollup/rollup-darwin-x64': 4.9.6 + '@rollup/rollup-linux-arm-gnueabihf': 4.9.6 + '@rollup/rollup-linux-arm64-gnu': 4.9.6 + '@rollup/rollup-linux-arm64-musl': 4.9.6 + '@rollup/rollup-linux-riscv64-gnu': 4.9.6 + '@rollup/rollup-linux-x64-gnu': 4.9.6 + '@rollup/rollup-linux-x64-musl': 4.9.6 + '@rollup/rollup-win32-arm64-msvc': 4.9.6 + '@rollup/rollup-win32-ia32-msvc': 4.9.6 + '@rollup/rollup-win32-x64-msvc': 4.9.6 + fsevents: 2.3.3 + dev: false + /run-async@2.4.1: resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} engines: {node: '>=0.12.0'} @@ -7463,7 +7860,6 @@ packages: /signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - dev: true /simple-fmt@0.1.0: resolution: {integrity: sha512-9a3zTDDh9LXbTR37qBhACWIQ/mP/ry5xtmbE98BJM8GR02sanCkfMzp7AdCTqYhkBZggK/w7hJtc8Pb9nmo16A==} @@ -7594,6 +7990,13 @@ packages: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} engines: {node: '>= 8'} + /source-map@0.8.0-beta.0: + resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} + engines: {node: '>= 8'} + dependencies: + whatwg-url: 7.1.0 + dev: false + /sparkles@1.0.1: resolution: {integrity: sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==} engines: {node: '>= 0.10'} @@ -7727,7 +8130,6 @@ packages: eastasianwidth: 0.2.0 emoji-regex: 9.2.2 strip-ansi: 7.1.0 - dev: true /string.prototype.trim@1.2.8: resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==} @@ -7792,7 +8194,6 @@ packages: engines: {node: '>=12'} dependencies: ansi-regex: 6.0.1 - dev: true /strip-bom@1.0.0: resolution: {integrity: sha512-qVAeAIjblKDp/8Cd0tJdxpe3Iq/HooI7En98alEaMbz4Wedlrcj3WI72dDQSrziRW5IQ0zeBo3JXsmS8RcS9jg==} @@ -7835,6 +8236,20 @@ packages: engines: {node: '>=8'} dev: true + /sucrase@3.35.0: + resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==} + engines: {node: '>=16 || 14 >=14.17'} + hasBin: true + dependencies: + '@jridgewell/gen-mapping': 0.3.3 + commander: 4.1.1 + glob: 10.3.10 + lines-and-columns: 1.2.4 + mz: 2.7.0 + pirates: 4.0.6 + ts-interface-checker: 0.1.13 + dev: false + /supports-color@2.0.0: resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} engines: {node: '>=0.8.0'} @@ -7871,7 +8286,7 @@ packages: engines: {node: '>=8'} dev: false - /terser-webpack-plugin@5.3.9(webpack@5.89.0): + /terser-webpack-plugin@5.3.9(esbuild@0.19.12)(webpack@5.89.0): resolution: {integrity: sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==} engines: {node: '>= 10.13.0'} peerDependencies: @@ -7888,11 +8303,12 @@ packages: optional: true dependencies: '@jridgewell/trace-mapping': 0.3.20 + esbuild: 0.19.12 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.1 terser: 5.26.0 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) /terser@5.26.0: resolution: {integrity: sha512-dytTGoE2oHgbNV9nTzgBEPaqAWvcJNl66VZ0BkJqlvp71IjO8CxdBx/ykCNb47cLnCmCvRZ6ZR0tLkqvZCdVBQ==} @@ -7917,6 +8333,19 @@ packages: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} dev: true + /thenify-all@1.6.0: + resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} + engines: {node: '>=0.8'} + dependencies: + thenify: 3.3.1 + dev: false + + /thenify@3.3.1: + resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + dependencies: + any-promise: 1.3.0 + dev: false + /through2@0.6.5: resolution: {integrity: sha512-RkK/CCESdTKQZHdmKICijdKKsCRVHs5KsLZ6pACAmF/1GPUQhonHSXWNERctxEp7RmvjdNbZTL5z9V7nSCXKcg==} dependencies: @@ -8007,6 +8436,17 @@ packages: engines: {node: '>=0.6'} dev: false + /tr46@1.0.1: + resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} + dependencies: + punycode: 2.3.1 + dev: false + + /tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + dev: false + /trim-newlines@3.0.1: resolution: {integrity: sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==} engines: {node: '>=8'} @@ -8025,7 +8465,11 @@ packages: resolution: {integrity: sha512-2+ilNA00DGvbUYYbRrm3ux+snbo7I6uPXMw8I4p/QMl7HUOWBBZFbk+Mpr8/IAPDQE+LQ8vOdlI6xEzjc+e/BQ==} dev: true - /ts-jest@29.1.1(@babel/core@7.23.6)(jest@29.7.0)(typescript@5.0.4): + /ts-interface-checker@0.1.13: + resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + dev: false + + /ts-jest@29.1.1(@babel/core@7.23.6)(esbuild@0.19.12)(jest@29.7.0)(typescript@5.0.4): resolution: {integrity: sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -8048,6 +8492,7 @@ packages: dependencies: '@babel/core': 7.23.6 bs-logger: 0.2.6 + esbuild: 0.19.12 fast-json-stable-stringify: 2.1.0 jest: 29.7.0(@types/node@20.10.5) jest-util: 29.7.0 @@ -8072,7 +8517,7 @@ packages: semver: 7.5.4 source-map: 0.7.4 typescript: 5.0.4 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) /tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} @@ -8090,6 +8535,45 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + /tsup@8.0.1(typescript@5.0.4): + resolution: {integrity: sha512-hvW7gUSG96j53ZTSlT4j/KL0q1Q2l6TqGBFc6/mu/L46IoNWqLLUzLRLP1R8Q7xrJTmkDxxDoojV5uCVs1sVOg==} + engines: {node: '>=18'} + hasBin: true + peerDependencies: + '@microsoft/api-extractor': ^7.36.0 + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.5.0' + peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + dependencies: + bundle-require: 4.0.2(esbuild@0.19.12) + cac: 6.7.14 + chokidar: 3.5.3 + debug: 4.3.4 + esbuild: 0.19.12 + execa: 5.1.1 + globby: 11.1.0 + joycon: 3.1.1 + postcss-load-config: 4.0.2 + resolve-from: 5.0.0 + rollup: 4.9.6 + source-map: 0.8.0-beta.0 + sucrase: 3.35.0 + tree-kill: 1.2.2 + typescript: 5.0.4 + transitivePeerDependencies: + - supports-color + - ts-node + dev: false + /tsutils@3.21.0(typescript@5.0.4): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} @@ -8403,6 +8887,10 @@ packages: defaults: 1.0.4 dev: false + /webidl-conversions@4.0.2: + resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} + dev: false + /webpack-cli@5.1.4(webpack@5.89.0): resolution: {integrity: sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==} engines: {node: '>=14.15.0'} @@ -8432,7 +8920,7 @@ packages: import-local: 3.1.0 interpret: 3.1.1 rechoir: 0.8.0 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) webpack-merge: 5.10.0 /webpack-dev-middleware@5.3.3(webpack@5.89.0): @@ -8446,7 +8934,7 @@ packages: mime-types: 2.1.35 range-parser: 1.2.1 schema-utils: 4.2.0 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) dev: false /webpack-dev-server@4.15.1(bufferutil@4.0.8)(debug@2.6.9)(utf-8-validate@6.0.3)(webpack-cli@5.1.4)(webpack@5.89.0): @@ -8490,7 +8978,7 @@ packages: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack: 5.89.0(webpack-cli@5.1.4) + webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack@5.89.0) webpack-dev-middleware: 5.3.3(webpack@5.89.0) ws: 8.15.1(bufferutil@4.0.8)(utf-8-validate@6.0.3) @@ -8521,7 +9009,7 @@ packages: resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} engines: {node: '>=10.13.0'} - /webpack@5.89.0(webpack-cli@5.1.4): + /webpack@5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4): resolution: {integrity: sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==} engines: {node: '>=10.13.0'} hasBin: true @@ -8552,7 +9040,7 @@ packages: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.9(webpack@5.89.0) + terser-webpack-plugin: 5.3.9(esbuild@0.19.12)(webpack@5.89.0) watchpack: 2.4.0 webpack-cli: 5.1.4(webpack@5.89.0) webpack-sources: 3.2.3 @@ -8575,6 +9063,14 @@ packages: engines: {node: '>=0.8.0'} dev: false + /whatwg-url@7.1.0: + resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} + dependencies: + lodash.sortby: 4.7.0 + tr46: 1.0.1 + webidl-conversions: 4.0.2 + dev: false + /which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} dependencies: @@ -8657,7 +9153,6 @@ packages: ansi-styles: 6.2.1 string-width: 5.1.2 strip-ansi: 7.1.0 - dev: true /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} @@ -8714,6 +9209,11 @@ packages: /yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + /yaml@2.3.4: + resolution: {integrity: sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==} + engines: {node: '>= 14'} + dev: false + /yargs-parser@18.1.3: resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} engines: {node: '>=6'} diff --git a/tests/spec/config.js b/tests/spec/config.js index 35369ec..27cbd08 100644 --- a/tests/spec/config.js +++ b/tests/spec/config.js @@ -4,13 +4,13 @@ const { resolve } = require('path') module.exports = { rootDir: resolve(__dirname, '../..'), setupFilesAfterEnv: [ - '/tests/spec/setup.js' + '/tests/spec/setup.js', ], testRegex: '.+/*\\.spec\\.(ts|tsx)$', preset: 'ts-jest', transform: { '^.+\\.tsx?$': [ - 'ts-jest' - ] - } + 'ts-jest', + ], + }, } diff --git a/tests/spec/setup.js b/tests/spec/setup.js index 1f06a52..292da79 100644 --- a/tests/spec/setup.js +++ b/tests/spec/setup.js @@ -1,6 +1,6 @@ if (typeof global.setImmediate === 'undefined') { Object.assign(global, { setImmediate: setTimeout, - clearImmediate: clearTimeout + clearImmediate: clearTimeout, }) } diff --git a/tsconfig.json b/tsconfig.json index d1a2c6b..8e4aae0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,36 +1,37 @@ { "include": [ ".eslintrc.js", + "tsup.config.ts", "packages/**/*.ts", - // For react only - "packages/**/*.tsx" ], "exclude": [ ".yarn", "node_modules", + "**/node_modules/**", + "**/dist", + "**/builds", "**/*.js", - "**/*.spec.ts", - "**/*.test.ts", + // "**/*.spec.ts", + // "**/*.test.ts", + // "**/tests" ], "compilerOptions": { // "declaration": true, - "module": "commonjs", - "target": "es6", - // for react only - // "jsx": "react", + "module": "ESNext", + "target": "ESNext", + "jsx": "react", "lib": [ "dom", "esnext", "WebWorker" ], "removeComments": true, - "moduleResolution": "Node", + "moduleResolution": "Node10", "resolveJsonModule": true, // "types": [ - // "node", - // For react only (next for react v18) - // "react/next", - // "react-dom/next", + // "node", + // "react", + // "react-dom", // ], "strict": true, // "noEmit": true, diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 0000000..6b58aa4 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,181 @@ +import { defineConfig, type Options } from 'tsup' +import path from 'path' +import fs from 'fs-extra' + +const resolvePath = (...paths: string[]): string => + path.resolve(...paths).replace(/\\/g, '/') +const relativePath = (...args: Parameters): string => + path.relative(...args).replace(/\\/g, '/') + +let envName: string +const createBuildConfigs = async (name: string): Promise => { + const basePath = `${__dirname}/${name}`.replace(/\\/g, '/') // eslint-disable-line n/no-path-concat + const packageJsonPath = `${basePath}/package.json` + const packageJson = await fs.readJson(packageJsonPath) + let jsBanner = '/*! Copyright (c) 2023 ABx. All rights reserved. */' + + if (packageJson.license) { + jsBanner = `/*! + * Copyright (c) 2023 ABx. All rights reserved. + * Licensed under the ${packageJson.license} License. See LICENSE file in the project root for license information. + */` + } + + const configs: Options[] = [] + // posible ./dist/index.ts + const packageMain = packageJson.main?.replace('./dist/', '').replace(/\.m?js$/, '.ts') + const isTypesIncluded = Boolean(packageJson.types) + let isEsmIncluded = Boolean(packageJson.module) + + const ignoredPatterns = [ + '!node_modules/**', + `!${basePath}/node_modules`, + `!${basePath}/node_modules/**`, + `!${basePath}/dist`, + `!${basePath}/**/*.spec.ts`, + `!${basePath}/**/*.test.ts`, + `!${basePath}/tests/**`, + ] + + const cjsBaseConfig: Options = { + clean: true, + tsconfig: `${basePath}/tsconfig.build.json`, + format: ['cjs'], + external: [/^[^./D]/], // only bundle entry modules and relative modules + outDir: `${basePath}/dist`, + splitting: false, + dts: false, + minify: envName === 'production', + banner: { + js: jsBanner, + }, + } + + let esmDistPaths: string[] = [] + const esmBaseConfig: Options = { + ...cjsBaseConfig, + format: ['esm'], + external: [/^[^/D]/], // only bundle entry modules (relative modules output into separated files) + esbuildOptions (options, context) { + options.outbase = basePath // keep source dir structure + }, + esbuildPlugins: [ + { + name: 'add-mjs-ext', + setup (build) { + build.onStart(() => { esmDistPaths = [] }) + build.onResolve({ filter: /^\.*/ }, args => { + // if (args.importer) { return { path: args.path + '.mjs', external: true } } + if (args.kind !== 'entry-point') return undefined + + const entryPath = args.path + const entrySubPath = relativePath(basePath, entryPath) + const entryDistPath = resolvePath(basePath, 'dist', entrySubPath.replace('.ts', '.mjs')) + if (!esmDistPaths.includes(entryDistPath)) { + esmDistPaths.push(entryDistPath) + } + }) + }, + }, + ], + async onSuccess () { + console.info('EXT', 'Replacing dist imports') + let replacedCount = 0 + + await Promise.all(esmDistPaths.map(async distFile => { + const fileDirPath = path.dirname(distFile) + const contents = await fs.readFile(distFile, 'utf8') + const contentsWithExtImports = contents.replace(/\bfrom\s+['"](\.[^'"]+)['"]/g, (_, importPath) => { + let resolvedExtImportPath = importPath + const fullExtImportPath = resolvePath(fileDirPath, `${importPath}.mjs`) + const fullExtImportPathIndex = resolvePath(fileDirPath, importPath, 'index.mjs') + + if (esmDistPaths.includes(fullExtImportPath)) resolvedExtImportPath = `${importPath}.mjs` + else if (esmDistPaths.includes(fullExtImportPathIndex)) resolvedExtImportPath = `${importPath}/index.mjs` + if (resolvedExtImportPath !== importPath) replacedCount++ + + return `from "${resolvedExtImportPath}"` + }) + + // Write the modified content back to the file + await fs.writeFile(distFile, contentsWithExtImports, 'utf8') + })) + + console.info('EXT', 'Replaced', replacedCount, 'dist imports') + }, + dts: false, + minify: false, + banner: { + js: jsBanner, + }, + } + + if (packageMain) { + const mainImportPath = resolvePath(basePath, packageMain) + + configs.push({ + ...cjsBaseConfig, + entry: [mainImportPath, ...ignoredPatterns], + dts: isTypesIncluded + ? { + entry: mainImportPath, + // banner: `declare module '${packageJson.name}' {\n`, + // footer: '\n}', + compilerOptions: { + removeComments: false, // keep comments for type definitions + }, + } + : false, + }) + } + + const packageExports = packageJson.exports + + packageExports && Object.keys(packageExports).forEach(key => { + if (key === '.') return // continue + + const packageExport = packageExports[key] + const packageExportMain = packageExport.require?.replace('./dist/', '').replace(/\.m?js$/, '.ts') + const isTypesIncluded = packageExport.types + + if (packageExport.import) isEsmIncluded = true + if (packageExportMain) { + const mainImportPath = resolvePath(basePath, packageExportMain) + + configs.push({ + ...cjsBaseConfig, + entry: [mainImportPath, ...ignoredPatterns], + outDir: resolvePath(basePath, 'dist', key), + dts: isTypesIncluded ? mainImportPath : false, + }) + } + }) + + if (isEsmIncluded) { + configs.push({ + ...esmBaseConfig, + entry: [resolvePath(basePath, '**/*.ts'), ...ignoredPatterns], + }) + } + + return configs +} + +const packages = [ + 'packages/builder', + 'packages/dts', + 'packages/logger', + 'packages/paths', + 'packages/resolve', + 'packages/tasks', + 'packages/webpack-dts', +] + +export default defineConfig(async (options) => { + envName = options.env?.NODE_ENV || process.env.NODE_ENV || 'development' + console.info('ENV', envName) + + const configs = await Promise.all(packages.map(createBuildConfigs)) + + return configs.flat() +}) diff --git a/webpack.config.js b/webpack.config.js index 80438c2..5c6cad6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -15,29 +15,29 @@ const envName = process.env.NODE_ENV || 'development' const entry = { '/packages/paths/index.ts': { - import: resolvePath('packages/paths/index.ts') + import: resolvePath('packages/paths/index.ts'), }, '/packages/dts/index.ts': { - import: resolvePath('packages/dts/index.ts') + import: resolvePath('packages/dts/index.ts'), }, '/packages/webpack-dts/index.ts': { - import: resolvePath('packages/webpack-dts/index.ts') + import: resolvePath('packages/webpack-dts/index.ts'), }, '/packages/builder/cli/index.ts': { - import: resolvePath('packages/builder/cli/index.ts') + import: resolvePath('packages/builder/cli/index.ts'), }, '/packages/resolve/index.ts': { - import: resolvePath('packages/resolve/index.ts') + import: resolvePath('packages/resolve/index.ts'), }, '/packages/resolve/cli/index.ts': { - import: resolvePath('packages/resolve/cli/index.ts') + import: resolvePath('packages/resolve/cli/index.ts'), }, '/packages/logger/index.ts': { - import: resolvePath('packages/logger/index.ts') + import: resolvePath('packages/logger/index.ts'), }, '/packages/tasks/index.ts': { - import: resolvePath('packages/tasks/index.ts') - } + import: resolvePath('packages/tasks/index.ts'), + }, } exports = module.exports = async () => { @@ -50,16 +50,16 @@ exports = module.exports = async () => { return data.chunk.name.replace(/\.tsx?$/, '.js') // change index.ts to index.js }, library: { - type: 'commonjs2' - } + type: 'commonjs2', + }, }, resolve: { symlinks: true, extensions: [ '.ts', '.js', - '.tsx' - ] + '.tsx', + ], }, module: { rules: [ @@ -71,18 +71,18 @@ exports = module.exports = async () => { options: { configFile: resolvePath('./tsconfig.json'), compilerOptions: { - projectDir: __dirname - } - } - } + projectDir: __dirname, + }, + }, + }, ], - exclude: /node_modules|\.yarn/ + exclude: /node_modules|\.yarn/, }, { test: /.node$/, loader: 'node-loader', }, - ] + ], }, plugins: [ new BannerPlugin({ @@ -95,9 +95,9 @@ exports = module.exports = async () => { return license } }, - raw: true + raw: true, }), - envName === 'production' && new WebpackDtsPlugin(rootPath) + envName === 'production' && new WebpackDtsPlugin(rootPath), ].filter(Boolean), watch: envName === 'development', watchOptions: { @@ -105,35 +105,35 @@ exports = module.exports = async () => { 'node_modules', '.yarn', '**/index.js', - '**/index.d.ts' - ] + '**/index.d.ts', + ], }, devtool: false, target: 'node', externals: [ /^[^./]+\/([^/]+\/)*index\.js$/, webpackNodeExternals(), - WebpackPnpExternals() + WebpackPnpExternals(), ], externalsPresets: { - node: true + node: true, }, optimization: { minimizer: [new TerserPlugin({ - extractComments: false - })] - } + extractComments: false, + })], + }, } const { configs } = await replaceVars({ editor: { path: { - rootPath + rootPath, }, configs: { - node: config - } - } + node: config, + }, + }, }) return Object.values(configs) From aaa9741c912456cb796e98c5576b089709cdd353 Mon Sep 17 00:00:00 2001 From: Hung Luu Date: Fri, 26 Jan 2024 11:31:20 +0700 Subject: [PATCH 2/4] chore: update version and remove webpack config --- package.json | 13 +-- packages/builder/CHANGELOG.md | 13 +++ packages/builder/package.json | 2 +- packages/dts/CHANGELOG.md | 11 +++ packages/dts/package.json | 2 +- packages/logger/CHANGELOG.md | 6 ++ packages/logger/package.json | 2 +- packages/paths/CHANGELOG.md | 6 ++ packages/paths/package.json | 2 +- packages/resolve/CHANGELOG.md | 11 +++ packages/resolve/package.json | 2 +- packages/tasks/CHANGELOG.md | 6 ++ packages/tasks/package.json | 2 +- packages/webpack-dts/CHANGELOG.md | 13 +++ packages/webpack-dts/package.json | 2 +- pnpm-lock.yaml | 56 +----------- webpack.components.config.js | 116 ------------------------- webpack.config.js | 140 ------------------------------ 18 files changed, 79 insertions(+), 326 deletions(-) delete mode 100644 webpack.components.config.js delete mode 100644 webpack.config.js diff --git a/package.json b/package.json index b962069..fc0cb11 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,10 @@ "builder": "pnpm --filter builder" }, "dependencies": { - "tsup": "^8.0.1", "@abxvn/webpack-dts": "workspace:^", "@changesets/cli": "^2.27.1", - "typescript": "~5.0.4", - "webpack": "^5.89.0" + "tsup": "^8.0.1", + "typescript": "~5.0.4" }, "devDependencies": { "@types/fs-extra": "^11.0.4", @@ -33,14 +32,8 @@ "eslint-plugin-promise": "^6.1.1", "fs-extra": "^11.2.0", "jest": "^29.7.0", - "node-loader": "^2.0.0", "rimraf": "^5.0.5", - "terser-webpack-plugin": "^5.3.9", "ts-jest": "^29.1.1", - "ts-loader": "^9.5.1", - "utf-8-validate": "^6.0.3", - "webpack-cli": "^5.1.4", - "webpack-node-externals": "^3.0.0", - "webpack-pnp-externals": "^1.1.0" + "utf-8-validate": "^6.0.3" } } diff --git a/packages/builder/CHANGELOG.md b/packages/builder/CHANGELOG.md index 6479b33..8ab6775 100644 --- a/packages/builder/CHANGELOG.md +++ b/packages/builder/CHANGELOG.md @@ -1,5 +1,18 @@ # @abxvn/builder +## 1.2.0 + +### Minor Changes + +- Update builder + +### Patch Changes + +- Updated dependencies + - @abxvn/webpack-dts@1.1.0 + - @abxvn/resolve@2.1.0 + - @abxvn/logger@2.1.0 + ## 1.1.1 ### Patch Changes diff --git a/packages/builder/package.json b/packages/builder/package.json index bf38f96..1b1bb82 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@abxvn/builder", - "version": "1.1.1", + "version": "1.2.0", "description": "Quick scaffolding code base to build web apps and games", "license": "MIT", "repository": { diff --git a/packages/dts/CHANGELOG.md b/packages/dts/CHANGELOG.md index 8e390fa..9a9d804 100644 --- a/packages/dts/CHANGELOG.md +++ b/packages/dts/CHANGELOG.md @@ -1,5 +1,16 @@ # @abxvn/dts +## 1.1.0 + +### Minor Changes + +- Update builder + +### Patch Changes + +- Updated dependencies + - @abxvn/paths@1.1.0 + ## 1.0.1 ### Patch Changes diff --git a/packages/dts/package.json b/packages/dts/package.json index 40df334..f032445 100644 --- a/packages/dts/package.json +++ b/packages/dts/package.json @@ -1,7 +1,7 @@ { "name": "@abxvn/dts", "description": "Simple and fast typescript declaration (dts) file generator", - "version": "1.0.1", + "version": "1.1.0", "repository": { "type": "git", "url": "git+https://github.com/abxvn/source.git", diff --git a/packages/logger/CHANGELOG.md b/packages/logger/CHANGELOG.md index 98bc27e..89a259c 100644 --- a/packages/logger/CHANGELOG.md +++ b/packages/logger/CHANGELOG.md @@ -1,5 +1,11 @@ # @abxvn/logger +## 2.1.0 + +### Minor Changes + +- Update builder + ## 2.0.1 ### Patch Changes diff --git a/packages/logger/package.json b/packages/logger/package.json index 68e83e0..b7921d6 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,7 +1,7 @@ { "name": "@abxvn/logger", "description": "Logger helpers and collapsible logs", - "version": "2.0.1", + "version": "2.1.0", "license": "MIT", "repository": { "type": "git", diff --git a/packages/paths/CHANGELOG.md b/packages/paths/CHANGELOG.md index d713fe6..9bc4569 100644 --- a/packages/paths/CHANGELOG.md +++ b/packages/paths/CHANGELOG.md @@ -1,5 +1,11 @@ # @abxvn/paths +## 1.1.0 + +### Minor Changes + +- Update builder + ## 1.0.1 ### Patch Changes diff --git a/packages/paths/package.json b/packages/paths/package.json index dd9e428..e4576ec 100644 --- a/packages/paths/package.json +++ b/packages/paths/package.json @@ -1,6 +1,6 @@ { "name": "@abxvn/paths", - "version": "1.0.1", + "version": "1.1.0", "description": "A cross-platform path resolving utility", "repository": { "type": "git", diff --git a/packages/resolve/CHANGELOG.md b/packages/resolve/CHANGELOG.md index 400b90a..8cec8cd 100644 --- a/packages/resolve/CHANGELOG.md +++ b/packages/resolve/CHANGELOG.md @@ -1,5 +1,16 @@ # @abxvn/resolve +## 2.1.0 + +### Minor Changes + +- Update builder + +### Patch Changes + +- Updated dependencies + - @abxvn/resolve@2.1.0 + ## 2.0.1 ### Patch Changes diff --git a/packages/resolve/package.json b/packages/resolve/package.json index 4c90b5c..6decd7f 100644 --- a/packages/resolve/package.json +++ b/packages/resolve/package.json @@ -1,6 +1,6 @@ { "name": "@abxvn/resolve", - "version": "2.0.1", + "version": "2.1.0", "description": "Async resolve with pnp supports", "license": "MIT", "repository": { diff --git a/packages/tasks/CHANGELOG.md b/packages/tasks/CHANGELOG.md index d443d24..db43d9f 100644 --- a/packages/tasks/CHANGELOG.md +++ b/packages/tasks/CHANGELOG.md @@ -1,5 +1,11 @@ # @abxvn/tasks +## 1.1.0 + +### Minor Changes + +- Update builder + ## 1.0.1 ### Patch Changes diff --git a/packages/tasks/package.json b/packages/tasks/package.json index aec56cd..6f37bc0 100644 --- a/packages/tasks/package.json +++ b/packages/tasks/package.json @@ -1,6 +1,6 @@ { "name": "@abxvn/tasks", - "version": "1.0.1", + "version": "1.1.0", "description": "Light-weight and fast priority based task runner", "license": "MIT", "repository": { diff --git a/packages/webpack-dts/CHANGELOG.md b/packages/webpack-dts/CHANGELOG.md index af1afa1..ec102ef 100644 --- a/packages/webpack-dts/CHANGELOG.md +++ b/packages/webpack-dts/CHANGELOG.md @@ -1,5 +1,18 @@ # @abxvn/webpack-dts +## 1.1.0 + +### Minor Changes + +- Update builder + +### Patch Changes + +- Updated dependencies + - @abxvn/logger@2.1.0 + - @abxvn/paths@1.1.0 + - @abxvn/dts@1.1.0 + ## 1.0.1 ### Patch Changes diff --git a/packages/webpack-dts/package.json b/packages/webpack-dts/package.json index 4824bbc..bff3a1f 100644 --- a/packages/webpack-dts/package.json +++ b/packages/webpack-dts/package.json @@ -1,7 +1,7 @@ { "name": "@abxvn/webpack-dts", "description": "Webpack plugin for typescript declaration dts generation", - "version": "1.0.1", + "version": "1.1.0", "types": "index.d.ts", "repository": { "type": "git", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ba717f9..16670b8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,9 +20,6 @@ importers: typescript: specifier: ~5.0.4 version: 5.0.4 - webpack: - specifier: ^5.89.0 - version: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) devDependencies: '@types/fs-extra': specifier: ^11.0.4 @@ -72,33 +69,15 @@ importers: jest: specifier: ^29.7.0 version: 29.7.0(@types/node@20.10.5) - node-loader: - specifier: ^2.0.0 - version: 2.0.0(webpack@5.89.0) rimraf: specifier: ^5.0.5 version: 5.0.5 - terser-webpack-plugin: - specifier: ^5.3.9 - version: 5.3.9(esbuild@0.19.12)(webpack@5.89.0) ts-jest: specifier: ^29.1.1 version: 29.1.1(@babel/core@7.23.6)(esbuild@0.19.12)(jest@29.7.0)(typescript@5.0.4) - ts-loader: - specifier: ^9.5.1 - version: 9.5.1(typescript@5.0.4)(webpack@5.89.0) utf-8-validate: specifier: ^6.0.3 version: 6.0.3 - webpack-cli: - specifier: ^5.1.4 - version: 5.1.4(webpack@5.89.0) - webpack-node-externals: - specifier: ^3.0.0 - version: 3.0.0 - webpack-pnp-externals: - specifier: ^1.1.0 - version: 1.1.0 packages/builder: dependencies: @@ -2609,10 +2588,6 @@ packages: is-windows: 1.0.2 dev: false - /big.js@5.2.2: - resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} - dev: true - /binary-extensions@2.2.0: resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} engines: {node: '>=8'} @@ -3554,11 +3529,6 @@ packages: /emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} - /emojis-list@3.0.0: - resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} - engines: {node: '>= 4'} - dev: true - /encodeurl@1.0.2: resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} engines: {node: '>= 0.8'} @@ -6200,15 +6170,6 @@ packages: resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} engines: {node: '>=6.11.5'} - /loader-utils@2.0.4: - resolution: {integrity: sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==} - engines: {node: '>=8.9.0'} - dependencies: - big.js: 5.2.2 - emojis-list: 3.0.0 - json5: 2.2.3 - dev: true - /locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -6685,16 +6646,6 @@ packages: resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} dev: true - /node-loader@2.0.0(webpack@5.89.0): - resolution: {integrity: sha512-I5VN34NO4/5UYJaUBtkrODPWxbobrE4hgDqPrjB25yPkonFhCmZ146vTH+Zg417E9Iwoh1l/MbRs1apc5J295Q==} - engines: {node: '>= 10.13.0'} - peerDependencies: - webpack: ^5.0.0 - dependencies: - loader-utils: 2.0.4 - webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) - dev: true - /node-releases@2.0.14: resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} @@ -7989,6 +7940,7 @@ packages: /source-map@0.7.4: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} engines: {node: '>= 8'} + dev: false /source-map@0.8.0-beta.0: resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} @@ -8518,6 +8470,7 @@ packages: source-map: 0.7.4 typescript: 5.0.4 webpack: 5.89.0(esbuild@0.19.12)(webpack-cli@5.1.4) + dev: false /tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} @@ -9000,10 +8953,7 @@ packages: /webpack-node-externals@3.0.0: resolution: {integrity: sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==} engines: {node: '>=6'} - - /webpack-pnp-externals@1.1.0: - resolution: {integrity: sha512-jotzsud210jTpoCMvuJWlIb1EeXxlKHjBtK9iClUgehDVDcaeMOfvw5xCYUCen/QdqfJle8J6oiuP8gapu/Dzw==} - dev: true + dev: false /webpack-sources@3.2.3: resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} diff --git a/webpack.components.config.js b/webpack.components.config.js deleted file mode 100644 index cd117a0..0000000 --- a/webpack.components.config.js +++ /dev/null @@ -1,116 +0,0 @@ -const { BannerPlugin } = require('webpack') -const webpackNodeExternals = require('webpack-node-externals') -const { WebpackPnpExternals } = require('webpack-pnp-externals') -const { resolve } = require('path') -const TerserPlugin = require('terser-webpack-plugin') - -const rootPath = __dirname.replace(/\\/g, '/') -const resolvePath = subPath => resolve(rootPath, subPath).replace(/\\/g, '/') -// const getRelativePath = fullPath => fullPath.replace(/\\/g, '/').replace(rootPath, '') - -const envName = process.env.NODE_ENV || 'development' - -const entry = { - '/packages/dts/index.ts': { - import: resolvePath('packages/dts/index.ts') - }, - '/packages/webpack-dts/index.ts': { - import: resolvePath('packages/webpack-dts/index.ts') - }, - '/packages/builder/src/filters/replaceVars/index.ts': { - import: resolvePath('packages/builder/src/filters/replaceVars/index.ts') - }, - '/packages/logger/index.ts': { - import: resolvePath('packages/logger/index.ts') - }, - '/packages/logger/cli/index.ts': { - import: resolvePath('packages/logger/cli/index.ts') - }, - // '/packages/resolve/index.ts': { - // import: resolvePath('packages/resolve/index.ts') - // }, - // '/packages/resolve/cli/index.ts': { - // import: resolvePath('packages/resolve/cli/index.ts') - // }, -} - -exports = module.exports = { - entry, - mode: envName, - output: { - path: rootPath, - filename: data => { - return data.chunk.name.replace(/\.tsx?$/, '.js') // change index.ts to index.js - }, - libraryTarget: 'commonjs2' - // library: { - // type: 'umd2' - // } - }, - resolve: { - extensions: [ - '.ts', - '.js', - '.tsx' - ] - }, - module: { - rules: [ - { - test: /\.(js|tsx?)$/, - use: [ - { - loader: require.resolve('ts-loader'), - options: { - configFile: resolvePath('./tsconfig.json'), - compilerOptions: { - projectDir: __dirname - } - } - } - ], - exclude: /node_modules|\.yarn/ - } - ] - }, - plugins: [ - new BannerPlugin({ - banner: ({ filename }) => { - const license = '/*! Copyright (c) 2023 ABx. Under MIT license found in the LICENSE file */\n' - - if (/(builder|resolve)\/cli\//.test(filename)) { - return ['#!/usr/bin/env node', license].join('\n') - } else { - return license - } - }, - raw: true - }) - ].filter(Boolean), - watch: envName === 'development', - watchOptions: { - ignored: [ - 'node_modules', - '.yarn', - '**/index.js', - '**/index.d.ts' - ] - }, - devtool: false, - target: 'node', - externals: [ - /^[^./]+\/([^/]+\/)*index\.js$/, - webpackNodeExternals(), - WebpackPnpExternals({ - exclude: 'ansi-colors' - }) - ], - externalsPresets: { - node: true - }, - optimization: { - minimizer: [new TerserPlugin({ - extractComments: false - })] - } -} diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 5c6cad6..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,140 +0,0 @@ -const { BannerPlugin } = require('webpack') -const webpackNodeExternals = require('webpack-node-externals') -const { WebpackPnpExternals } = require('webpack-pnp-externals') -const { resolve } = require('path') - -const TerserPlugin = require('terser-webpack-plugin') -const { WebpackDtsPlugin } = require('@abxvn/webpack-dts') -const { default: replaceVars } = require('./packages/builder/src/filters/replaceVars') - -const rootPath = __dirname.replace(/\\/g, '/') -const resolvePath = subPath => resolve(rootPath, subPath).replace(/\\/g, '/') -// const getRelativePath = fullPath => fullPath.replace(/\\/g, '/').replace(rootPath, '') - -const envName = process.env.NODE_ENV || 'development' - -const entry = { - '/packages/paths/index.ts': { - import: resolvePath('packages/paths/index.ts'), - }, - '/packages/dts/index.ts': { - import: resolvePath('packages/dts/index.ts'), - }, - '/packages/webpack-dts/index.ts': { - import: resolvePath('packages/webpack-dts/index.ts'), - }, - '/packages/builder/cli/index.ts': { - import: resolvePath('packages/builder/cli/index.ts'), - }, - '/packages/resolve/index.ts': { - import: resolvePath('packages/resolve/index.ts'), - }, - '/packages/resolve/cli/index.ts': { - import: resolvePath('packages/resolve/cli/index.ts'), - }, - '/packages/logger/index.ts': { - import: resolvePath('packages/logger/index.ts'), - }, - '/packages/tasks/index.ts': { - import: resolvePath('packages/tasks/index.ts'), - }, -} - -exports = module.exports = async () => { - const config = { - entry, - mode: envName, - output: { - path: rootPath, - filename: data => { - return data.chunk.name.replace(/\.tsx?$/, '.js') // change index.ts to index.js - }, - library: { - type: 'commonjs2', - }, - }, - resolve: { - symlinks: true, - extensions: [ - '.ts', - '.js', - '.tsx', - ], - }, - module: { - rules: [ - { - test: /\.(js|tsx?)$/, - use: [ - { - loader: require.resolve('ts-loader'), - options: { - configFile: resolvePath('./tsconfig.json'), - compilerOptions: { - projectDir: __dirname, - }, - }, - }, - ], - exclude: /node_modules|\.yarn/, - }, - { - test: /.node$/, - loader: 'node-loader', - }, - ], - }, - plugins: [ - new BannerPlugin({ - banner: ({ filename }) => { - const license = '/*! Copyright (c) 2023 ABx. Under MIT license found in the LICENSE file */\n' - - if (/(builder|resolve)\/cli\//.test(filename)) { - return ['#!/usr/bin/env node', license].join('\n') - } else { - return license - } - }, - raw: true, - }), - envName === 'production' && new WebpackDtsPlugin(rootPath), - ].filter(Boolean), - watch: envName === 'development', - watchOptions: { - ignored: [ - 'node_modules', - '.yarn', - '**/index.js', - '**/index.d.ts', - ], - }, - devtool: false, - target: 'node', - externals: [ - /^[^./]+\/([^/]+\/)*index\.js$/, - webpackNodeExternals(), - WebpackPnpExternals(), - ], - externalsPresets: { - node: true, - }, - optimization: { - minimizer: [new TerserPlugin({ - extractComments: false, - })], - }, - } - - const { configs } = await replaceVars({ - editor: { - path: { - rootPath, - }, - configs: { - node: config, - }, - }, - }) - - return Object.values(configs) -} From d8639bfc366ca4014b3cf8b0358f40832824ac1f Mon Sep 17 00:00:00 2001 From: Hung Luu Date: Fri, 26 Jan 2024 11:38:53 +0700 Subject: [PATCH 3/4] fix: missing cli export of logger --- packages/logger/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/logger/package.json b/packages/logger/package.json index b7921d6..11717c7 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -34,6 +34,10 @@ ".": { "import": "./dist/index.mjs", "require": "./dist/index.js" + }, + "./cli": { + "import": "./dist/cli/index.mjs", + "require": "./dist/cli/index.js" } }, "files": [ From 4b4ff9049dd5d1cc081f7876a35ed9420a27105b Mon Sep 17 00:00:00 2001 From: Hung Luu Date: Fri, 26 Jan 2024 11:41:34 +0700 Subject: [PATCH 4/4] chore: update build pipeline --- .github/workflows/build.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0f2ea65..0c3f1e9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,7 +14,7 @@ jobs: timeout-minutes: 10 strategy: matrix: - node-version: [ 18 ] + node-version: [ 20 ] steps: - name: Running on ref run: echo ${{ github.ref }} @@ -38,6 +38,9 @@ jobs: - name: Lint run: | pnpm lint + - name: Build + run: | + pnpm build - name: Test run: | pnpm test