@ms-cloudpack/bundler-ori 0.1.1
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/README.md +5 -0
- package/lib/buildWithRetries.d.ts +12 -0
- package/lib/buildWithRetries.d.ts.map +1 -0
- package/lib/buildWithRetries.js +48 -0
- package/lib/buildWithRetries.js.map +1 -0
- package/lib/createOriCapabilities.d.ts +4 -0
- package/lib/createOriCapabilities.d.ts.map +1 -0
- package/lib/createOriCapabilities.js +22 -0
- package/lib/createOriCapabilities.js.map +1 -0
- package/lib/getOriOptions.d.ts +20 -0
- package/lib/getOriOptions.d.ts.map +1 -0
- package/lib/getOriOptions.js +166 -0
- package/lib/getOriOptions.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/normalizeOutput.d.ts +10 -0
- package/lib/normalizeOutput.d.ts.map +1 -0
- package/lib/normalizeOutput.js +86 -0
- package/lib/normalizeOutput.js.map +1 -0
- package/lib/ori.d.ts +3 -0
- package/lib/ori.d.ts.map +1 -0
- package/lib/ori.js +12 -0
- package/lib/ori.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OriBuildOptions } from './getOriOptions.js';
|
|
2
|
+
import { type BuildResult as OriBuildResult } from 'oribuild';
|
|
3
|
+
/**
|
|
4
|
+
* Call ori `build()` with retries. This is a separate function for testing of retry logic.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildWithRetries(params: {
|
|
7
|
+
/** Params passed to ori */
|
|
8
|
+
oriInput: OriBuildOptions;
|
|
9
|
+
/** Just used to identify the bundled package in log messages (ori options don't contain this raw path) */
|
|
10
|
+
inputPath: string;
|
|
11
|
+
}): Promise<OriBuildResult>;
|
|
12
|
+
//# sourceMappingURL=buildWithRetries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildWithRetries.d.ts","sourceRoot":"","sources":["../src/buildWithRetries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAS,KAAK,WAAW,IAAI,cAAc,EAAE,MAAM,UAAU,CAAC;AAmBrE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,2BAA2B;IAC3B,QAAQ,EAAE,eAAe,CAAC;IAC1B,0GAA0G;IAC1G,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,cAAc,CAAC,CAoC1B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { RetryManager } from '@ms-cloudpack/retry';
|
|
2
|
+
import { build } from 'oribuild';
|
|
3
|
+
/**
|
|
4
|
+
* Retry 2 times (3 in total) if the error message contains 'room is closed' or 'failed marshalling message'.
|
|
5
|
+
* Both of these are intermittent errors which may be caused by race conditions.
|
|
6
|
+
*/
|
|
7
|
+
const intermittentErrorRetryPolicy = {
|
|
8
|
+
maxRetries: 2,
|
|
9
|
+
handle: (error) => error instanceof Error &&
|
|
10
|
+
(error.message.includes('room is closed') || error.message.includes('failed marshalling message')),
|
|
11
|
+
};
|
|
12
|
+
/** Retry 1 time (2 in total) if a timeout error was thrown by ori */
|
|
13
|
+
const timeoutRetryPolicy = {
|
|
14
|
+
maxRetries: 1,
|
|
15
|
+
handle: (error) => error instanceof Error && error.message.includes('within the timeout window'),
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Call ori `build()` with retries. This is a separate function for testing of retry logic.
|
|
19
|
+
*/
|
|
20
|
+
export function buildWithRetries(params) {
|
|
21
|
+
const { oriInput, inputPath } = params;
|
|
22
|
+
const retryManager = new RetryManager([intermittentErrorRetryPolicy, timeoutRetryPolicy]);
|
|
23
|
+
let timeoutMs = oriInput.buildAcknowledgeTimeoutMs;
|
|
24
|
+
let hadTimeout = false;
|
|
25
|
+
return retryManager.retry(async (retryContext) => {
|
|
26
|
+
if (retryContext.policy === timeoutRetryPolicy) {
|
|
27
|
+
console.warn(`ori build for ${inputPath} timed out after ${timeoutMs}ms. Will retry with ${timeoutMs * 2}ms timeout.`);
|
|
28
|
+
timeoutMs *= 2;
|
|
29
|
+
hadTimeout = true;
|
|
30
|
+
}
|
|
31
|
+
else if (retryContext.policy === intermittentErrorRetryPolicy) {
|
|
32
|
+
console.warn(`Will retry ori build for ${inputPath} (retry ${retryContext.retryAttempt}/${retryContext.policy.maxRetries}) ` +
|
|
33
|
+
`after known intermittent error: ${retryContext.lastError.message}`);
|
|
34
|
+
}
|
|
35
|
+
const result = await build({ ...oriInput, buildAcknowledgeTimeoutMs: timeoutMs });
|
|
36
|
+
if (hadTimeout) {
|
|
37
|
+
// Include a warning in the output recommending increasing the timeout for this package.
|
|
38
|
+
// The warning is more visible this way than if it was only logged to the console.
|
|
39
|
+
result.warnings.push({
|
|
40
|
+
text: `Build succeeded on retry after increasing timeout to ${timeoutMs}ms. ` +
|
|
41
|
+
`You may want to add cloudpack packageSettings with \`{ "bundlerOptions": { "buildAcknowledgeTimeoutMs": ${timeoutMs} } }\` ` +
|
|
42
|
+
'to use a longer timeout for this package on the first attempt.',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=buildWithRetries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildWithRetries.js","sourceRoot":"","sources":["../src/buildWithRetries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoB,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,KAAK,EAAsC,MAAM,UAAU,CAAC;AAErE;;;GAGG;AACH,MAAM,4BAA4B,GAAgB;IAChD,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAChB,KAA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E,GAAG,QAAQ,EAAE,yBAAyB,EAAE,SAAS,EAAE,CAAC,CAAC;QAElF,IAAI,UAAU,EAAE,CAAC;YACf,wFAAwF;YACxF,kFAAkF;YAClF,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACnB,IAAI,EACF,wDAAwD,SAAS,MAAM;oBACvE,2GAA2G,SAAS,SAAS;oBAC7H,gEAAgE;aAClB,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { RetryManager, type RetryPolicy } from '@ms-cloudpack/retry';\nimport type { OriBuildOptions } from './getOriOptions.js';\nimport { build, type BuildResult as OriBuildResult } from 'oribuild';\n\n/**\n * Retry 2 times (3 in total) if the error message contains 'room is closed' or 'failed marshalling message'.\n * Both of these are intermittent errors which may be caused by race conditions.\n */\nconst intermittentErrorRetryPolicy: RetryPolicy = {\n maxRetries: 2,\n handle: (error) =>\n error instanceof Error &&\n (error.message.includes('room is closed') || error.message.includes('failed marshalling message')),\n};\n\n/** Retry 1 time (2 in total) if a timeout error was thrown by ori */\nconst timeoutRetryPolicy: RetryPolicy = {\n maxRetries: 1,\n handle: (error) => error instanceof Error && error.message.includes('within the timeout window'),\n};\n\n/**\n * Call ori `build()` with retries. This is a separate function for testing of retry logic.\n */\nexport function buildWithRetries(params: {\n /** Params passed to ori */\n oriInput: OriBuildOptions;\n /** Just used to identify the bundled package in log messages (ori options don't contain this raw path) */\n inputPath: string;\n}): Promise<OriBuildResult> {\n const { oriInput, inputPath } = params;\n const retryManager = new RetryManager([intermittentErrorRetryPolicy, timeoutRetryPolicy]);\n\n let timeoutMs = oriInput.buildAcknowledgeTimeoutMs;\n let hadTimeout = false;\n\n return retryManager.retry(async (retryContext) => {\n if (retryContext.policy === timeoutRetryPolicy) {\n console.warn(\n `ori build for ${inputPath} timed out after ${timeoutMs}ms. Will retry with ${timeoutMs * 2}ms timeout.`,\n );\n timeoutMs *= 2;\n hadTimeout = true;\n } else if (retryContext.policy === intermittentErrorRetryPolicy) {\n console.warn(\n `Will retry ori build for ${inputPath} (retry ${retryContext.retryAttempt}/${retryContext.policy.maxRetries}) ` +\n `after known intermittent error: ${(retryContext.lastError as Error).message}`,\n );\n }\n\n const result = await build({ ...oriInput, buildAcknowledgeTimeoutMs: timeoutMs });\n\n if (hadTimeout) {\n // Include a warning in the output recommending increasing the timeout for this package.\n // The warning is more visible this way than if it was only logged to the console.\n result.warnings.push({\n text:\n `Build succeeded on retry after increasing timeout to ${timeoutMs}ms. ` +\n `You may want to add cloudpack packageSettings with \\`{ \"bundlerOptions\": { \"buildAcknowledgeTimeoutMs\": ${timeoutMs} } }\\` ` +\n 'to use a longer timeout for this package on the first attempt.',\n } as unknown as OriBuildResult['warnings'][number]);\n }\n\n return result;\n });\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InternalBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';
|
|
2
|
+
import type { OriBuildOptions } from './getOriOptions.ts';
|
|
3
|
+
export declare function createOriCapabilities(bundlerOptions: Partial<OriBuildOptions>): InternalBundlerCapabilityImplementations<OriBuildOptions>;
|
|
4
|
+
//# sourceMappingURL=createOriCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOriCapabilities.d.ts","sourceRoot":"","sources":["../src/createOriCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,OAAO,CAAC,eAAe,CAAC,GACvC,wCAAwC,CAAC,eAAe,CAAC,CAqB3D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { mergeObjects } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
export function createOriCapabilities(bundlerOptions) {
|
|
3
|
+
return {
|
|
4
|
+
'asset-inline': (config, options) => {
|
|
5
|
+
// Make sure that the leading dot exists in the extensions
|
|
6
|
+
const extensions = options.extensions.map((ext) => (!ext.startsWith('.') ? `.${ext}` : ext));
|
|
7
|
+
config.loader = {
|
|
8
|
+
...config.loader,
|
|
9
|
+
...Object.fromEntries(extensions.map((ext) => [ext, 'dataurl'])),
|
|
10
|
+
// bundler options take precedence in terms of loaders.
|
|
11
|
+
...bundlerOptions.loader,
|
|
12
|
+
};
|
|
13
|
+
return config;
|
|
14
|
+
},
|
|
15
|
+
alias: (config, options) => {
|
|
16
|
+
// Add aliases to the ori configuration
|
|
17
|
+
config.alias = mergeObjects([config.alias || {}, options]);
|
|
18
|
+
return config;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=createOriCapabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOriCapabilities.js","sourceRoot":"","sources":["../src/createOriCapabilities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,MAAM,UAAU,qBAAqB,CACnC,cAAwC;IAExC,OAAO;QACL,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;YAClC,0DAA0D;YAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAE7F,MAAM,CAAC,MAAM,GAAG;gBACd,GAAG,MAAM,CAAC,MAAM;gBAChB,GAAG,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;gBAChE,uDAAuD;gBACvD,GAAG,cAAc,CAAC,MAAM;aACzB,CAAC;YAEF,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;YACzB,uCAAuC;YACvC,MAAM,CAAC,KAAK,GAAG,YAAY,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3D,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { InternalBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';\nimport type { OriBuildOptions } from './getOriOptions.ts';\nimport { mergeObjects } from '@ms-cloudpack/package-utilities';\n\nexport function createOriCapabilities(\n bundlerOptions: Partial<OriBuildOptions>,\n): InternalBundlerCapabilityImplementations<OriBuildOptions> {\n return {\n 'asset-inline': (config, options) => {\n // Make sure that the leading dot exists in the extensions\n const extensions = options.extensions.map((ext) => (!ext.startsWith('.') ? `.${ext}` : ext));\n\n config.loader = {\n ...config.loader,\n ...Object.fromEntries(extensions.map((ext) => [ext, 'dataurl'])),\n // bundler options take precedence in terms of loaders.\n ...bundlerOptions.loader,\n };\n\n return config;\n },\n alias: (config, options) => {\n // Add aliases to the ori configuration\n config.alias = mergeObjects([config.alias || {}, options]);\n return config;\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BundleOptions, CloudpackConfig } from '@ms-cloudpack/common-types';
|
|
2
|
+
import type { BuildOptions } from 'oribuild';
|
|
3
|
+
/** Ori options with important properties always set by cloudpack marked as required. */
|
|
4
|
+
export type OriBuildOptions = BuildOptions & Required<Pick<BuildOptions, 'absWorkingDir' | 'buildAcknowledgeTimeoutMs'>>;
|
|
5
|
+
/**
|
|
6
|
+
* The intended use of `absWorkingDir` in esbuild is to resolve relative paths from options.
|
|
7
|
+
* However, ori also uses `absWorkingDir` as the virtual FS root for module resolution in plugins.
|
|
8
|
+
* This means if `inputPath` is an individual package in a monorepo, ori won't be able to resolve
|
|
9
|
+
* scss `@import`s from other packages (which are often in `node_modules` at the git root).
|
|
10
|
+
* As a workaround, we use the git root (if available) as `absWorkingDir` and adjust all other paths.
|
|
11
|
+
* https://github.com/microsoft/cloudpack/issues/1174
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAbsWorkingDir(inputPath: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* @returns The options for the ori bundler, with capabilities applied.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getOriOptions(options: BundleOptions, context: {
|
|
18
|
+
config: CloudpackConfig;
|
|
19
|
+
}): Promise<OriBuildOptions>;
|
|
20
|
+
//# sourceMappingURL=getOriOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOriOptions.d.ts","sourceRoot":"","sources":["../src/getOriOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAA8B,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI7G,OAAO,KAAK,EAAE,YAAY,EAAyC,MAAM,UAAU,CAAC;AAIpF,wFAAwF;AACxF,MAAM,MAAM,eAAe,GAAG,YAAY,GACxC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,GAAG,2BAA2B,CAAC,CAAC,CAAC;AAsC9E;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,UAEjD;AAyID;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,GACnC,OAAO,CAAC,eAAe,CAAC,CAgB1B"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { processCapabilities } from '@ms-cloudpack/bundler-capabilities';
|
|
2
|
+
import { defaultTargetSyntax } from '@ms-cloudpack/bundler-utilities';
|
|
3
|
+
import { findProjectRoot, mergeArrayDefaults } from '@ms-cloudpack/package-utilities';
|
|
4
|
+
import { normalizeRelativePath, slash } from '@ms-cloudpack/path-string-parsing';
|
|
5
|
+
import { builtinModules } from 'module';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { createOriCapabilities } from './createOriCapabilities.js';
|
|
8
|
+
const nodeBuiltins = [...builtinModules, ...builtinModules.map((name) => `node:${name}`)];
|
|
9
|
+
const defaultPlugins = [
|
|
10
|
+
{
|
|
11
|
+
plugin: 'css-modules',
|
|
12
|
+
prefixClasses: false,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
plugin: 'sass',
|
|
16
|
+
prefixClasses: false,
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
const defaultResolveExtensions = ['.tsx', '.ts', '.jsx', '.js', '.css', '.json'];
|
|
20
|
+
const base64AssetExtensions = [
|
|
21
|
+
'.aac',
|
|
22
|
+
'.bmp',
|
|
23
|
+
'.gif',
|
|
24
|
+
'.jpeg',
|
|
25
|
+
'.jpg',
|
|
26
|
+
'.mp3',
|
|
27
|
+
'.mp4',
|
|
28
|
+
'.ogg',
|
|
29
|
+
'.otf',
|
|
30
|
+
'.png',
|
|
31
|
+
'.svg',
|
|
32
|
+
'.ttf',
|
|
33
|
+
'.wav',
|
|
34
|
+
'.webp',
|
|
35
|
+
'.woff',
|
|
36
|
+
'.woff2',
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* The intended use of `absWorkingDir` in esbuild is to resolve relative paths from options.
|
|
40
|
+
* However, ori also uses `absWorkingDir` as the virtual FS root for module resolution in plugins.
|
|
41
|
+
* This means if `inputPath` is an individual package in a monorepo, ori won't be able to resolve
|
|
42
|
+
* scss `@import`s from other packages (which are often in `node_modules` at the git root).
|
|
43
|
+
* As a workaround, we use the git root (if available) as `absWorkingDir` and adjust all other paths.
|
|
44
|
+
* https://github.com/microsoft/cloudpack/issues/1174
|
|
45
|
+
*/
|
|
46
|
+
export function getAbsWorkingDir(inputPath) {
|
|
47
|
+
return findProjectRoot(inputPath, { noPackageRoot: true }) || inputPath;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Join two relative paths, with forward slashes and removing any extra segments.
|
|
51
|
+
*/
|
|
52
|
+
function joinRelativePaths(p1, p2) {
|
|
53
|
+
return normalizeRelativePath(path.normalize(path.join(p1, p2)));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get a slash-normalized relative path from the calculated `absWorkingDir` to the item.
|
|
57
|
+
*/
|
|
58
|
+
function getRelativePath(absWorkingDir, absItemPath) {
|
|
59
|
+
return slash(path.relative(absWorkingDir, absItemPath));
|
|
60
|
+
}
|
|
61
|
+
function buildDynamicImportsFilter(dynamicImports) {
|
|
62
|
+
// Using the basename works good enough for now, we might want to include the path in the future,
|
|
63
|
+
// but we would need to make sure it matches successfully in the dynamic import plugin.
|
|
64
|
+
const joined = dynamicImports.map((s) => path.basename(s)).join('|');
|
|
65
|
+
// Add the default dynamic import extensions to the list of dynamic imports.
|
|
66
|
+
return `(${joined}|.dynamic.(js|mjs|ts|tsx))$`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @returns The options for the ori bundler, without capabilities applied.
|
|
70
|
+
*/
|
|
71
|
+
function getOriOptionsInternal(options, context) {
|
|
72
|
+
const { inputPath, sourcemap, entries, outputPath, external = [], inlined = [], minify, incremental, dynamicImports, } = options;
|
|
73
|
+
const { config } = context;
|
|
74
|
+
const { features, mode } = config;
|
|
75
|
+
const bundlerOptions = (options.bundlerOptions || {});
|
|
76
|
+
const absWorkingDir = getAbsWorkingDir(inputPath);
|
|
77
|
+
const relInputPath = getRelativePath(absWorkingDir, inputPath);
|
|
78
|
+
// Normalize outputPath to be absolute (the passed value can either already be absolute, or be
|
|
79
|
+
// relative to inputPath). Or if it's not specified, use inputPath.
|
|
80
|
+
const finalOutputPath = outputPath ? path.resolve(inputPath, outputPath) : inputPath;
|
|
81
|
+
const resolveWebExtensions = Boolean(features?.resolveWebExtensions);
|
|
82
|
+
const resolveExtensions = resolveWebExtensions
|
|
83
|
+
? ['.web.tsx', '.web.ts', '.web.jsx', '.web.js', ...defaultResolveExtensions]
|
|
84
|
+
: defaultResolveExtensions;
|
|
85
|
+
const plugins = mergeArrayDefaults(bundlerOptions.plugins, defaultPlugins);
|
|
86
|
+
if (dynamicImports?.length) {
|
|
87
|
+
plugins.push({
|
|
88
|
+
plugin: 'dynamic-imports',
|
|
89
|
+
filter: buildDynamicImportsFilter(dynamicImports),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// Translate options into ori config.
|
|
93
|
+
return {
|
|
94
|
+
splitting: true,
|
|
95
|
+
serviceOptions: {},
|
|
96
|
+
buildAcknowledgeTimeoutMs: 10000,
|
|
97
|
+
sourcemap: sourcemap ? 'linked' : 'none',
|
|
98
|
+
// Default to es2022 so top-level await works
|
|
99
|
+
target: defaultTargetSyntax,
|
|
100
|
+
// bundlerOptions takes precedence over the defaults above
|
|
101
|
+
...bundlerOptions,
|
|
102
|
+
// BundleOptions values take precedence over bundlerOptions
|
|
103
|
+
incremental,
|
|
104
|
+
minify,
|
|
105
|
+
// Critical options that shouldn't be overridden
|
|
106
|
+
metafile: true,
|
|
107
|
+
write: true,
|
|
108
|
+
// Calculated or manually merged options
|
|
109
|
+
absWorkingDir,
|
|
110
|
+
entryPoints: Object.fromEntries(Object.entries(entries).map(([outFile, inFile]) => [
|
|
111
|
+
// outFile is relative to outputPath, which will still be correct because we updated outputPath
|
|
112
|
+
outFile,
|
|
113
|
+
// Either esbuild or ori appears to require entries to be prefixed with ./
|
|
114
|
+
joinRelativePaths(relInputPath, inFile),
|
|
115
|
+
])),
|
|
116
|
+
outdir: finalOutputPath,
|
|
117
|
+
// outbase is probably only relevant for an array of entry point paths, not the full entryPoints
|
|
118
|
+
// mapping (output path to input path) that ori uses, but go ahead and correct it if provided
|
|
119
|
+
outbase: typeof bundlerOptions.outbase === 'string' ? path.resolve(inputPath, bundlerOptions.outbase) : undefined,
|
|
120
|
+
// Enabling this automatically marks all import paths that look like npm packages as external.
|
|
121
|
+
packages: !inlined.length && mode === 'library' ? 'external' : undefined,
|
|
122
|
+
// These can be either package names or paths/globs (see https://esbuild.github.io/api/#external).
|
|
123
|
+
// For any paths starting with a dot or slash, add relInputPath to the start.
|
|
124
|
+
// TODO: Improve it so we always external all known and unknown packages by default, and only inline the ones we know we need.
|
|
125
|
+
external: inlined.length
|
|
126
|
+
? external
|
|
127
|
+
.filter((e) => !inlined.includes(e))
|
|
128
|
+
.map((e) => {
|
|
129
|
+
if (e[0] === '/') {
|
|
130
|
+
return `/${relInputPath}${e}`;
|
|
131
|
+
}
|
|
132
|
+
if (e[0] === '.') {
|
|
133
|
+
return joinRelativePaths(relInputPath, e);
|
|
134
|
+
}
|
|
135
|
+
return e;
|
|
136
|
+
})
|
|
137
|
+
.concat(nodeBuiltins)
|
|
138
|
+
: undefined,
|
|
139
|
+
define: {
|
|
140
|
+
global: 'window',
|
|
141
|
+
'process.env.NODE_ENV': minify ? `"production"` : '"development"',
|
|
142
|
+
...bundlerOptions.define,
|
|
143
|
+
},
|
|
144
|
+
plugins,
|
|
145
|
+
resolveExtensions: mergeArrayDefaults(bundlerOptions.resolveExtensions, resolveExtensions),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @returns The options for the ori bundler, with capabilities applied.
|
|
150
|
+
*/
|
|
151
|
+
export async function getOriOptions(options, context) {
|
|
152
|
+
const capabilitiesOptions = {
|
|
153
|
+
// Enable asset inlining for the specified extensions.
|
|
154
|
+
'asset-inline': { extensions: base64AssetExtensions },
|
|
155
|
+
...options.bundlerCapabilities,
|
|
156
|
+
};
|
|
157
|
+
const bundlerOptions = (options.bundlerOptions || {});
|
|
158
|
+
const input = await processCapabilities({
|
|
159
|
+
bundlerName: 'ori',
|
|
160
|
+
baseConfig: getOriOptionsInternal(options, context),
|
|
161
|
+
bundlerCapabilitiesOptions: capabilitiesOptions,
|
|
162
|
+
internalCapabilities: createOriCapabilities(bundlerOptions),
|
|
163
|
+
});
|
|
164
|
+
return input;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=getOriOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOriOptions.js","sourceRoot":"","sources":["../src/getOriOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAMnE,MAAM,YAAY,GAAG,CAAC,GAAG,cAAc,EAAE,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;AAI1F,MAAM,cAAc,GAAuB;IACzC;QACE,MAAM,EAAE,aAAa;QACrB,aAAa,EAAE,KAAK;KACrB;IACD;QACE,MAAM,EAAE,MAAM;QACd,aAAa,EAAE,KAAK;KACrB;CACF,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjF,MAAM,qBAAqB,GAAG;IAC5B,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;CACT,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,gBA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,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;KAC3F,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAsB,EACtB,OAAoC;IAEpC,MAAM,mBAAmB,GAA+B;QACtD,sDAAsD;QACtD,cAAc,EAAE,EAAE,UAAU,EAAE,qBAAqB,EAAE;QACrD,GAAG,OAAO,CAAC,mBAAmB;KAC/B,CAAC;IAEF,MAAM,cAAc,GAAG,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAA6B,CAAC;IAClF,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC;QACtC,WAAW,EAAE,KAAK;QAClB,UAAU,EAAE,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC;QACnD,0BAA0B,EAAE,mBAAmB;QAC/C,oBAAoB,EAAE,qBAAqB,CAAC,cAAc,CAAC;KAC5D,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { processCapabilities } from '@ms-cloudpack/bundler-capabilities';\nimport { defaultTargetSyntax } from '@ms-cloudpack/bundler-utilities';\nimport type { BundleOptions, BundlerCapabilitiesOptions, CloudpackConfig } from '@ms-cloudpack/common-types';\nimport { findProjectRoot, mergeArrayDefaults } from '@ms-cloudpack/package-utilities';\nimport { normalizeRelativePath, slash } from '@ms-cloudpack/path-string-parsing';\nimport { builtinModules } from 'module';\nimport type { BuildOptions, PluginJSONConfig as _PluginJSONConfig } from 'oribuild';\nimport path from 'path';\nimport { createOriCapabilities } from './createOriCapabilities.js';\n\n/** Ori options with important properties always set by cloudpack marked as required. */\nexport type OriBuildOptions = BuildOptions &\n Required<Pick<BuildOptions, 'absWorkingDir' | 'buildAcknowledgeTimeoutMs'>>;\n\nconst nodeBuiltins = [...builtinModules, ...builtinModules.map((name) => `node:${name}`)];\n\n// The type from ori is now missing the extra properties\ntype PluginJSONConfig = _PluginJSONConfig & Record<string, string | boolean>;\nconst defaultPlugins: PluginJSONConfig[] = [\n {\n plugin: 'css-modules',\n prefixClasses: false,\n },\n {\n plugin: 'sass',\n prefixClasses: false,\n },\n];\n\nconst defaultResolveExtensions = ['.tsx', '.ts', '.jsx', '.js', '.css', '.json'];\n\nconst base64AssetExtensions = [\n '.aac',\n '.bmp',\n '.gif',\n '.jpeg',\n '.jpg',\n '.mp3',\n '.mp4',\n '.ogg',\n '.otf',\n '.png',\n '.svg',\n '.ttf',\n '.wav',\n '.webp',\n '.woff',\n '.woff2',\n];\n\n/**\n * The intended use of `absWorkingDir` in esbuild is to resolve relative paths from options.\n * However, ori also uses `absWorkingDir` as the virtual FS root for module resolution in plugins.\n * This means if `inputPath` is an individual package in a monorepo, ori won't be able to resolve\n * scss `@import`s from other packages (which are often in `node_modules` at the git root).\n * As a workaround, we use the git root (if available) as `absWorkingDir` and adjust all other paths.\n * https://github.com/microsoft/cloudpack/issues/1174\n */\nexport function getAbsWorkingDir(inputPath: string) {\n return findProjectRoot(inputPath, { noPackageRoot: true }) || inputPath;\n}\n\n/**\n * Join two relative paths, with forward slashes and removing any extra segments.\n */\nfunction joinRelativePaths(p1: string, p2: string) {\n return normalizeRelativePath(path.normalize(path.join(p1, p2)));\n}\n\n/**\n * Get a slash-normalized relative path from the calculated `absWorkingDir` to the item.\n */\nfunction getRelativePath(absWorkingDir: string, absItemPath: string) {\n return slash(path.relative(absWorkingDir, absItemPath));\n}\n\nfunction buildDynamicImportsFilter(dynamicImports: string[]) {\n // Using the basename works good enough for now, we might want to include the path in the future,\n // but we would need to make sure it matches successfully in the dynamic import plugin.\n const joined = dynamicImports.map((s) => path.basename(s)).join('|');\n // Add the default dynamic import extensions to the list of dynamic imports.\n return `(${joined}|.dynamic.(js|mjs|ts|tsx))$`;\n}\n\n/**\n * @returns The options for the ori bundler, without capabilities applied.\n */\nfunction getOriOptionsInternal(options: BundleOptions, context: { config: CloudpackConfig }): OriBuildOptions {\n const {\n inputPath,\n sourcemap,\n entries,\n outputPath,\n external = [],\n inlined = [],\n minify,\n incremental,\n dynamicImports,\n } = options;\n const { config } = context;\n const { features, mode } = config;\n\n const bundlerOptions = (options.bundlerOptions || {}) as Partial<OriBuildOptions>;\n\n const absWorkingDir = getAbsWorkingDir(inputPath);\n const relInputPath = getRelativePath(absWorkingDir, inputPath);\n\n // Normalize outputPath to be absolute (the passed value can either already be absolute, or be\n // relative to inputPath). Or if it's not specified, use inputPath.\n const finalOutputPath = outputPath ? path.resolve(inputPath, outputPath) : inputPath;\n\n const resolveWebExtensions = Boolean(features?.resolveWebExtensions);\n const resolveExtensions = resolveWebExtensions\n ? ['.web.tsx', '.web.ts', '.web.jsx', '.web.js', ...defaultResolveExtensions]\n : defaultResolveExtensions;\n\n const plugins = mergeArrayDefaults(bundlerOptions.plugins, defaultPlugins) as PluginJSONConfig[];\n if (dynamicImports?.length) {\n plugins.push({\n plugin: 'dynamic-imports',\n filter: buildDynamicImportsFilter(dynamicImports),\n });\n }\n\n // Translate options into ori config.\n return {\n splitting: true,\n serviceOptions: {},\n buildAcknowledgeTimeoutMs: 10000,\n sourcemap: sourcemap ? 'linked' : 'none',\n // Default to es2022 so top-level await works\n target: defaultTargetSyntax,\n\n // bundlerOptions takes precedence over the defaults above\n ...bundlerOptions,\n\n // BundleOptions values take precedence over bundlerOptions\n incremental,\n minify,\n\n // Critical options that shouldn't be overridden\n metafile: true,\n write: true,\n\n // Calculated or manually merged options\n absWorkingDir,\n\n entryPoints: Object.fromEntries(\n Object.entries(entries).map(([outFile, inFile]) => [\n // outFile is relative to outputPath, which will still be correct because we updated outputPath\n outFile,\n // Either esbuild or ori appears to require entries to be prefixed with ./\n joinRelativePaths(relInputPath, inFile),\n ]),\n ),\n\n outdir: finalOutputPath,\n\n // outbase is probably only relevant for an array of entry point paths, not the full entryPoints\n // mapping (output path to input path) that ori uses, but go ahead and correct it if provided\n outbase: typeof bundlerOptions.outbase === 'string' ? path.resolve(inputPath, bundlerOptions.outbase) : undefined,\n\n // Enabling this automatically marks all import paths that look like npm packages as external.\n packages: !inlined.length && mode === 'library' ? 'external' : undefined,\n\n // These can be either package names or paths/globs (see https://esbuild.github.io/api/#external).\n // For any paths starting with a dot or slash, add relInputPath to the start.\n // TODO: Improve it so we always external all known and unknown packages by default, and only inline the ones we know we need.\n external: inlined.length\n ? external\n .filter((e) => !inlined.includes(e))\n .map((e) => {\n if (e[0] === '/') {\n return `/${relInputPath}${e}`;\n }\n\n if (e[0] === '.') {\n return joinRelativePaths(relInputPath, e);\n }\n\n return e;\n })\n .concat(nodeBuiltins)\n : undefined,\n\n define: {\n global: 'window',\n 'process.env.NODE_ENV': minify ? `\"production\"` : '\"development\"',\n ...bundlerOptions.define,\n },\n\n plugins,\n\n resolveExtensions: mergeArrayDefaults(bundlerOptions.resolveExtensions, resolveExtensions),\n };\n}\n\n/**\n * @returns The options for the ori bundler, with capabilities applied.\n */\nexport async function getOriOptions(\n options: BundleOptions,\n context: { config: CloudpackConfig },\n): Promise<OriBuildOptions> {\n const capabilitiesOptions: BundlerCapabilitiesOptions = {\n // Enable asset inlining for the specified extensions.\n 'asset-inline': { extensions: base64AssetExtensions },\n ...options.bundlerCapabilities,\n };\n\n const bundlerOptions = (options.bundlerOptions || {}) as Partial<OriBuildOptions>;\n const input = await processCapabilities({\n bundlerName: 'ori',\n baseConfig: getOriOptionsInternal(options, context),\n bundlerCapabilitiesOptions: capabilitiesOptions,\n internalCapabilities: createOriCapabilities(bundlerOptions),\n });\n\n return input;\n}\n"]}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC"}
|
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { ori as default } from './ori.js';\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BundleOptions, BundlerResult } from '@ms-cloudpack/common-types';
|
|
2
|
+
import type { BuildOptions as OriBuildOptions, BuildResult as OriBuildResult } from 'oribuild';
|
|
3
|
+
export declare function normalizeOutput(params: {
|
|
4
|
+
options: BundleOptions;
|
|
5
|
+
input: OriBuildOptions & {
|
|
6
|
+
absWorkingDir: string;
|
|
7
|
+
};
|
|
8
|
+
output: OriBuildResult;
|
|
9
|
+
}): BundlerResult;
|
|
10
|
+
//# sourceMappingURL=normalizeOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeOutput.d.ts","sourceRoot":"","sources":["../src/normalizeOutput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,aAAa,EAEb,aAAa,EACd,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,YAAY,IAAI,eAAe,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,UAAU,CAAC;AAK/F,wBAAgB,eAAe,CAAC,MAAM,EAAE;IACtC,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,eAAe,GAAG;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,MAAM,EAAE,cAAc,CAAC;CACxB,GAAG,aAAa,CA6ChB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';
|
|
2
|
+
import { normalizedPathRelativeTo } from '@ms-cloudpack/path-utilities';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
export function normalizeOutput(params) {
|
|
5
|
+
const { options, input, output } = params;
|
|
6
|
+
const { inputPath } = options;
|
|
7
|
+
const { outdir: outputPath, absWorkingDir } = input;
|
|
8
|
+
if (!outputPath) {
|
|
9
|
+
// This shouldn't be necessary, but assert in case of future code changes...
|
|
10
|
+
throw new Error('Expected ori input.outdir to be set by getOriOptions (this is a bug in Cloudpack)');
|
|
11
|
+
}
|
|
12
|
+
// outputs is a dictionary where the key is a path relative to absWorkingDir
|
|
13
|
+
// (which getOriOptions sets to the repo root to work around a bug).
|
|
14
|
+
// We need the BundleOutputFile.outputPath to be relative to the outputPath.
|
|
15
|
+
const outputFiles = Object.entries(output.metafile?.outputs || {}).map(([fileOutputPath, entry]) => {
|
|
16
|
+
const { entryPoint, exports } = entry;
|
|
17
|
+
const entryAbsPath = entryPoint !== undefined ? path.resolve(absWorkingDir, entryPoint) : undefined;
|
|
18
|
+
const outputAbsPath = path.resolve(input.absWorkingDir, fileOutputPath);
|
|
19
|
+
return {
|
|
20
|
+
outputPath: normalizedPathRelativeTo(outputPath, outputAbsPath),
|
|
21
|
+
entryPoint: entryAbsPath ? normalizedPathRelativeTo(inputPath, entryAbsPath) : undefined,
|
|
22
|
+
exports,
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
outputPath,
|
|
27
|
+
outputFiles,
|
|
28
|
+
errors: normalizeMessages({ inputPath, absWorkingDir, messages: output.errors }),
|
|
29
|
+
warnings: normalizeMessages({ inputPath, absWorkingDir, messages: output.warnings }),
|
|
30
|
+
rawInput: input,
|
|
31
|
+
rawOutput: output,
|
|
32
|
+
...(options.incremental &&
|
|
33
|
+
output.rebuild && {
|
|
34
|
+
dispose: output.dispose,
|
|
35
|
+
rebuild: async () => normalizeOutput({
|
|
36
|
+
options,
|
|
37
|
+
input,
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
39
|
+
output: await output.rebuild(),
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function normalizeMessages(params) {
|
|
45
|
+
const { messages, ...pathParams } = params;
|
|
46
|
+
const foundMessages = new Set();
|
|
47
|
+
return messages
|
|
48
|
+
?.map((message) => {
|
|
49
|
+
const result = {
|
|
50
|
+
text: message.text,
|
|
51
|
+
source: 'ori',
|
|
52
|
+
};
|
|
53
|
+
if (message.location) {
|
|
54
|
+
result.location = normalizeLocation({ ...pathParams, location: message.location });
|
|
55
|
+
}
|
|
56
|
+
if (message.notes) {
|
|
57
|
+
result.notes = message.notes.map((note) => ({
|
|
58
|
+
text: '',
|
|
59
|
+
location: note.location && normalizeLocation({ ...pathParams, location: note.location }),
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
if (message.pluginName) {
|
|
63
|
+
// Add the plugin name to the source, since this may be relevant for debugging.
|
|
64
|
+
result.source = `ori ${message.pluginName} plugin`;
|
|
65
|
+
}
|
|
66
|
+
// For some reason there can be a duplicate error message for a bad export name (shows up in
|
|
67
|
+
// a test, though not sure if it's seen in the wild?) -- try to dedupe.
|
|
68
|
+
const key = result.text + JSON.stringify(result.location);
|
|
69
|
+
if (foundMessages.has(key)) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
foundMessages.add(key);
|
|
73
|
+
return result;
|
|
74
|
+
})
|
|
75
|
+
.filter((m) => !!m);
|
|
76
|
+
}
|
|
77
|
+
function normalizeLocation(params) {
|
|
78
|
+
const { inputPath, location, absWorkingDir } = params;
|
|
79
|
+
const absDir = path.resolve(absWorkingDir, location.file);
|
|
80
|
+
return {
|
|
81
|
+
file: normalizeRelativePath(path.relative(inputPath, absDir)),
|
|
82
|
+
line: location.line,
|
|
83
|
+
column: location.column,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=normalizeOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeOutput.js","sourceRoot":"","sources":["../src/normalizeOutput.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,IAAI,MAAM,MAAM,CAAC;AAIx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,CAAC;QAED,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,+EAA+E;YAC/E,MAAM,CAAC,MAAM,GAAG,OAAO,OAAO,CAAC,UAAU,SAAS,CAAC;QACrD,CAAC;QAED,4FAA4F;QAC5F,uEAAuE;QACvE,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1D,IAAI,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEvB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAI1B;IACC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;IAEtD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE1D,OAAO;QACL,IAAI,EAAE,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC7D,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import type {\n BundleMessage,\n BundleMessageLocation,\n BundleOptions,\n BundleOutputFile,\n BundlerResult,\n} from '@ms-cloudpack/common-types';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport { normalizedPathRelativeTo } from '@ms-cloudpack/path-utilities';\nimport type { BuildOptions as OriBuildOptions, BuildResult as OriBuildResult } from 'oribuild';\nimport path from 'path';\n\ntype BuildStatusMessage = OriBuildResult['errors'][number];\n\nexport function normalizeOutput(params: {\n options: BundleOptions;\n input: OriBuildOptions & { absWorkingDir: string };\n output: OriBuildResult;\n}): BundlerResult {\n const { options, input, output } = params;\n const { inputPath } = options;\n const { outdir: outputPath, absWorkingDir } = input;\n if (!outputPath) {\n // This shouldn't be necessary, but assert in case of future code changes...\n throw new Error('Expected ori input.outdir to be set by getOriOptions (this is a bug in Cloudpack)');\n }\n\n // outputs is a dictionary where the key is a path relative to absWorkingDir\n // (which getOriOptions sets to the repo root to work around a bug).\n // We need the BundleOutputFile.outputPath to be relative to the outputPath.\n const outputFiles: BundleOutputFile[] = Object.entries(output.metafile?.outputs || {}).map(\n ([fileOutputPath, entry]) => {\n const { entryPoint, exports } = entry;\n const entryAbsPath = entryPoint !== undefined ? path.resolve(absWorkingDir, entryPoint) : undefined;\n const outputAbsPath = path.resolve(input.absWorkingDir, fileOutputPath);\n return {\n outputPath: normalizedPathRelativeTo(outputPath, outputAbsPath),\n entryPoint: entryAbsPath ? normalizedPathRelativeTo(inputPath, entryAbsPath) : undefined,\n exports,\n };\n },\n );\n\n return {\n outputPath,\n outputFiles,\n errors: normalizeMessages({ inputPath, absWorkingDir, messages: output.errors }),\n warnings: normalizeMessages({ inputPath, absWorkingDir, messages: output.warnings }),\n rawInput: input as Record<string, unknown>,\n rawOutput: output as unknown as Record<string, unknown>,\n\n ...(options.incremental &&\n output.rebuild && {\n dispose: output.dispose,\n rebuild: async () =>\n normalizeOutput({\n options,\n input,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n output: await output.rebuild!(),\n }),\n }),\n };\n}\n\nfunction normalizeMessages(params: {\n inputPath: string;\n absWorkingDir: string;\n messages?: BuildStatusMessage[];\n}): BundleMessage[] | undefined {\n const { messages, ...pathParams } = params;\n\n const foundMessages = new Set<string>();\n return messages\n ?.map((message) => {\n const result: BundleMessage = {\n text: message.text,\n source: 'ori',\n };\n\n if (message.location) {\n result.location = normalizeLocation({ ...pathParams, location: message.location });\n }\n\n if (message.notes) {\n result.notes = message.notes.map((note) => ({\n text: '',\n location: note.location && normalizeLocation({ ...pathParams, location: note.location }),\n }));\n }\n\n if (message.pluginName) {\n // Add the plugin name to the source, since this may be relevant for debugging.\n result.source = `ori ${message.pluginName} plugin`;\n }\n\n // For some reason there can be a duplicate error message for a bad export name (shows up in\n // a test, though not sure if it's seen in the wild?) -- try to dedupe.\n const key = result.text + JSON.stringify(result.location);\n if (foundMessages.has(key)) {\n return undefined;\n }\n foundMessages.add(key);\n\n return result;\n })\n .filter((m) => !!m);\n}\n\nfunction normalizeLocation(params: {\n inputPath: string;\n location: BundleMessageLocation;\n absWorkingDir: string;\n}): BundleMessageLocation {\n const { inputPath, location, absWorkingDir } = params;\n\n const absDir = path.resolve(absWorkingDir, location.file);\n\n return {\n file: normalizeRelativePath(path.relative(inputPath, absDir)),\n line: location.line,\n column: location.column,\n };\n}\n"]}
|
package/lib/ori.d.ts
ADDED
package/lib/ori.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ori.d.ts","sourceRoot":"","sources":["../src/ori.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAK1D,eAAO,MAAM,GAAG,EAAE,OASjB,CAAC"}
|
package/lib/ori.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getOriOptions } from './getOriOptions.js';
|
|
2
|
+
import { normalizeOutput } from './normalizeOutput.js';
|
|
3
|
+
import { buildWithRetries } from './buildWithRetries.js';
|
|
4
|
+
export const ori = {
|
|
5
|
+
name: 'ori',
|
|
6
|
+
bundle: async function oriBuild(options, context) {
|
|
7
|
+
const input = await getOriOptions(options, context);
|
|
8
|
+
const output = await buildWithRetries({ oriInput: input, inputPath: options.inputPath });
|
|
9
|
+
return normalizeOutput({ options, input, output });
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=ori.js.map
|
package/lib/ori.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ori.js","sourceRoot":"","sources":["../src/ori.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,CAAC,MAAM,GAAG,GAAY;IAC1B,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK,UAAU,QAAQ,CAAC,OAAO,EAAE,OAAO;QAC9C,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAEpD,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QAEzF,OAAO,eAAe,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IACrD,CAAC;CACF,CAAC","sourcesContent":["import type { Bundler } from '@ms-cloudpack/common-types';\nimport { getOriOptions } from './getOriOptions.js';\nimport { normalizeOutput } from './normalizeOutput.js';\nimport { buildWithRetries } from './buildWithRetries.js';\n\nexport const ori: Bundler = {\n name: 'ori',\n bundle: async function oriBuild(options, context) {\n const input = await getOriOptions(options, context);\n\n const output = await buildWithRetries({ oriInput: input, inputPath: options.inputPath });\n\n return normalizeOutput({ options, input, output });\n },\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.47.9"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ms-cloudpack/bundler-ori",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "An abstraction to bundle source code using ori.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"source": "./src/index.ts",
|
|
12
|
+
"types": "./lib/index.d.ts",
|
|
13
|
+
"import": "./lib/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@ms-cloudpack/bundler-capabilities": "^0.1.25",
|
|
18
|
+
"@ms-cloudpack/bundler-utilities": "^0.1.3",
|
|
19
|
+
"@ms-cloudpack/common-types": "^0.22.0",
|
|
20
|
+
"@ms-cloudpack/package-utilities": "^10.2.3",
|
|
21
|
+
"@ms-cloudpack/path-string-parsing": "^1.2.4",
|
|
22
|
+
"@ms-cloudpack/path-utilities": "^2.7.48",
|
|
23
|
+
"@ms-cloudpack/retry": "^0.1.2",
|
|
24
|
+
"oribuild": "0.0.0-pre-alpha.15-2024082214-6bd86a4"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@ms-cloudpack/bundler-tests": "^0.1.0",
|
|
28
|
+
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
|
|
29
|
+
"@ms-cloudpack/scripts": "^0.0.1",
|
|
30
|
+
"@ms-cloudpack/test-utilities": "^0.5.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"api": "cloudpack-scripts api",
|
|
34
|
+
"build:watch": "cloudpack-scripts build-watch",
|
|
35
|
+
"build": "cloudpack-scripts build",
|
|
36
|
+
"lint:update": "cloudpack-scripts lint-update",
|
|
37
|
+
"lint": "cloudpack-scripts lint",
|
|
38
|
+
"test:update": "cloudpack-scripts test-update",
|
|
39
|
+
"test:watch": "cloudpack-scripts test-watch",
|
|
40
|
+
"test": "cloudpack-scripts test"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"lib/**/!(*.test.*)"
|
|
44
|
+
]
|
|
45
|
+
}
|