skuba 6.0.2 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/github/checkRun.d.ts +1 -1
- package/lib/api/github/checkRun.js.map +1 -1
- package/lib/api/jest/index.d.ts +4 -1
- package/lib/cli/adapter/eslint.js +0 -24
- package/lib/cli/adapter/eslint.js.map +2 -2
- package/lib/cli/build/assets.d.ts +10 -0
- package/lib/cli/build/assets.js +107 -0
- package/lib/cli/build/assets.js.map +7 -0
- package/lib/cli/build/esbuild.js +3 -42
- package/lib/cli/build/esbuild.js.map +3 -3
- package/lib/cli/build/index.js +12 -2
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/build/tsc.d.ts +3 -0
- package/lib/cli/build/tsc.js +66 -0
- package/lib/cli/build/tsc.js.map +3 -3
- package/lib/cli/buildPackage.js +13 -0
- package/lib/cli/buildPackage.js.map +2 -2
- package/lib/cli/test/reporters/github/index.js +0 -2
- package/lib/utils/copy.d.ts +1 -0
- package/lib/utils/copy.js +6 -1
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.d.ts +2 -1
- package/lib/utils/dir.js +2 -2
- package/lib/utils/dir.js.map +2 -2
- package/lib/utils/manifest.d.ts +1 -0
- package/lib/utils/manifest.js +8 -2
- package/lib/utils/manifest.js.map +2 -2
- package/lib/utils/validation.d.ts +2 -2
- package/lib/utils/validation.js.map +2 -2
- package/lib/wrapper/requestListener.js +3 -0
- package/lib/wrapper/requestListener.js.map +2 -2
- package/package.json +14 -14
- package/template/base/.github/CODEOWNERS +0 -4
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/gantry.apply.yml +0 -2
- package/template/express-rest-api/package.json +1 -1
- package/template/express-rest-api/src/api/healthCheck.ts +1 -1
- package/template/express-rest-api/src/api/smokeTest.ts +1 -1
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/gantry.apply.yml +0 -2
- package/template/koa-rest-api/package.json +4 -4
- package/template/koa-rest-api/src/api/healthCheck.ts +1 -1
- package/template/koa-rest-api/src/api/jobs/getJobs.ts +1 -1
- package/template/koa-rest-api/src/api/jobs/postJob.ts +1 -1
- package/template/koa-rest-api/src/api/smokeTest.ts +1 -1
- package/template/koa-rest-api/src/framework/server.test.ts +1 -1
- package/template/koa-rest-api/src/framework/validation.ts +2 -2
- package/template/koa-rest-api/src/storage/jobs.ts +1 -1
- package/template/koa-rest-api/src/testing/server.ts +2 -2
- package/template/koa-rest-api/src/testing/types.ts +1 -1
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker/package.json +3 -3
- package/template/lambda-sqs-worker/src/app.ts +1 -1
- package/template/lambda-sqs-worker/src/framework/validation.ts +1 -1
- package/template/lambda-sqs-worker/src/mapping/jobScorer.ts +5 -2
- package/template/lambda-sqs-worker/src/services/jobScorer.ts +6 -6
- package/template/lambda-sqs-worker/src/testing/handler.ts +1 -1
- package/template/lambda-sqs-worker/src/testing/types.ts +1 -1
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
- package/template/lambda-sqs-worker-cdk/package.json +1 -1
- package/template/lambda-sqs-worker-cdk/src/app.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Endpoints } from '@octokit/types';
|
|
2
|
-
type Output = NonNullable<Endpoints['
|
|
2
|
+
type Output = NonNullable<Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters']['output']>;
|
|
3
3
|
export type Annotation = NonNullable<Output['annotations']>[number];
|
|
4
4
|
/**
|
|
5
5
|
* {@link https://docs.github.com/en/rest/reference/checks#create-a-check-run}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/api/github/checkRun.ts"],
|
|
4
|
-
"sourcesContent": ["import { Octokit } from '@octokit/rest';\nimport type { Endpoints } from '@octokit/types';\n\nimport { pluralise } from '../../utils/logging';\nimport * as Git from '../git';\n\nimport { apiTokenFromEnvironment } from './environment';\n\ntype Output = NonNullable<\n Endpoints['
|
|
4
|
+
"sourcesContent": ["import { Octokit } from '@octokit/rest';\nimport type { Endpoints } from '@octokit/types';\n\nimport { pluralise } from '../../utils/logging';\nimport * as Git from '../git';\n\nimport { apiTokenFromEnvironment } from './environment';\n\ntype Output = NonNullable<\n Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters']['output']\n>;\n\nexport type Annotation = NonNullable<Output['annotations']>[number];\n\nconst GITHUB_MAX_ANNOTATIONS = 50;\n\n/**\n * Suffixes the title with the number of annotations added, e.g.\n *\n * ```text\n * Build #12 failed (24 annotations added)\n * ```\n */\nconst suffixTitle = (title: string, inputAnnotations: number): string => {\n const addedAnnotations =\n inputAnnotations > GITHUB_MAX_ANNOTATIONS\n ? GITHUB_MAX_ANNOTATIONS\n : inputAnnotations;\n\n return `${title} (${pluralise(addedAnnotations, 'annotation')} added)`;\n};\n\n/**\n * Enriches the summary with more context about the check run.\n */\nconst createEnrichedSummary = (\n summary: string,\n inputAnnotations: number,\n): string =>\n [\n summary,\n ...(inputAnnotations > GITHUB_MAX_ANNOTATIONS\n ? [\n `${inputAnnotations} annotations were provided, but only the first ${GITHUB_MAX_ANNOTATIONS} are visible in GitHub.`,\n ]\n : []),\n ].join('\\n\\n');\n\n/**\n * {@link https://docs.github.com/en/rest/reference/checks#create-a-check-run}\n */\ninterface CreateCheckRunParameters {\n /**\n * Adds information from your analysis to specific lines of code.\n * Annotations are visible on GitHub in the **Checks** and **Files changed**\n * tab of the pull request.\n */\n annotations: Annotation[];\n\n /**\n * The final conclusion of the check.\n */\n conclusion: 'failure' | 'success';\n\n /**\n * The name of the check. For example, \"code-coverage\".\n */\n name: string;\n\n /**\n * The summary of the check run. This parameter supports Markdown.\n */\n summary: string;\n\n /**\n * The details of the check run. This parameter supports Markdown.\n */\n text?: string;\n\n /**\n * The title of the check run.\n */\n title: string;\n}\n\n/**\n * Asynchronously creates a GitHub check run with annotations.\n *\n * The first 50 `annotations` are written in full to GitHub.\n *\n * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission\n * must be present on the environment.\n */\nexport const createCheckRun = async ({\n annotations,\n conclusion,\n name,\n summary,\n text,\n title,\n}: CreateCheckRunParameters): Promise<void> => {\n const dir = process.cwd();\n\n const [commitId, { owner, repo }] = await Promise.all([\n Git.getHeadCommitId({ dir }),\n Git.getOwnerAndRepo({ dir }),\n ]);\n\n const client = new Octokit({ auth: apiTokenFromEnvironment() });\n\n await client.checks.create({\n conclusion,\n head_sha: commitId,\n name,\n output: {\n annotations: annotations.slice(0, GITHUB_MAX_ANNOTATIONS),\n summary: createEnrichedSummary(summary, annotations.length),\n text,\n title: suffixTitle(title, annotations.length),\n },\n owner,\n repo,\n });\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAGxB,qBAA0B;AAC1B,UAAqB;AAErB,yBAAwC;AAQxC,MAAM,yBAAyB;AAS/B,MAAM,cAAc,CAAC,OAAe,qBAAqC;AACvE,QAAM,mBACJ,mBAAmB,yBACf,yBACA;AAEN,SAAO,GAAG,cAAU,0BAAU,kBAAkB,YAAY;AAC9D;AAKA,MAAM,wBAAwB,CAC5B,SACA,qBAEA;AAAA,EACE;AAAA,EACA,GAAI,mBAAmB,yBACnB;AAAA,IACE,GAAG,kEAAkE;AAAA,EACvE,IACA,CAAC;AACP,EAAE,KAAK,MAAM;AA+CR,MAAM,iBAAiB,OAAO;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA+C;AAC7C,QAAM,MAAM,QAAQ,IAAI;AAExB,QAAM,CAAC,UAAU,EAAE,OAAO,KAAK,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,IACpD,IAAI,gBAAgB,EAAE,IAAI,CAAC;AAAA,IAC3B,IAAI,gBAAgB,EAAE,IAAI,CAAC;AAAA,EAC7B,CAAC;AAED,QAAM,SAAS,IAAI,oBAAQ,EAAE,UAAM,4CAAwB,EAAE,CAAC;AAE9D,QAAM,OAAO,OAAO,OAAO;AAAA,IACzB;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACN,aAAa,YAAY,MAAM,GAAG,sBAAsB;AAAA,MACxD,SAAS,sBAAsB,SAAS,YAAY,MAAM;AAAA,MAC1D;AAAA,MACA,OAAO,YAAY,OAAO,YAAY,MAAM;AAAA,IAC9C;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/api/jest/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ type DefaultOptions = 'collectCoverage' | 'collectCoverageFrom' | 'coveragePathI
|
|
|
11
11
|
*
|
|
12
12
|
* This concatenates array options like `testPathIgnorePatterns`.
|
|
13
13
|
*/
|
|
14
|
-
export declare const mergePreset: <AdditionalOptions extends "filter" | "json" | "silent" | "cache" | "runtime" | "watch" | "runner" | "projects" | "id" | "automock" | "cacheDirectory" | "clearMocks" | "coveragePathIgnorePatterns" | "dependencyExtractor" | "detectLeaks" | "detectOpenHandles" | "displayName" | "errorOnDeprecated" | "extensionsToTreatAsEsm" | "fakeTimers" | "forceCoverageMatch" | "globalSetup" | "globalTeardown" | "globals" | "haste" | "injectGlobals" | "moduleDirectories" | "moduleFileExtensions" | "moduleNameMapper" | "modulePathIgnorePatterns" | "modulePaths" | "preset" | "prettierPath" | "resetMocks" | "resetModules" | "resolver" | "restoreMocks" | "rootDir" | "roots" | "sandboxInjectedGlobals" | "setupFiles" | "setupFilesAfterEnv" | "skipFilter" | "skipNodeResolution" | "slowTestThreshold" | "snapshotResolver" | "snapshotSerializers" | "snapshotFormat" | "testEnvironment" | "testEnvironmentOptions" | "testMatch" | "testLocationInResults" | "testPathIgnorePatterns" | "testRegex" | "testRunner" | "transform" | "transformIgnorePatterns" | "watchPathIgnorePatterns" | "unmockedModulePathPatterns" | "workerIdleMemoryLimit" | "bail" | "ci" | "changedFilesWithAncestor" | "changedSince" | "collectCoverage" | "collectCoverageFrom" | "coverageDirectory" | "coverageProvider" | "coverageReporters" | "coverageThreshold" | "expand" | "findRelatedTests" | "forceExit" | "reporters" | "logHeapUsage" | "lastCommit" | "listTests" | "maxConcurrency" | "maxWorkers" | "noStackTrace" | "notify" | "notifyMode" | "onlyChanged" | "onlyFailures" | "outputFile" | "passWithNoTests" | "replname" | "runTestsByPath" | "showSeed" | "testFailureExitCode" | "testNamePattern" | "testResultsProcessor" | "testSequencer" | "testTimeout" | "updateSnapshot" | "useStderr" | "verbose" | "watchAll" | "watchman" | "watchPlugins">(options: Pick<Partial<{
|
|
14
|
+
export declare const mergePreset: <AdditionalOptions extends "filter" | "json" | "silent" | "cache" | "runtime" | "watch" | "runner" | "projects" | "id" | "automock" | "cacheDirectory" | "clearMocks" | "coveragePathIgnorePatterns" | "dependencyExtractor" | "detectLeaks" | "detectOpenHandles" | "displayName" | "errorOnDeprecated" | "extensionsToTreatAsEsm" | "fakeTimers" | "forceCoverageMatch" | "globalSetup" | "globalTeardown" | "globals" | "haste" | "injectGlobals" | "moduleDirectories" | "moduleFileExtensions" | "moduleNameMapper" | "modulePathIgnorePatterns" | "modulePaths" | "openHandlesTimeout" | "preset" | "prettierPath" | "resetMocks" | "resetModules" | "resolver" | "restoreMocks" | "rootDir" | "roots" | "sandboxInjectedGlobals" | "setupFiles" | "setupFilesAfterEnv" | "skipFilter" | "skipNodeResolution" | "slowTestThreshold" | "snapshotResolver" | "snapshotSerializers" | "snapshotFormat" | "testEnvironment" | "testEnvironmentOptions" | "testMatch" | "testLocationInResults" | "testPathIgnorePatterns" | "testRegex" | "testRunner" | "transform" | "transformIgnorePatterns" | "watchPathIgnorePatterns" | "unmockedModulePathPatterns" | "workerIdleMemoryLimit" | "bail" | "ci" | "changedFilesWithAncestor" | "changedSince" | "collectCoverage" | "collectCoverageFrom" | "coverageDirectory" | "coverageProvider" | "coverageReporters" | "coverageThreshold" | "expand" | "findRelatedTests" | "forceExit" | "reporters" | "logHeapUsage" | "lastCommit" | "listTests" | "maxConcurrency" | "maxWorkers" | "noStackTrace" | "notify" | "notifyMode" | "onlyChanged" | "onlyFailures" | "outputFile" | "passWithNoTests" | "randomize" | "replname" | "runTestsByPath" | "showSeed" | "testFailureExitCode" | "testNamePattern" | "testResultsProcessor" | "testSequencer" | "testTimeout" | "updateSnapshot" | "useStderr" | "verbose" | "watchAll" | "watchman" | "watchPlugins" | "workerThreads">(options: Pick<Partial<{
|
|
15
15
|
automock: boolean;
|
|
16
16
|
bail: number | boolean;
|
|
17
17
|
cache: boolean;
|
|
@@ -68,11 +68,13 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
68
68
|
notifyMode: string;
|
|
69
69
|
onlyChanged: boolean;
|
|
70
70
|
onlyFailures: boolean;
|
|
71
|
+
openHandlesTimeout: number;
|
|
71
72
|
outputFile: string;
|
|
72
73
|
passWithNoTests: boolean;
|
|
73
74
|
preset: string | null | undefined;
|
|
74
75
|
prettierPath: string | null | undefined;
|
|
75
76
|
projects: (string | Config.InitialProjectOptions)[];
|
|
77
|
+
randomize: boolean;
|
|
76
78
|
replname: string | null | undefined;
|
|
77
79
|
resetMocks: boolean;
|
|
78
80
|
resetModules: boolean;
|
|
@@ -140,5 +142,6 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
140
142
|
watchman: boolean;
|
|
141
143
|
watchPlugins: (string | [string, Record<string, unknown>])[];
|
|
142
144
|
workerIdleMemoryLimit: string | number;
|
|
145
|
+
workerThreads: boolean;
|
|
143
146
|
}>, DefaultOptions | AdditionalOptions>) => Config.InitialOptions;
|
|
144
147
|
export {};
|
|
@@ -45,40 +45,16 @@ const runESLint = async (mode, logger) => {
|
|
|
45
45
|
logger.debug("Initialising ESLint...");
|
|
46
46
|
const engine = new import_eslint.ESLint({
|
|
47
47
|
cache: true,
|
|
48
|
-
extensions: [
|
|
49
|
-
"cjs",
|
|
50
|
-
"cts",
|
|
51
|
-
"js",
|
|
52
|
-
"jsx",
|
|
53
|
-
"mjs",
|
|
54
|
-
"mts",
|
|
55
|
-
"ts",
|
|
56
|
-
"tsx",
|
|
57
|
-
"yaml",
|
|
58
|
-
"yml"
|
|
59
|
-
],
|
|
60
48
|
fix: mode === "format",
|
|
61
49
|
reportUnusedDisableDirectives: "error"
|
|
62
50
|
});
|
|
63
51
|
const cwd = process.cwd();
|
|
64
52
|
logger.debug("Processing files...");
|
|
65
53
|
const start = process.hrtime.bigint();
|
|
66
|
-
const ogConsoleError = console.error;
|
|
67
|
-
console.error = (...args) => {
|
|
68
|
-
if (args[0] !== // `eslint-plugin-react` prints this annoying error on non-React repos.
|
|
69
|
-
// We still want to support React linting for repos that have React code,
|
|
70
|
-
// so we have to manually suppress it.
|
|
71
|
-
//
|
|
72
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/7484acaca8351a8568fa99344bc811c5cd8396bd/lib/util/version.js#L61-L65
|
|
73
|
-
'Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming latest React version for linting.') {
|
|
74
|
-
ogConsoleError(...args);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
54
|
const [formatter, results] = await Promise.all([
|
|
78
55
|
engine.loadFormatter(),
|
|
79
56
|
engine.lintFiles(".")
|
|
80
57
|
]);
|
|
81
|
-
console.error = ogConsoleError;
|
|
82
58
|
const end = process.hrtime.bigint();
|
|
83
59
|
logger.plain(
|
|
84
60
|
`Processed ${(0, import_logging.pluralise)(results.length, "file")} in ${logger.timing(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/adapter/eslint.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport type { Linter } from 'eslint';\nimport { ESLint } from 'eslint';\n\nimport type { Logger } from '../../utils/logging';\nimport { pluralise } from '../../utils/logging';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return chalk.red('\u25CB');\n }\n\n return result.warningCount ? chalk.yellow('\u25CD') : chalk.green('\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const engine = new ESLint({\n cache: true,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAElB,oBAAuB;AAGvB,qBAA0B;AAE1B,MAAM,kBAAkB,CAAC,WAA8B;AACrD,MAAI,OAAO,YAAY;AACrB,WAAO,aAAAA,QAAM,IAAI,QAAG;AAAA,EACtB;AAEA,SAAO,OAAO,eAAe,aAAAA,QAAM,OAAO,QAAG,IAAI,aAAAA,QAAM,MAAM,QAAG;AAClE;AAeO,MAAM,YAAY,OACvB,MACA,WAC0B;AAC1B,SAAO,MAAM,wBAAwB;AAErC,QAAM,SAAS,IAAI,qBAAO;AAAA,IACxB,OAAO;AAAA,IACP,
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport type { Linter } from 'eslint';\nimport { ESLint } from 'eslint';\n\nimport type { Logger } from '../../utils/logging';\nimport { pluralise } from '../../utils/logging';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return chalk.red('\u25CB');\n }\n\n return result.warningCount ? chalk.yellow('\u25CD') : chalk.green('\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const engine = new ESLint({\n cache: true,\n fix: mode === 'format',\n reportUnusedDisableDirectives: 'error',\n });\n\n const cwd = process.cwd();\n\n logger.debug('Processing files...');\n\n const start = process.hrtime.bigint();\n\n const [formatter, results] = await Promise.all([\n engine.loadFormatter(),\n engine.lintFiles('.'),\n ]);\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(results.length, 'file')} in ${logger.timing(\n start,\n end,\n )}.`,\n );\n\n const errors: ESLintResult[] = [];\n const warnings: ESLintResult[] = [];\n let fixable = false;\n\n for (const result of results) {\n const relativePath = path.relative(cwd, result.filePath);\n if (result.fixableErrorCount + result.fixableWarningCount) {\n fixable = true;\n }\n\n if (result.errorCount) {\n errors.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n if (result.warningCount) {\n warnings.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n logger.debug(symbolForResult(result), relativePath);\n }\n\n const ok = errors.length === 0;\n\n await ESLint.outputFixes(results);\n\n const output = await formatter.format(results);\n\n if (output) {\n logger.plain(output);\n }\n\n return { errors, fixable, ok, output, warnings };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAElB,oBAAuB;AAGvB,qBAA0B;AAE1B,MAAM,kBAAkB,CAAC,WAA8B;AACrD,MAAI,OAAO,YAAY;AACrB,WAAO,aAAAA,QAAM,IAAI,QAAG;AAAA,EACtB;AAEA,SAAO,OAAO,eAAe,aAAAA,QAAM,OAAO,QAAG,IAAI,aAAAA,QAAM,MAAM,QAAG;AAClE;AAeO,MAAM,YAAY,OACvB,MACA,WAC0B;AAC1B,SAAO,MAAM,wBAAwB;AAErC,QAAM,SAAS,IAAI,qBAAO;AAAA,IACxB,OAAO;AAAA,IACP,KAAK,SAAS;AAAA,IACd,+BAA+B;AAAA,EACjC,CAAC;AAED,QAAM,MAAM,QAAQ,IAAI;AAExB,SAAO,MAAM,qBAAqB;AAElC,QAAM,QAAQ,QAAQ,OAAO,OAAO;AAEpC,QAAM,CAAC,WAAW,OAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC7C,OAAO,cAAc;AAAA,IACrB,OAAO,UAAU,GAAG;AAAA,EACtB,CAAC;AAED,QAAM,MAAM,QAAQ,OAAO,OAAO;AAElC,SAAO;AAAA,IACL,iBAAa,0BAAU,QAAQ,QAAQ,MAAM,QAAQ,OAAO;AAAA,MAC1D;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,SAAyB,CAAC;AAChC,QAAM,WAA2B,CAAC;AAClC,MAAI,UAAU;AAEd,aAAW,UAAU,SAAS;AAC5B,UAAM,eAAe,YAAAC,QAAK,SAAS,KAAK,OAAO,QAAQ;AACvD,QAAI,OAAO,oBAAoB,OAAO,qBAAqB;AACzD,gBAAU;AAAA,IACZ;AAEA,QAAI,OAAO,YAAY;AACrB,aAAO,KAAK;AAAA,QACV,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,QAAI,OAAO,cAAc;AACvB,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,WAAO,MAAM,gBAAgB,MAAM,GAAG,YAAY;AAAA,EACpD;AAEA,QAAM,KAAK,OAAO,WAAW;AAE7B,QAAM,qBAAO,YAAY,OAAO;AAEhC,QAAM,SAAS,MAAM,UAAU,OAAO,OAAO;AAE7C,MAAI,QAAQ;AACV,WAAO,MAAM,MAAM;AAAA,EACrB;AAEA,SAAO,EAAE,QAAQ,SAAS,IAAI,QAAQ,SAAS;AACjD;",
|
|
6
6
|
"names": ["chalk", "path"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Color } from 'chalk';
|
|
2
|
+
import { type Logger } from '../../utils/logging';
|
|
3
|
+
export declare const copyAssets: (destinationDir: string, logger?: Logger) => Promise<void>;
|
|
4
|
+
interface CopyAssetsConfig {
|
|
5
|
+
outDir: string;
|
|
6
|
+
name: string;
|
|
7
|
+
prefixColor: typeof Color;
|
|
8
|
+
}
|
|
9
|
+
export declare const copyAssetsConcurrently: (configs: CopyAssetsConfig[]) => Promise<void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var assets_exports = {};
|
|
30
|
+
__export(assets_exports, {
|
|
31
|
+
copyAssets: () => copyAssets,
|
|
32
|
+
copyAssetsConcurrently: () => copyAssetsConcurrently
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(assets_exports);
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_chalk = __toESM(require("chalk"));
|
|
37
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
38
|
+
var import_copy = require("../../utils/copy");
|
|
39
|
+
var import_dir = require("../../utils/dir");
|
|
40
|
+
var import_logging = require("../../utils/logging");
|
|
41
|
+
var import_manifest = require("../../utils/manifest");
|
|
42
|
+
const copyAssets = async (destinationDir, logger = import_logging.log) => {
|
|
43
|
+
const manifest = await (0, import_manifest.getConsumerManifest)();
|
|
44
|
+
if (!manifest) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const assets = await (0, import_manifest.getPropFromConsumerManifest)("assets");
|
|
48
|
+
if (!assets) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const entryPoint = await (0, import_manifest.getEntryPointFromManifest)();
|
|
52
|
+
if (!entryPoint) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const pathSegments = entryPoint.split(import_path.default.sep);
|
|
56
|
+
const srcDir = pathSegments.length > 1 ? pathSegments[0] : "";
|
|
57
|
+
const resolvedSrcDir = import_path.default.resolve(import_path.default.dirname(manifest.path), srcDir);
|
|
58
|
+
const resolvedDestinationDir = import_path.default.resolve(
|
|
59
|
+
import_path.default.dirname(manifest.path),
|
|
60
|
+
destinationDir
|
|
61
|
+
);
|
|
62
|
+
const allFiles = await (0, import_dir.crawlDirectory)(resolvedSrcDir);
|
|
63
|
+
const filesByPattern = (0, import_dir.buildPatternToFilepathMap)(assets, allFiles, {
|
|
64
|
+
cwd: resolvedSrcDir,
|
|
65
|
+
dot: true
|
|
66
|
+
});
|
|
67
|
+
const matchedFiles = Array.from(
|
|
68
|
+
new Set(Object.values(filesByPattern).flat())
|
|
69
|
+
);
|
|
70
|
+
await Promise.all(
|
|
71
|
+
matchedFiles.map(async (filename) => {
|
|
72
|
+
logger.subtle(`Copying ${filename}`);
|
|
73
|
+
await import_fs_extra.default.promises.mkdir(
|
|
74
|
+
import_path.default.dirname(import_path.default.join(resolvedDestinationDir, filename)),
|
|
75
|
+
{ recursive: true }
|
|
76
|
+
);
|
|
77
|
+
await (0, import_copy.copyFile)(
|
|
78
|
+
import_path.default.join(resolvedSrcDir, filename),
|
|
79
|
+
import_path.default.join(resolvedDestinationDir, filename),
|
|
80
|
+
{ processors: [] }
|
|
81
|
+
);
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
const copyAssetsConcurrently = async (configs) => {
|
|
86
|
+
const maxNameLength = configs.reduce(
|
|
87
|
+
(length, command) => Math.max(length, command.name.length),
|
|
88
|
+
0
|
|
89
|
+
);
|
|
90
|
+
await Promise.all(
|
|
91
|
+
configs.map(
|
|
92
|
+
({ outDir, name, prefixColor }) => copyAssets(
|
|
93
|
+
outDir,
|
|
94
|
+
(0, import_logging.createLogger)(
|
|
95
|
+
false,
|
|
96
|
+
import_chalk.default[prefixColor](`${name.padEnd(maxNameLength)} \u2502`)
|
|
97
|
+
)
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
copyAssets,
|
|
105
|
+
copyAssetsConcurrently
|
|
106
|
+
});
|
|
107
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/cli/build/assets.ts"],
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport type { Color } from 'chalk';\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\n\nimport { copyFile } from '../../utils/copy';\nimport { buildPatternToFilepathMap, crawlDirectory } from '../../utils/dir';\nimport { type Logger, createLogger, log } from '../../utils/logging';\nimport {\n getConsumerManifest,\n getEntryPointFromManifest,\n getPropFromConsumerManifest,\n} from '../../utils/manifest';\n\nexport const copyAssets = async (\n destinationDir: string,\n logger: Logger = log,\n) => {\n const manifest = await getConsumerManifest();\n if (!manifest) {\n return;\n }\n\n const assets = await getPropFromConsumerManifest<string, string[]>('assets');\n if (!assets) {\n return;\n }\n\n const entryPoint = await getEntryPointFromManifest();\n if (!entryPoint) {\n return;\n }\n\n const pathSegments = entryPoint.split(path.sep);\n const srcDir = pathSegments.length > 1 ? pathSegments[0] : '';\n const resolvedSrcDir = path.resolve(path.dirname(manifest.path), srcDir);\n const resolvedDestinationDir = path.resolve(\n path.dirname(manifest.path),\n destinationDir,\n );\n\n const allFiles = await crawlDirectory(resolvedSrcDir);\n const filesByPattern = buildPatternToFilepathMap(assets, allFiles, {\n cwd: resolvedSrcDir,\n dot: true,\n });\n const matchedFiles = Array.from(\n new Set(Object.values(filesByPattern).flat()),\n );\n\n await Promise.all(\n matchedFiles.map(async (filename) => {\n logger.subtle(`Copying ${filename}`);\n\n await fs.promises.mkdir(\n path.dirname(path.join(resolvedDestinationDir, filename)),\n { recursive: true },\n );\n await copyFile(\n path.join(resolvedSrcDir, filename),\n path.join(resolvedDestinationDir, filename),\n { processors: [] },\n );\n }),\n );\n};\n\ninterface CopyAssetsConfig {\n outDir: string;\n name: string;\n prefixColor: typeof Color;\n}\n\nexport const copyAssetsConcurrently = async (configs: CopyAssetsConfig[]) => {\n const maxNameLength = configs.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n await Promise.all(\n configs.map(({ outDir, name, prefixColor }) =>\n copyAssets(\n outDir,\n createLogger(\n false,\n chalk[prefixColor](`${name.padEnd(maxNameLength)} \u2502`),\n ),\n ),\n ),\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAGjB,mBAAkB;AAClB,sBAAe;AAEf,kBAAyB;AACzB,iBAA0D;AAC1D,qBAA+C;AAC/C,sBAIO;AAEA,MAAM,aAAa,OACxB,gBACA,SAAiB,uBACd;AACH,QAAM,WAAW,UAAM,qCAAoB;AAC3C,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAEA,QAAM,SAAS,UAAM,6CAA8C,QAAQ;AAC3E,MAAI,CAAC,QAAQ;AACX;AAAA,EACF;AAEA,QAAM,aAAa,UAAM,2CAA0B;AACnD,MAAI,CAAC,YAAY;AACf;AAAA,EACF;AAEA,QAAM,eAAe,WAAW,MAAM,YAAAA,QAAK,GAAG;AAC9C,QAAM,SAAS,aAAa,SAAS,IAAI,aAAa,CAAC,IAAI;AAC3D,QAAM,iBAAiB,YAAAA,QAAK,QAAQ,YAAAA,QAAK,QAAQ,SAAS,IAAI,GAAG,MAAM;AACvE,QAAM,yBAAyB,YAAAA,QAAK;AAAA,IAClC,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAAA,IAC1B;AAAA,EACF;AAEA,QAAM,WAAW,UAAM,2BAAe,cAAc;AACpD,QAAM,qBAAiB,sCAA0B,QAAQ,UAAU;AAAA,IACjE,KAAK;AAAA,IACL,KAAK;AAAA,EACP,CAAC;AACD,QAAM,eAAe,MAAM;AAAA,IACzB,IAAI,IAAI,OAAO,OAAO,cAAc,EAAE,KAAK,CAAC;AAAA,EAC9C;AAEA,QAAM,QAAQ;AAAA,IACZ,aAAa,IAAI,OAAO,aAAa;AACnC,aAAO,OAAO,WAAW,UAAU;AAEnC,YAAM,gBAAAC,QAAG,SAAS;AAAA,QAChB,YAAAD,QAAK,QAAQ,YAAAA,QAAK,KAAK,wBAAwB,QAAQ,CAAC;AAAA,QACxD,EAAE,WAAW,KAAK;AAAA,MACpB;AACA,gBAAM;AAAA,QACJ,YAAAA,QAAK,KAAK,gBAAgB,QAAQ;AAAA,QAClC,YAAAA,QAAK,KAAK,wBAAwB,QAAQ;AAAA,QAC1C,EAAE,YAAY,CAAC,EAAE;AAAA,MACnB;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAQO,MAAM,yBAAyB,OAAO,YAAgC;AAC3E,QAAM,gBAAgB,QAAQ;AAAA,IAC5B,CAAC,QAAQ,YAAY,KAAK,IAAI,QAAQ,QAAQ,KAAK,MAAM;AAAA,IACzD;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,QAAQ;AAAA,MAAI,CAAC,EAAE,QAAQ,MAAM,YAAY,MACvC;AAAA,QACE;AAAA,YACA;AAAA,UACE;AAAA,UACA,aAAAE,QAAM,WAAW,EAAE,GAAG,KAAK,OAAO,aAAa,UAAK;AAAA,QACtD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["path", "fs", "chalk"]
|
|
7
|
+
}
|
package/lib/cli/build/esbuild.js
CHANGED
|
@@ -34,15 +34,10 @@ module.exports = __toCommonJS(esbuild_exports);
|
|
|
34
34
|
var import_util = require("util");
|
|
35
35
|
var import_tsconfig_paths = __toESM(require("@esbuild-plugins/tsconfig-paths"));
|
|
36
36
|
var import_esbuild = require("esbuild");
|
|
37
|
-
var import_typescript =
|
|
37
|
+
var import_typescript = require("typescript");
|
|
38
38
|
var import_logging = require("../../utils/logging");
|
|
39
39
|
var import_args = require("./args");
|
|
40
40
|
var import_tsc = require("./tsc");
|
|
41
|
-
const formatHost = {
|
|
42
|
-
getCanonicalFileName: (fileName) => fileName,
|
|
43
|
-
getCurrentDirectory: import_typescript.default.sys.getCurrentDirectory.bind(void 0),
|
|
44
|
-
getNewLine: () => import_typescript.default.sys.newLine
|
|
45
|
-
};
|
|
46
41
|
const esbuild = async ({ debug }, args = process.argv.slice(2)) => {
|
|
47
42
|
const log = (0, import_logging.createLogger)(debug);
|
|
48
43
|
const tscArgs = (0, import_args.parseTscArgs)(args);
|
|
@@ -53,42 +48,8 @@ const esbuild = async ({ debug }, args = process.argv.slice(2)) => {
|
|
|
53
48
|
process.exitCode = 1;
|
|
54
49
|
return;
|
|
55
50
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"tsconfig",
|
|
59
|
-
...tscArgs.project ? ["--project", tscArgs.project] : []
|
|
60
|
-
)
|
|
61
|
-
);
|
|
62
|
-
log.debug(tscArgs.pathname);
|
|
63
|
-
const tsconfigFile = import_typescript.default.findConfigFile(
|
|
64
|
-
tscArgs.dirname,
|
|
65
|
-
import_typescript.default.sys.fileExists.bind(void 0),
|
|
66
|
-
tscArgs.basename
|
|
67
|
-
);
|
|
68
|
-
if (!tsconfigFile) {
|
|
69
|
-
log.err(`Could not find ${tscArgs.pathname}.`);
|
|
70
|
-
process.exitCode = 1;
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const readConfigFile = import_typescript.default.readConfigFile(
|
|
74
|
-
tsconfigFile,
|
|
75
|
-
import_typescript.default.sys.readFile.bind(void 0)
|
|
76
|
-
);
|
|
77
|
-
if (readConfigFile.error) {
|
|
78
|
-
log.err(`Could not read ${tscArgs.pathname}.`);
|
|
79
|
-
log.subtle(import_typescript.default.formatDiagnostic(readConfigFile.error, formatHost));
|
|
80
|
-
process.exitCode = 1;
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const parsedCommandLine = import_typescript.default.parseJsonConfigFileContent(
|
|
84
|
-
readConfigFile.config,
|
|
85
|
-
import_typescript.default.sys,
|
|
86
|
-
tscArgs.dirname
|
|
87
|
-
);
|
|
88
|
-
if (parsedCommandLine.errors.length) {
|
|
89
|
-
log.err(`Could not parse ${tscArgs.pathname}.`);
|
|
90
|
-
log.subtle(import_typescript.default.formatDiagnostics(parsedCommandLine.errors, formatHost));
|
|
91
|
-
process.exitCode = 1;
|
|
51
|
+
const parsedCommandLine = (0, import_tsc.readTsconfig)(args, log);
|
|
52
|
+
if (!parsedCommandLine || process.exitCode) {
|
|
92
53
|
return;
|
|
93
54
|
}
|
|
94
55
|
const { fileNames: entryPoints, options: compilerOptions } = parsedCommandLine;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/build/esbuild.ts"],
|
|
4
|
-
"sourcesContent": ["import { inspect } from 'util';\n\nimport tsconfigPaths from '@esbuild-plugins/tsconfig-paths';\nimport { build } from 'esbuild';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAA0B;AAC1B,qBAAsB;AACtB,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\n\nimport tsconfigPaths from '@esbuild-plugins/tsconfig-paths';\nimport { build } from 'esbuild';\nimport { ModuleKind, ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport { createLogger } from '../../utils/logging';\n\nimport { parseTscArgs } from './args';\nimport { readTsconfig, tsc } from './tsc';\n\ninterface EsbuildParameters {\n debug: boolean;\n}\n\nexport const esbuild = async (\n { debug }: EsbuildParameters,\n args = process.argv.slice(2),\n) => {\n const log = createLogger(debug);\n\n const tscArgs = parseTscArgs(args);\n\n if (tscArgs.build) {\n log.err(\n 'skuba does not currently support the tsc --build flag with esbuild',\n );\n process.exitCode = 1;\n return;\n }\n\n const parsedCommandLine = readTsconfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { fileNames: entryPoints, options: compilerOptions } =\n parsedCommandLine;\n\n log.debug(log.bold('Files'));\n entryPoints.forEach((filepath) => log.debug(filepath));\n\n log.debug(log.bold('Compiler options'));\n log.debug(inspect(compilerOptions));\n\n const start = process.hrtime.bigint();\n\n // TODO: support `bundle`, `minify`, `splitting`, `treeShaking`\n const bundle = false;\n\n await build({\n bundle,\n entryPoints,\n format: compilerOptions.module === ModuleKind.CommonJS ? 'cjs' : undefined,\n outdir: compilerOptions.outDir,\n logLevel: debug ? 'debug' : 'info',\n logLimit: 0,\n platform:\n compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs\n ? 'node'\n : undefined,\n plugins: bundle\n ? []\n : [\n // evanw/esbuild#394\n tsconfigPaths({\n tsconfig: { baseUrl: compilerOptions.baseUrl, compilerOptions },\n }),\n ],\n sourcemap: compilerOptions.sourceMap,\n target: compilerOptions.target\n ? ScriptTarget[compilerOptions.target].toLocaleLowerCase()\n : undefined,\n tsconfig: tscArgs.pathname,\n });\n\n const end = process.hrtime.bigint();\n\n log.plain(`Built in ${log.timing(start, end)}.`);\n\n if (compilerOptions.declaration) {\n await tsc([\n '--declaration',\n '--emitDeclarationOnly',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ]);\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAA0B;AAC1B,qBAAsB;AACtB,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,iBAAkC;AAM3B,MAAM,UAAU,OACrB,EAAE,MAAM,GACR,OAAO,QAAQ,KAAK,MAAM,CAAC,MACxB;AACH,QAAM,UAAM,6BAAa,KAAK;AAE9B,QAAM,cAAU,0BAAa,IAAI;AAEjC,MAAI,QAAQ,OAAO;AACjB,QAAI;AAAA,MACF;AAAA,IACF;AACA,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,QAAM,wBAAoB,yBAAa,MAAM,GAAG;AAEhD,MAAI,CAAC,qBAAqB,QAAQ,UAAU;AAC1C;AAAA,EACF;AAEA,QAAM,EAAE,WAAW,aAAa,SAAS,gBAAgB,IACvD;AAEF,MAAI,MAAM,IAAI,KAAK,OAAO,CAAC;AAC3B,cAAY,QAAQ,CAAC,aAAa,IAAI,MAAM,QAAQ,CAAC;AAErD,MAAI,MAAM,IAAI,KAAK,kBAAkB,CAAC;AACtC,MAAI,UAAM,qBAAQ,eAAe,CAAC;AAElC,QAAM,QAAQ,QAAQ,OAAO,OAAO;AAGpC,QAAM,SAAS;AAEf,YAAM,sBAAM;AAAA,IACV;AAAA,IACA;AAAA,IACA,QAAQ,gBAAgB,WAAW,6BAAW,WAAW,QAAQ;AAAA,IACjE,QAAQ,gBAAgB;AAAA,IACxB,UAAU,QAAQ,UAAU;AAAA,IAC5B,UAAU;AAAA,IACV,UACE,gBAAgB,qBAAqB,uCAAqB,SACtD,SACA;AAAA,IACN,SAAS,SACL,CAAC,IACD;AAAA;AAAA,UAEE,sBAAAA,SAAc;AAAA,QACZ,UAAU,EAAE,SAAS,gBAAgB,SAAS,gBAAgB;AAAA,MAChE,CAAC;AAAA,IACH;AAAA,IACJ,WAAW,gBAAgB;AAAA,IAC3B,QAAQ,gBAAgB,SACpB,+BAAa,gBAAgB,MAAM,EAAE,kBAAkB,IACvD;AAAA,IACJ,UAAU,QAAQ;AAAA,EACpB,CAAC;AAED,QAAM,MAAM,QAAQ,OAAO,OAAO;AAElC,MAAI,MAAM,YAAY,IAAI,OAAO,OAAO,GAAG,IAAI;AAE/C,MAAI,gBAAgB,aAAa;AAC/B,cAAM,gBAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": ["tsconfigPaths"]
|
|
7
7
|
}
|
package/lib/cli/build/index.js
CHANGED
|
@@ -36,6 +36,7 @@ var import_args = require("../../utils/args");
|
|
|
36
36
|
var import_logging = require("../../utils/logging");
|
|
37
37
|
var import_manifest = require("../../utils/manifest");
|
|
38
38
|
var import_addEmptyExports = require("../configure/addEmptyExports");
|
|
39
|
+
var import_assets = require("./assets");
|
|
39
40
|
var import_esbuild = require("./esbuild");
|
|
40
41
|
var import_tsc = require("./tsc");
|
|
41
42
|
const build = async (args = process.argv.slice(2)) => {
|
|
@@ -46,13 +47,13 @@ const build = async (args = process.argv.slice(2)) => {
|
|
|
46
47
|
const debug = (0, import_args.hasDebugFlag)(args);
|
|
47
48
|
import_logging.log.plain(import_chalk.default.yellow("esbuild"));
|
|
48
49
|
await (0, import_esbuild.esbuild)({ debug }, args);
|
|
49
|
-
|
|
50
|
+
break;
|
|
50
51
|
}
|
|
51
52
|
case void 0:
|
|
52
53
|
case "tsc": {
|
|
53
54
|
import_logging.log.plain(import_chalk.default.blue("tsc"));
|
|
54
55
|
await (0, import_tsc.tsc)(args);
|
|
55
|
-
|
|
56
|
+
break;
|
|
56
57
|
}
|
|
57
58
|
default: {
|
|
58
59
|
import_logging.log.err(
|
|
@@ -65,6 +66,15 @@ const build = async (args = process.argv.slice(2)) => {
|
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
const parsedCommandLine = (0, import_tsc.readTsconfig)(args, import_logging.log);
|
|
70
|
+
if (!parsedCommandLine || process.exitCode) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const { options: compilerOptions } = parsedCommandLine;
|
|
74
|
+
if (!compilerOptions.outDir) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
await (0, import_assets.copyAssets)(compilerOptions.outDir);
|
|
68
78
|
};
|
|
69
79
|
// Annotate the CommonJS export names for ESM import in node:
|
|
70
80
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/build/index.ts"],
|
|
4
|
-
"sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../../utils/args';\nimport { log } from '../../utils/logging';\nimport { getStringPropFromConsumerManifest } from '../../utils/manifest';\nimport { tryAddEmptyExports } from '../configure/addEmptyExports';\n\nimport { esbuild } from './esbuild';\nimport { tsc } from './tsc';\n\nexport const build = async (args = process.argv.slice(2)) => {\n await tryAddEmptyExports();\n\n // TODO: define a unified `package.json#/skuba` schema and parser so we don't\n // need all these messy lookups.\n const tool = await getStringPropFromConsumerManifest('build');\n\n switch (tool) {\n case 'esbuild': {\n const debug = hasDebugFlag(args);\n\n log.plain(chalk.yellow('esbuild'));\n await esbuild({ debug }, args);\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA6B;AAC7B,qBAAoB;AACpB,sBAAkD;AAClD,6BAAmC;AAEnC,qBAAwB;AACxB,
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../../utils/args';\nimport { log } from '../../utils/logging';\nimport { getStringPropFromConsumerManifest } from '../../utils/manifest';\nimport { tryAddEmptyExports } from '../configure/addEmptyExports';\n\nimport { copyAssets } from './assets';\nimport { esbuild } from './esbuild';\nimport { readTsconfig, tsc } from './tsc';\n\nexport const build = async (args = process.argv.slice(2)) => {\n await tryAddEmptyExports();\n\n // TODO: define a unified `package.json#/skuba` schema and parser so we don't\n // need all these messy lookups.\n const tool = await getStringPropFromConsumerManifest('build');\n\n switch (tool) {\n case 'esbuild': {\n const debug = hasDebugFlag(args);\n\n log.plain(chalk.yellow('esbuild'));\n await esbuild({ debug }, args);\n break;\n }\n\n // TODO: flip the default case over to `esbuild` in skuba vNext.\n case undefined:\n case 'tsc': {\n log.plain(chalk.blue('tsc'));\n await tsc(args);\n break;\n }\n\n default: {\n log.err(\n 'We don\u2019t support the build tool specified in your',\n log.bold('package.json'),\n 'yet:',\n );\n log.err(log.subtle(JSON.stringify({ skuba: { build: tool } }, null, 2)));\n process.exitCode = 1;\n return;\n }\n }\n\n const parsedCommandLine = readTsconfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { options: compilerOptions } = parsedCommandLine;\n\n if (!compilerOptions.outDir) {\n return;\n }\n\n await copyAssets(compilerOptions.outDir);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA6B;AAC7B,qBAAoB;AACpB,sBAAkD;AAClD,6BAAmC;AAEnC,oBAA2B;AAC3B,qBAAwB;AACxB,iBAAkC;AAE3B,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAC3D,YAAM,2CAAmB;AAIzB,QAAM,OAAO,UAAM,mDAAkC,OAAO;AAE5D,UAAQ,MAAM;AAAA,IACZ,KAAK,WAAW;AACd,YAAM,YAAQ,0BAAa,IAAI;AAE/B,yBAAI,MAAM,aAAAA,QAAM,OAAO,SAAS,CAAC;AACjC,gBAAM,wBAAQ,EAAE,MAAM,GAAG,IAAI;AAC7B;AAAA,IACF;AAAA,IAGA,KAAK;AAAA,IACL,KAAK,OAAO;AACV,yBAAI,MAAM,aAAAA,QAAM,KAAK,KAAK,CAAC;AAC3B,gBAAM,gBAAI,IAAI;AACd;AAAA,IACF;AAAA,IAEA,SAAS;AACP,yBAAI;AAAA,QACF;AAAA,QACA,mBAAI,KAAK,cAAc;AAAA,QACvB;AAAA,MACF;AACA,yBAAI,IAAI,mBAAI,OAAO,KAAK,UAAU,EAAE,OAAO,EAAE,OAAO,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;AACvE,cAAQ,WAAW;AACnB;AAAA,IACF;AAAA,EACF;AAEA,QAAM,wBAAoB,yBAAa,MAAM,kBAAG;AAEhD,MAAI,CAAC,qBAAqB,QAAQ,UAAU;AAC1C;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,gBAAgB,IAAI;AAErC,MAAI,CAAC,gBAAgB,QAAQ;AAC3B;AAAA,EACF;AAEA,YAAM,0BAAW,gBAAgB,MAAM;AACzC;",
|
|
6
6
|
"names": ["chalk"]
|
|
7
7
|
}
|
package/lib/cli/build/tsc.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { Logger } from '../../utils/logging';
|
|
1
3
|
export declare const tsc: (args?: string[]) => Promise<import("execa").ExecaReturnValue<string>>;
|
|
4
|
+
export declare const readTsconfig: (args: string[] | undefined, log: Logger) => ts.ParsedCommandLine | undefined;
|
package/lib/cli/build/tsc.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,22 +17,86 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var tsc_exports = {};
|
|
20
30
|
__export(tsc_exports, {
|
|
31
|
+
readTsconfig: () => readTsconfig,
|
|
21
32
|
tsc: () => tsc
|
|
22
33
|
});
|
|
23
34
|
module.exports = __toCommonJS(tsc_exports);
|
|
35
|
+
var import_typescript = __toESM(require("typescript"));
|
|
24
36
|
var import_exec = require("../../utils/exec");
|
|
25
37
|
var import_args = require("./args");
|
|
26
38
|
const DEFAULT_ARGS = ["--project", "tsconfig.build.json"];
|
|
39
|
+
const formatHost = {
|
|
40
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
41
|
+
getCurrentDirectory: import_typescript.default.sys.getCurrentDirectory.bind(void 0),
|
|
42
|
+
getNewLine: () => import_typescript.default.sys.newLine
|
|
43
|
+
};
|
|
44
|
+
const tsconfigCache = /* @__PURE__ */ new Map();
|
|
45
|
+
const computeCacheKey = (args) => Array.from(args).sort().toString();
|
|
27
46
|
const tsc = async (args = process.argv.slice(2)) => {
|
|
28
47
|
const tscArgs = (0, import_args.parseTscArgs)(args);
|
|
29
48
|
const defaultArgs = tscArgs.build || tscArgs.project ? [] : DEFAULT_ARGS;
|
|
30
49
|
return (0, import_exec.exec)("tsc", ...defaultArgs, ...args);
|
|
31
50
|
};
|
|
51
|
+
const readTsconfig = (args = process.argv.slice(2), log) => {
|
|
52
|
+
const tscArgs = (0, import_args.parseTscArgs)(args);
|
|
53
|
+
let parsedCommandLine = tsconfigCache.get(computeCacheKey(args));
|
|
54
|
+
if (!parsedCommandLine) {
|
|
55
|
+
log.debug(
|
|
56
|
+
log.bold(
|
|
57
|
+
"tsconfig",
|
|
58
|
+
...tscArgs.project ? ["--project", tscArgs.project] : []
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
log.debug(tscArgs.pathname);
|
|
62
|
+
const tsconfigFile = import_typescript.default.findConfigFile(
|
|
63
|
+
tscArgs.dirname,
|
|
64
|
+
import_typescript.default.sys.fileExists.bind(void 0),
|
|
65
|
+
tscArgs.basename
|
|
66
|
+
);
|
|
67
|
+
if (!tsconfigFile) {
|
|
68
|
+
log.err(`Could not find ${tscArgs.pathname}.`);
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const readConfigFile = import_typescript.default.readConfigFile(
|
|
73
|
+
tsconfigFile,
|
|
74
|
+
import_typescript.default.sys.readFile.bind(void 0)
|
|
75
|
+
);
|
|
76
|
+
if (readConfigFile.error) {
|
|
77
|
+
log.err(`Could not read ${tscArgs.pathname}.`);
|
|
78
|
+
log.subtle(import_typescript.default.formatDiagnostic(readConfigFile.error, formatHost));
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
parsedCommandLine = import_typescript.default.parseJsonConfigFileContent(
|
|
83
|
+
readConfigFile.config,
|
|
84
|
+
import_typescript.default.sys,
|
|
85
|
+
tscArgs.dirname
|
|
86
|
+
);
|
|
87
|
+
tsconfigCache.set(computeCacheKey(args), parsedCommandLine);
|
|
88
|
+
}
|
|
89
|
+
if (parsedCommandLine.errors.length) {
|
|
90
|
+
log.err(`Could not parse ${tscArgs.pathname}.`);
|
|
91
|
+
log.subtle(import_typescript.default.formatDiagnostics(parsedCommandLine.errors, formatHost));
|
|
92
|
+
process.exitCode = 1;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
return parsedCommandLine;
|
|
96
|
+
};
|
|
32
97
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
98
|
0 && (module.exports = {
|
|
99
|
+
readTsconfig,
|
|
34
100
|
tsc
|
|
35
101
|
});
|
|
36
102
|
//# sourceMappingURL=tsc.js.map
|
package/lib/cli/build/tsc.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/build/tsc.ts"],
|
|
4
|
-
"sourcesContent": ["import { exec } from '../../utils/exec';\n\nimport { parseTscArgs } from './args';\n\nconst DEFAULT_ARGS = ['--project', 'tsconfig.build.json'] as const;\n\nexport const tsc = async (args = process.argv.slice(2)) => {\n const tscArgs = parseTscArgs(args);\n\n // Build flag is incompatible with project flag.\n const defaultArgs = tscArgs.build || tscArgs.project ? [] : DEFAULT_ARGS;\n\n return exec('tsc', ...defaultArgs, ...args);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import ts from 'typescript';\n\nimport { exec } from '../../utils/exec';\nimport type { Logger } from '../../utils/logging';\n\nimport { parseTscArgs } from './args';\n\nconst DEFAULT_ARGS = ['--project', 'tsconfig.build.json'] as const;\n\nconst formatHost: ts.FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: ts.sys.getCurrentDirectory.bind(undefined),\n getNewLine: () => ts.sys.newLine,\n};\n\nconst tsconfigCache = new Map<string, ts.ParsedCommandLine>();\nconst computeCacheKey = (args: string[]) => Array.from(args).sort().toString();\n\nexport const tsc = async (args = process.argv.slice(2)) => {\n const tscArgs = parseTscArgs(args);\n\n // Build flag is incompatible with project flag.\n const defaultArgs = tscArgs.build || tscArgs.project ? [] : DEFAULT_ARGS;\n\n return exec('tsc', ...defaultArgs, ...args);\n};\n\nexport const readTsconfig = (args = process.argv.slice(2), log: Logger) => {\n const tscArgs = parseTscArgs(args);\n\n let parsedCommandLine = tsconfigCache.get(computeCacheKey(args));\n\n if (!parsedCommandLine) {\n log.debug(\n log.bold(\n 'tsconfig',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ),\n );\n log.debug(tscArgs.pathname);\n\n const tsconfigFile = ts.findConfigFile(\n tscArgs.dirname,\n ts.sys.fileExists.bind(undefined),\n tscArgs.basename,\n );\n if (!tsconfigFile) {\n log.err(`Could not find ${tscArgs.pathname}.`);\n process.exitCode = 1;\n return;\n }\n\n const readConfigFile = ts.readConfigFile(\n tsconfigFile,\n ts.sys.readFile.bind(undefined),\n );\n if (readConfigFile.error) {\n log.err(`Could not read ${tscArgs.pathname}.`);\n log.subtle(ts.formatDiagnostic(readConfigFile.error, formatHost));\n process.exitCode = 1;\n return;\n }\n\n parsedCommandLine = ts.parseJsonConfigFileContent(\n readConfigFile.config,\n ts.sys,\n tscArgs.dirname,\n );\n tsconfigCache.set(computeCacheKey(args), parsedCommandLine);\n }\n\n if (parsedCommandLine.errors.length) {\n log.err(`Could not parse ${tscArgs.pathname}.`);\n log.subtle(ts.formatDiagnostics(parsedCommandLine.errors, formatHost));\n process.exitCode = 1;\n return;\n }\n\n return parsedCommandLine;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAe;AAEf,kBAAqB;AAGrB,kBAA6B;AAE7B,MAAM,eAAe,CAAC,aAAa,qBAAqB;AAExD,MAAM,aAAuC;AAAA,EAC3C,sBAAsB,CAAC,aAAa;AAAA,EACpC,qBAAqB,kBAAAA,QAAG,IAAI,oBAAoB,KAAK,MAAS;AAAA,EAC9D,YAAY,MAAM,kBAAAA,QAAG,IAAI;AAC3B;AAEA,MAAM,gBAAgB,oBAAI,IAAkC;AAC5D,MAAM,kBAAkB,CAAC,SAAmB,MAAM,KAAK,IAAI,EAAE,KAAK,EAAE,SAAS;AAEtE,MAAM,MAAM,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AACzD,QAAM,cAAU,0BAAa,IAAI;AAGjC,QAAM,cAAc,QAAQ,SAAS,QAAQ,UAAU,CAAC,IAAI;AAE5D,aAAO,kBAAK,OAAO,GAAG,aAAa,GAAG,IAAI;AAC5C;AAEO,MAAM,eAAe,CAAC,OAAO,QAAQ,KAAK,MAAM,CAAC,GAAG,QAAgB;AACzE,QAAM,cAAU,0BAAa,IAAI;AAEjC,MAAI,oBAAoB,cAAc,IAAI,gBAAgB,IAAI,CAAC;AAE/D,MAAI,CAAC,mBAAmB;AACtB,QAAI;AAAA,MACF,IAAI;AAAA,QACF;AAAA,QACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,MAC1D;AAAA,IACF;AACA,QAAI,MAAM,QAAQ,QAAQ;AAE1B,UAAM,eAAe,kBAAAA,QAAG;AAAA,MACtB,QAAQ;AAAA,MACR,kBAAAA,QAAG,IAAI,WAAW,KAAK,MAAS;AAAA,MAChC,QAAQ;AAAA,IACV;AACA,QAAI,CAAC,cAAc;AACjB,UAAI,IAAI,kBAAkB,QAAQ,WAAW;AAC7C,cAAQ,WAAW;AACnB;AAAA,IACF;AAEA,UAAM,iBAAiB,kBAAAA,QAAG;AAAA,MACxB;AAAA,MACA,kBAAAA,QAAG,IAAI,SAAS,KAAK,MAAS;AAAA,IAChC;AACA,QAAI,eAAe,OAAO;AACxB,UAAI,IAAI,kBAAkB,QAAQ,WAAW;AAC7C,UAAI,OAAO,kBAAAA,QAAG,iBAAiB,eAAe,OAAO,UAAU,CAAC;AAChE,cAAQ,WAAW;AACnB;AAAA,IACF;AAEA,wBAAoB,kBAAAA,QAAG;AAAA,MACrB,eAAe;AAAA,MACf,kBAAAA,QAAG;AAAA,MACH,QAAQ;AAAA,IACV;AACA,kBAAc,IAAI,gBAAgB,IAAI,GAAG,iBAAiB;AAAA,EAC5D;AAEA,MAAI,kBAAkB,OAAO,QAAQ;AACnC,QAAI,IAAI,mBAAmB,QAAQ,WAAW;AAC9C,QAAI,OAAO,kBAAAA,QAAG,kBAAkB,kBAAkB,QAAQ,UAAU,CAAC;AACrE,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": ["ts"]
|
|
7
7
|
}
|
package/lib/cli/buildPackage.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(buildPackage_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(buildPackage_exports);
|
|
24
24
|
var import_args = require("../utils/args");
|
|
25
25
|
var import_exec = require("../utils/exec");
|
|
26
|
+
var import_assets = require("./build/assets");
|
|
26
27
|
var import_addEmptyExports = require("./configure/addEmptyExports");
|
|
27
28
|
const buildPackage = async (args = process.argv.slice(2)) => {
|
|
28
29
|
await (0, import_addEmptyExports.tryAddEmptyExports)();
|
|
@@ -48,6 +49,18 @@ const buildPackage = async (args = process.argv.slice(2)) => {
|
|
|
48
49
|
maxProcesses: (0, import_args.hasSerialFlag)(args) ? 1 : void 0
|
|
49
50
|
}
|
|
50
51
|
);
|
|
52
|
+
await (0, import_assets.copyAssetsConcurrently)([
|
|
53
|
+
{
|
|
54
|
+
outDir: "lib-commonjs",
|
|
55
|
+
name: "commonjs",
|
|
56
|
+
prefixColor: "green"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
outDir: "lib-es2015",
|
|
60
|
+
name: "es2015",
|
|
61
|
+
prefixColor: "yellow"
|
|
62
|
+
}
|
|
63
|
+
]);
|
|
51
64
|
};
|
|
52
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53
66
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cli/buildPackage.ts"],
|
|
4
|
-
"sourcesContent": ["import { hasSerialFlag } from '../utils/args';\nimport { execConcurrently } from '../utils/exec';\n\nimport { tryAddEmptyExports } from './configure/addEmptyExports';\n\nexport const buildPackage = async (args = process.argv.slice(2)) => {\n await tryAddEmptyExports();\n\n await execConcurrently(\n [\n {\n command:\n 'tsc --module CommonJS --outDir lib-commonjs --project tsconfig.build.json',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n command:\n 'tsc --module ES2015 --outDir lib-es2015 --project tsconfig.build.json',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n {\n command:\n 'tsc --allowJS false --declaration --emitDeclarationOnly --outDir lib-types --project tsconfig.build.json',\n name: 'types',\n prefixColor: 'blue',\n },\n ],\n {\n maxProcesses: hasSerialFlag(args) ? 1 : undefined,\n },\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA8B;AAC9B,kBAAiC;AAEjC,6BAAmC;AAE5B,MAAM,eAAe,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAClE,YAAM,2CAAmB;AAEzB,YAAM;AAAA,IACJ;AAAA,MACE;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA;AAAA,MACE,kBAAc,2BAAc,IAAI,IAAI,IAAI;AAAA,IAC1C;AAAA,EACF;
|
|
4
|
+
"sourcesContent": ["import { hasSerialFlag } from '../utils/args';\nimport { execConcurrently } from '../utils/exec';\n\nimport { copyAssetsConcurrently } from './build/assets';\nimport { tryAddEmptyExports } from './configure/addEmptyExports';\n\nexport const buildPackage = async (args = process.argv.slice(2)) => {\n await tryAddEmptyExports();\n\n await execConcurrently(\n [\n {\n command:\n 'tsc --module CommonJS --outDir lib-commonjs --project tsconfig.build.json',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n command:\n 'tsc --module ES2015 --outDir lib-es2015 --project tsconfig.build.json',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n {\n command:\n 'tsc --allowJS false --declaration --emitDeclarationOnly --outDir lib-types --project tsconfig.build.json',\n name: 'types',\n prefixColor: 'blue',\n },\n ],\n {\n maxProcesses: hasSerialFlag(args) ? 1 : undefined,\n },\n );\n\n await copyAssetsConcurrently([\n {\n outDir: 'lib-commonjs',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n outDir: 'lib-es2015',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n ]);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA8B;AAC9B,kBAAiC;AAEjC,oBAAuC;AACvC,6BAAmC;AAE5B,MAAM,eAAe,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAClE,YAAM,2CAAmB;AAEzB,YAAM;AAAA,IACJ;AAAA,MACE;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA;AAAA,MACE,kBAAc,2BAAc,IAAI,IAAI,IAAI;AAAA,IAC1C;AAAA,EACF;AAEA,YAAM,sCAAuB;AAAA,IAC3B;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/copy.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type TextProcessor = (contents: string) => string;
|
|
2
|
+
export declare const copyFile: (sourcePath: string, destinationPath: string, { overwrite, processors, }: Pick<CopyFilesOptions, 'overwrite' | 'processors'>) => Promise<void>;
|
|
2
3
|
interface CopyFilesOptions {
|
|
3
4
|
sourceRoot: string;
|
|
4
5
|
destinationRoot: string;
|