Repository navigation
ngcc: webpack support #29092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ngcc: webpack support #29092
Changes from all commits
315e91f
8954205
8332b90
0452116
4cc15da
e0d8ce1
a55c2b8
dd6b428
5124838
7884252
8951b19
149b592
e88356f
e96eef6
f0f901a
8bb1515
9b786f3
2fba449
6b555b4
745d980
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /demo |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,9 +34,9 @@ ng_package( | |
| visibility = [ | ||
| "//packages/bazel/test/ng_package:__pkg__", | ||
| "//packages/compiler-cli/integrationtest:__pkg__", | ||
| "//packages/compiler-cli/ngcc/test:__pkg__", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to merge this commit into the previous. Can you mark it as a This way it'll rebase separately, but when we actually merge the PR the commits will be combined. Otherwise, we'll have a commit in the repo at which the build will be broken (after the move, but before BUILD file updates, etc). |
||
| "//packages/compiler-cli/test:__pkg__", | ||
| "//packages/compiler-cli/test/diagnostics:__pkg__", | ||
| "//packages/compiler-cli/test/ngcc:__pkg__", | ||
|
petebacondarwin marked this conversation as resolved.
Resolved
|
||
| "//packages/compiler-cli/test/transformers:__pkg__", | ||
| "//packages/compiler/test:__pkg__", | ||
| "//packages/language-service/test:__pkg__", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /** | ||
| * @license | ||
| * Copyright Google Inc. All Rights Reserved. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license that can be | ||
| * found in the LICENSE file at https://angular.io/license | ||
| */ | ||
|
|
||
| import {hasBeenProcessed as _hasBeenProcessed} from './src/packages/build_marker'; | ||
| import {EntryPointJsonProperty, EntryPointPackageJson} from './src/packages/entry_point'; | ||
|
petebacondarwin marked this conversation as resolved.
Resolved
|
||
|
|
||
| export {NgccOptions, mainNgcc as process} from './src/main'; | ||
|
|
||
| export function hasBeenProcessed(packageJson: object, format: string) { | ||
| // We are wrapping this function to hide the internal types. | ||
| return _hasBeenProcessed(packageJson as EntryPointPackageJson, format as EntryPointJsonProperty); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/usr/bin/env node | ||
| /** | ||
| * @license | ||
| * Copyright Google Inc. All Rights Reserved. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license that can be | ||
| * found in the LICENSE file at https://angular.io/license | ||
| */ | ||
| import * as path from 'canonical-path'; | ||
| import * as yargs from 'yargs'; | ||
|
|
||
| import {mainNgcc} from './src/main'; | ||
|
|
||
| // CLI entry point | ||
| if (require.main === module) { | ||
| const args = process.argv.slice(2); | ||
| const options = | ||
| yargs | ||
| .option('s', { | ||
| alias: 'source', | ||
| describe: | ||
| 'A path (relative to the working directory) of the `node_modules` folder to process.', | ||
| default: './node_modules' | ||
| }) | ||
| .option('f', {alias: 'formats', hidden: true, array: true}) | ||
| .option('p', { | ||
| alias: 'properties', | ||
| array: true, | ||
| describe: | ||
| 'An array of names of properties in package.json to compile (e.g. `module` or `es2015`)\n' + | ||
| 'Each of these properties should hold the path to a bundle-format.\n' + | ||
| 'If provided, only the specified properties are considered for processing.\n' + | ||
| 'If not provided, all the supported format properties (e.g. fesm2015, fesm5, es2015, esm2015, esm5, main, module) in the package.json are considered.' | ||
| }) | ||
| .option('t', { | ||
| alias: 'target', | ||
| describe: | ||
| 'A relative path (from the `source` path) to a single entry-point to process (plus its dependencies).', | ||
| }) | ||
| .option('first-only', { | ||
| describe: | ||
| 'If specified then only the first matching package.json property will be compiled', | ||
| type: 'boolean' | ||
| }) | ||
| .help() | ||
| .parse(args); | ||
|
|
||
| if (options['f'] && options['f'].length) { | ||
| console.error( | ||
| 'The formats option (-f/--formats) has been removed. Consider the properties option (-p/--properties) instead.'); | ||
| process.exit(1); | ||
| } | ||
| const baseSourcePath = path.resolve(options['s'] || './node_modules'); | ||
| const propertiesToConsider: string[] = options['p']; | ||
| const targetEntryPointPath = options['t'] ? options['t'] : undefined; | ||
| const compileAllFormats = !options['first-only']; | ||
| try { | ||
| mainNgcc( | ||
| {basePath: baseSourcePath, propertiesToConsider, targetEntryPointPath, compileAllFormats}); | ||
| process.exitCode = 0; | ||
| } catch (e) { | ||
| console.error(e.stack || e.message); | ||
| process.exitCode = 1; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.