@ms-cloudpack/bundler-plugin-ori
Advanced tools
Comparing version 0.6.7 to 0.7.0
@@ -5,3 +5,32 @@ { | ||
{ | ||
"date": "Wed, 26 Oct 2022 08:13:10 GMT", | ||
"date": "Wed, 02 Nov 2022 08:10:59 GMT", | ||
"tag": "@ms-cloudpack/bundler-plugin-ori_v0.7.0", | ||
"version": "0.7.0", | ||
"comments": { | ||
"patch": [ | ||
{ | ||
"author": "email not defined", | ||
"package": "@ms-cloudpack/bundler-plugin-ori", | ||
"commit": "04fb5bc36d1e993549e284857d0faaad5325d8e8", | ||
"comment": "Update dependency @oribuild/api to v0.0.0-pre-alpha.2-e78f934" | ||
} | ||
], | ||
"minor": [ | ||
{ | ||
"author": "dzearing@microsoft.com", | ||
"package": "@ms-cloudpack/bundler-plugin-ori", | ||
"commit": "3439c51ff4eb7cb624cf84fb2881a781eabca83f", | ||
"comment": "Updating api surface to adhere to changes in bundler-types." | ||
}, | ||
{ | ||
"author": "beachball", | ||
"package": "@ms-cloudpack/bundler-plugin-ori", | ||
"comment": "Bump @ms-cloudpack/package-utilities to v1.2.0", | ||
"commit": "24143dab856b05b0b516edcb8a5cc72563ecb380" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Wed, 26 Oct 2022 08:13:21 GMT", | ||
"tag": "@ms-cloudpack/bundler-plugin-ori_v0.6.7", | ||
@@ -8,0 +37,0 @@ "version": "0.6.7", |
# Change Log - @ms-cloudpack/bundler-plugin-ori | ||
This log was last generated on Wed, 26 Oct 2022 08:13:10 GMT and should not be manually modified. | ||
This log was last generated on Wed, 02 Nov 2022 08:10:59 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 0.7.0 | ||
Wed, 02 Nov 2022 08:10:59 GMT | ||
### Minor changes | ||
- Updating api surface to adhere to changes in bundler-types. (dzearing@microsoft.com) | ||
- Bump @ms-cloudpack/package-utilities to v1.2.0 | ||
### Patches | ||
- Update dependency @oribuild/api to v0.0.0-pre-alpha.2-e78f934 (email not defined) | ||
## 0.6.7 | ||
Wed, 26 Oct 2022 08:13:10 GMT | ||
Wed, 26 Oct 2022 08:13:21 GMT | ||
@@ -11,0 +24,0 @@ ### Patches |
@@ -1,3 +0,3 @@ | ||
import type { BundlerOptions } from '@ms-cloudpack/bundler-types'; | ||
import type { BundleOptions } from '@ms-cloudpack/bundler-types'; | ||
import type { BuildOptions } from '@oribuild/api'; | ||
export declare function getOriOptions(options: BundlerOptions): Promise<BuildOptions>; | ||
export declare function getOriOptions(options: BundleOptions): BuildOptions; |
@@ -1,46 +0,41 @@ | ||
import { PackageDefinitions } from '@ms-cloudpack/package-utilities'; | ||
import { getOutbase, getOutdir } from '@ms-cloudpack/esbuild-utilities'; | ||
import { getEntriesMapFromArray } from './getEntriesMapFromArray.js'; | ||
export async function getOriOptions(options) { | ||
const { packages = PackageDefinitions.getInstance() } = options; | ||
const packageDefinition = await packages.get(options.packagePath); | ||
const isApp = options.outputType === 'app'; | ||
if (!packageDefinition) { | ||
throw new Error(`No package.json found at "${options.packagePath}"`); | ||
} | ||
// TODO: this code should be in a higher abstraction. Extract package flag settings from definition. | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access | ||
const flags = (packageDefinition.flags || []).reduce((p, flagDefinition) => { | ||
p[flagDefinition.name] = String(!!flagDefinition.value); | ||
return p; | ||
}, {}); | ||
// Translate options into esbuild config. | ||
import path from 'path'; | ||
export function getOriOptions(options) { | ||
const { inputPath, entries, outputPath, external, minify, incremental, overrideOptions = {} } = options; | ||
// Translate options into ori config. | ||
return { | ||
absWorkingDir: options.packagePath, | ||
outbase: getOutbase(options.packagePath, options.entries), | ||
outdir: getOutdir(options.packagePath, options.outputPath, options.entries), | ||
entryPoints: getEntriesMapFromArray(options.packagePath, options.entries), | ||
external: isApp | ||
? [] | ||
: [ | ||
...Object.keys(packageDefinition.dependencies || {}), | ||
...Object.keys(packageDefinition.peerDependencies || {}), | ||
...Object.keys(packageDefinition.devDependencies || {}), | ||
], | ||
incremental: options.incremental, | ||
absWorkingDir: inputPath, | ||
entryPoints: entries, | ||
outdir: outputPath ? path.resolve(inputPath, outputPath) : inputPath, | ||
external, | ||
minify: minify, | ||
incremental, | ||
splitting: true, | ||
metafile: true, | ||
...overrideOptions, | ||
define: { | ||
global: 'window', | ||
'process.env.NODE_ENV': isApp ? `"production"` : '"dev"', | ||
...flags, | ||
'process.env.NODE_ENV': minify ? `"production"` : '"dev"', | ||
...overrideOptions.define, | ||
}, | ||
minify: isApp, | ||
// platform: 'browser', | ||
// target: ['es2020'], | ||
// sourcemap: isApp && !options.disableSourceMaps, | ||
// watch: isWatch ? { onRebuild } : undefined | ||
...options.bundlerOptions?.['ori'], | ||
plugins: [ | ||
{ | ||
plugin: 'css-modules', | ||
options: { | ||
prefixClasses: false, | ||
}, | ||
}, | ||
{ | ||
plugin: 'sass', | ||
options: { | ||
prefixClasses: false, | ||
}, | ||
}, | ||
{ | ||
plugin: 'dynamic-imports', | ||
filter: '.dynamic.(js|mjs|ts|tsx)$', | ||
}, | ||
'...', | ||
], | ||
}; | ||
} | ||
//# sourceMappingURL=getOriOptions.js.map |
import type { Bundler } from '@ms-cloudpack/bundler-types'; | ||
export declare const oriBuild: Bundler; | ||
declare const oriBuild: Bundler; | ||
export default oriBuild; |
import { build } from '@oribuild/api'; | ||
import { getOriOptions } from './getOriOptions.js'; | ||
import { normalizeOutput } from './normalizeOutput.js'; | ||
import path from 'path'; | ||
import { writeJson } from '@ms-cloudpack/json-utilities'; | ||
export const oriBuild = { | ||
const oriBuild = { | ||
name: 'ori', | ||
bundle: async function oriBuild(options) { | ||
const oriOptions = await getOriOptions(options); | ||
await writeJson(path.join(options.outputPath, 'ori-input.json'), oriOptions); | ||
const oriOutput = await build(oriOptions); | ||
await writeJson(path.join(options.outputPath, 'ori-output.json'), oriOutput); | ||
return normalizeOutput(options, oriOutput); | ||
const input = getOriOptions(options); | ||
return normalizeOutput({ | ||
options, | ||
input, | ||
output: await build(input), | ||
}); | ||
}, | ||
@@ -15,0 +14,0 @@ }; |
@@ -5,9 +5,4 @@ import { createTests } from '@ms-cloudpack/bundler-plugin-tests'; | ||
bundler: bundler, | ||
cleanResult: (result) => { | ||
return { | ||
...result, | ||
outputFiles: result.outputFiles?.sort((a, b) => (a.outputPath < b.outputPath ? -1 : 1)), | ||
}; | ||
}, | ||
excluded: ['can bundle js (commonjs) into an esm library'], | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
@@ -1,3 +0,7 @@ | ||
import type { BundlerOptions, BundlerResult } from '@ms-cloudpack/bundler-types'; | ||
import type { BuildResult } from '@oribuild/api'; | ||
export declare function normalizeOutput(options: BundlerOptions, buildResult: BuildResult): BundlerResult; | ||
import type { BundleOptions, BundleResult } from '@ms-cloudpack/bundler-types'; | ||
import type { BuildOptions, BuildResult } from '@oribuild/api'; | ||
export declare function normalizeOutput({ options, input, output, }: { | ||
options: BundleOptions; | ||
input: BuildOptions; | ||
output: BuildResult; | ||
}): BundleResult; |
import { slash } from '@ms-cloudpack/path-string-parsing'; | ||
import path from 'path'; | ||
export function normalizeOutput(options, buildResult) { | ||
export function normalizeOutput({ options, input, output, }) { | ||
const outputFiles = []; | ||
if (buildResult.metafile) { | ||
const { outputs } = JSON.parse(buildResult.metafile); | ||
const { inputPath } = options; | ||
if (output.metafile) { | ||
const { outputs } = JSON.parse(output.metafile); | ||
// outputs is a dictionary where the key is a path relative to the inputPath. We need | ||
// to convert these to absolute paths so there is no confusion. | ||
for (const [outputPath, entry] of Object.entries(outputs)) { | ||
const { entryPoint, exports } = entry; | ||
const inputPath = input.absWorkingDir; | ||
outputFiles.push({ | ||
outputPath: slash(path.relative(options.outputPath, path.resolve(options.packagePath, outputPath))), | ||
outputPath: slash(path.resolve(inputPath, outputPath)), | ||
entryPoint, | ||
@@ -18,8 +22,27 @@ exports, | ||
outputFiles, | ||
errors: buildResult.errors, | ||
warnings: buildResult.warnings, | ||
dispose: buildResult.dispose, | ||
rebuild: async () => normalizeOutput(options, await buildResult.rebuild()), | ||
errors: normalizeMessages(inputPath, output.errors), | ||
warnings: normalizeMessages(inputPath, output.warnings), | ||
rawInput: input, | ||
rawOutput: output, | ||
...(options.incremental && { | ||
dispose: output.dispose, | ||
rebuild: async () => normalizeOutput({ | ||
options, | ||
input, | ||
output: await output.rebuild(), | ||
}), | ||
}), | ||
}; | ||
} | ||
function normalizeMessages(inputPath, messages) { | ||
return messages?.map((message) => message.location | ||
? { | ||
...message, | ||
location: { | ||
...message.location, | ||
file: slash(path.resolve(inputPath, message.location.file)), | ||
}, | ||
} | ||
: message); | ||
} | ||
//# sourceMappingURL=normalizeOutput.js.map |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.33.4" | ||
"packageVersion": "7.33.5" | ||
} | ||
] | ||
} |
{ | ||
"name": "@ms-cloudpack/bundler-plugin-ori", | ||
"version": "0.6.7", | ||
"version": "0.7.0", | ||
"description": "An abstraction to bundle source code using ori.", | ||
@@ -18,6 +18,6 @@ "license": "MIT", | ||
"@ms-cloudpack/json-utilities": "^0.0.4", | ||
"@ms-cloudpack/package-utilities": "^1.1.0", | ||
"@ms-cloudpack/package-utilities": "^1.2.0", | ||
"@ms-cloudpack/path-utilities": "^1.1.0", | ||
"@ms-cloudpack/path-string-parsing": "^1.0.0", | ||
"@oribuild/api": "0.0.0-pre-alpha.2-911d08a" | ||
"@oribuild/api": "0.0.0-pre-alpha.2-e78f934" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54492
20
1179
+ Added@oribuild/api@0.0.0-pre-alpha.2-e78f934(transitive)
+ Addedoriservice-darwin-amd64@0.0.0-pre-alpha.2-e78f934(transitive)
+ Addedoriservice-darwin-arm64@0.0.0-pre-alpha.2-e78f934(transitive)
+ Addedoriservice-linux-amd64@0.0.0-pre-alpha.2-e78f934(transitive)
+ Addedoriservice-linux-arm64@0.0.0-pre-alpha.2-e78f934(transitive)
+ Addedoriservice-windows-amd64@0.0.0-pre-alpha.2-e78f934(transitive)
+ Addedoriservice-windows-arm64@0.0.0-pre-alpha.2-e78f934(transitive)
- Removed@oribuild/api@0.0.0-pre-alpha.2-911d08a(transitive)
- Removedoriservice-darwin-amd64@0.0.0-pre-alpha.2-911d08a(transitive)
- Removedoriservice-darwin-arm64@0.0.0-pre-alpha.2-911d08a(transitive)
- Removedoriservice-linux-amd64@0.0.0-pre-alpha.2-911d08a(transitive)
- Removedoriservice-linux-arm64@0.0.0-pre-alpha.2-911d08a(transitive)
- Removedoriservice-windows-amd64@0.0.0-pre-alpha.2-911d08a(transitive)
- Removedoriservice-windows-arm64@0.0.0-pre-alpha.2-911d08a(transitive)