diff --git a/packages/animations/BUILD.bazel b/packages/animations/BUILD.bazel index 9fa900b517..ece5ccdc67 100644 --- a/packages/animations/BUILD.bazel +++ b/packages/animations/BUILD.bazel @@ -24,10 +24,6 @@ ng_package( "//packages/animations/browser/testing:package.json", ], entry_point = "packages/animations/index.js", - secondary_entry_points = [ - "browser", - "browser/testing", - ], deps = [ ":animations", "//packages/animations/browser", diff --git a/packages/bazel/src/ng_module.bzl b/packages/bazel/src/ng_module.bzl index 3b165cd94c..19553d764b 100644 --- a/packages/bazel/src/ng_module.bzl +++ b/packages/bazel/src/ng_module.bzl @@ -253,46 +253,53 @@ def _ts_expected_outs(ctx, label): return _expected_outs(ctx) def _write_bundle_index(ctx): - basename = "_%s.bundle_index" % ctx.label.name - tsconfig_file = ctx.actions.declare_file("%s.tsconfig.json" % basename) - metadata_file = ctx.actions.declare_file("%s.metadata.json" % basename) - tstyping_file = ctx.actions.declare_file("%s.d.ts" % basename) - js_file = ctx.actions.declare_file("%s.js" % basename) + # Provide a default for the flat_module_out_file attribute. + # We cannot use the default="" parameter of ctx.attr because the value is calculated + # from other attributes (name) + flat_module_out_file = ctx.attr.flat_module_out_file if ctx.attr.flat_module_out_file else "%s_public_index" % ctx.label.name + + tsconfig_file = ctx.actions.declare_file("%s.tsconfig.json" % flat_module_out_file) + metadata_file = ctx.actions.declare_file("%s.metadata.json" % flat_module_out_file) + typings_file = ctx.actions.declare_file("%s.d.ts" % flat_module_out_file) + index_file = ctx.actions.declare_file("%s.js" % flat_module_out_file) tsconfig = dict(tsc_wrapped_tsconfig(ctx, ctx.files.srcs, ctx.files.srcs), **{ "angularCompilerOptions": { - "flatModuleOutFile": basename, + "flatModuleOutFile": flat_module_out_file, }, }) - if ctx.attr.module_name: - tsconfig["angularCompilerOptions"]["flatModuleId"] = ctx.attr.module_name + if not ctx.attr.module_name: + fail("Only ng_module with a module_name attribute should be exposed as flat module") + tsconfig["angularCompilerOptions"]["flatModuleId"] = ctx.attr.module_name entry_point = ctx.attr.entry_point if ctx.attr.entry_point else "index.ts" # createBundleIndexHost in bundle_index_host.ts will throw if the "files" has more than one entry. # We don't want to fail() here, however, because not all ng_module's will have the bundle index written. # So we make the assumption that the index.ts file in the highest parent directory is the entry point. - index_file = None + index = None for f in tsconfig["files"]: if f.endswith("/" + entry_point): - if not index_file or len(f) < len(index_file): - index_file = f + if not index or len(f) < len(index): + index = f - if index_file: - tsconfig["files"] = [index_file] + if index: + tsconfig["files"] = [index] ctx.actions.write(tsconfig_file, json_marshal(tsconfig)) - outputs = [metadata_file, tstyping_file, js_file] - ctx.action( progress_message = "Producing metadata for bundle %s" % ctx.label.name, executable = ctx.executable._index_bundler, inputs = ctx.files.srcs + [tsconfig_file], - outputs = outputs, + outputs = [metadata_file, typings_file, index_file], arguments = ["-p", tsconfig_file.path], ) - return outputs + return struct( + module_name = ctx.attr.module_name, + metadata_file = metadata_file, + typings_file = typings_file, + index_file = index_file) def ng_module_impl(ctx, ts_compile_actions, ivy = False): """Implementation function for the ng_module rule. @@ -326,13 +333,12 @@ def ng_module_impl(ctx, ts_compile_actions, ivy = False): # Only produces the flattened "index bundle" metadata when requested by some other rule # and only under Bazel - if hasattr(ctx.executable, "_index_bundler"): - bundle_index_metadata = _write_bundle_index(ctx) - providers["angular"]["flat_module_metadata"] = depset(bundle_index_metadata, - transitive = [ - d.angular.flat_module_metadata - for d in ctx.attr.deps - if hasattr(d, "angular")]) + if hasattr(ctx.executable, "_index_bundler") and ctx.attr.module_name: + bundle_index_metadata = [_write_bundle_index(ctx)] + else: + bundle_index_metadata = [] + + providers["angular"]["flat_module_metadata"] = depset(bundle_index_metadata) return providers @@ -392,6 +398,15 @@ NG_MODULE_RULE_ATTRS = dict(dict(COMMON_ATTRIBUTES, **NG_MODULE_ATTRIBUTES), **{ "entry_point": attr.string(), + # Default is %{name}_public_index + # The suffix points to the generated "bundle index" files that users import from + # The default is intended to avoid collisions with the users input files. + # Later packaging rules will point to these generated files as the entry point + # into the package. + # See the flatModuleOutFile documentation in + # https://github.com/angular/angular/blob/master/packages/compiler-cli/src/transformers/api.ts + "flat_module_out_file": attr.string(), + "_index_bundler": attr.label( executable = True, cfg = "host", diff --git a/packages/bazel/src/ng_package/ng_package.bzl b/packages/bazel/src/ng_package/ng_package.bzl index 485c638090..959cf92a4e 100644 --- a/packages/bazel/src/ng_package/ng_package.bzl +++ b/packages/bazel/src/ng_package/ng_package.bzl @@ -116,7 +116,12 @@ def _ng_package_impl(ctx): if f.path.endswith(".js"): esm2015.append(struct(js = f, map = None)) - for entry_point in [""] + ctx.attr.secondary_entry_points: + entry_points = [] + for dep in ctx.attr.deps: + if dep.label.package.startswith(ctx.label.package): + entry_points.append(dep.label.package[len(ctx.label.package) + 1:]) + + for entry_point in entry_points: es2015_entry_point = "/".join([p for p in [ ctx.bin_dir.path, ctx.label.package, @@ -158,9 +163,14 @@ def _ng_package_impl(ctx): config_name = entry_point.replace("/", "_")) bundles.append(struct(js = min_output, map = uglify_sourcemap)) - metadata_files = depset(transitive = [getattr(dep, "angular").flat_module_metadata - for dep in ctx.attr.deps - if hasattr(dep, "angular")]) + inputs = ( + ctx.files.srcs + + esm5_sources.to_list() + + depset(transitive = [d.typescript.transitive_declarations + for d in ctx.attr.deps + if hasattr(d, "typescript")]).to_list() + + [f.js for f in esm2015 + esm5 + bundles] + + [f.map for f in esm2015 + esm5 + bundles if f.map]) args = ctx.actions.args() args.use_param_file("%s", use_always = True) @@ -168,33 +178,47 @@ def _ng_package_impl(ctx): # The order of arguments matters here, as they are read in order in packager.ts. args.add(npm_package_directory.path) args.add(ctx.label.package) - args.add(primary_entry_point_name(ctx.attr.name, ctx.attr.entry_point)) - args.add(ctx.attr.secondary_entry_points, join_with=",") args.add([ctx.bin_dir.path, ctx.label.package], join_with="/") - args.add(ctx.file.readme_md.path if ctx.file.readme_md else "") + + flat_module_metadata = depset(transitive = [ + getattr(dep, "angular").flat_module_metadata + for dep in ctx.attr.deps + if hasattr(dep, "angular")]) + # Marshal the metadata into a JSON string so we can parse the data structure + # in the TypeScript program easily. + metadata_arg = {} + for m in flat_module_metadata.to_list(): + inputs.extend([m.index_file, m.typings_file, m.metadata_file]) + metadata_arg[m.module_name] = { + "index": m.index_file.path, + "typings": m.typings_file.path, + "metadata": m.metadata_file.path, + } + args.add(str(metadata_arg)) + + if ctx.file.readme_md: + inputs.append(ctx.file.readme_md) + args.add(ctx.file.readme_md.path) + else: + # placeholder + args.add("") + args.add(_flatten_paths(esm2015), join_with=",") args.add(_flatten_paths(esm5), join_with=",") args.add(_flatten_paths(bundles), join_with=",") args.add([s.path for s in ctx.files.srcs], join_with=",") - args.add(ctx.file.license_banner.path if ctx.file.license_banner else "") - other_inputs = (metadata_files.to_list() + - [f.js for f in esm2015 + esm5 + bundles] + - [f.map for f in esm2015 + esm5 + bundles if f.map]) - if ctx.file.readme_md: - other_inputs.append(ctx.file.readme_md) if ctx.file.license_banner: - other_inputs.append(ctx.file.license_banner) + inputs.append(ctx.file.license_banner) + args.add(ctx.file.license_banner.path) + else: + # placeholder + args.add("") ctx.actions.run( progress_message = "Angular Packaging: building npm package for %s" % ctx.label.name, mnemonic = "AngularPackage", - inputs = esm5_sources.to_list() + - depset(transitive = [d.typescript.transitive_declarations - for d in ctx.attr.deps - if hasattr(d, "typescript")]).to_list() + - ctx.files.srcs + - other_inputs, + inputs = inputs, outputs = [npm_package_directory], executable = ctx.executable._ng_packager, arguments = [args], @@ -220,7 +244,6 @@ NG_PACKAGE_ATTRS = dict(NPM_PACKAGE_ATTRS, **dict(ROLLUP_ATTRS, **{ "include_devmode_srcs": attr.bool(default = False), "readme_md": attr.label(allow_single_file = FileType([".md"])), "globals": attr.string_dict(default={}), - "secondary_entry_points": attr.string_list(), "_ng_packager": attr.label( default=Label("//packages/bazel/src/ng_package:packager"), executable=True, cfg="host"), diff --git a/packages/bazel/src/ng_package/packager.ts b/packages/bazel/src/ng_package/packager.ts index 9215e36ac6..d618f83961 100644 --- a/packages/bazel/src/ng_package/packager.ts +++ b/packages/bazel/src/ng_package/packager.ts @@ -18,10 +18,11 @@ function main(args: string[]): number { // bazel (see https://docs.bazel.build/versions/master/skylark/lib/Args.html#use_param_file). const paramFilePath = args[0]; - // Paramaters are specified in the file one per line. Empty params are represented as two - // single-quotes, so turn these into real empty strings.. - const params = - fs.readFileSync(paramFilePath, 'utf-8').split('\n').map(s => s === '\'\'' ? '' : s); + // Bazel params may be surrounded with quotes + function unquoteParameter(s: string) { return s.replace(/^'(.*)'$/, '$1'); } + + // Parameters are specified in the file one per line. + const params = fs.readFileSync(paramFilePath, 'utf-8').split('\n').map(unquoteParameter); const [ // Output directory for the npm package. @@ -30,23 +31,28 @@ function main(args: string[]): number { // The package segment of the ng_package rule's label (e.g. 'package/common'). srcDir, - // Path to the JS file for the primaery entry point (e.g. 'packages/common/index.js') - primaryEntryPoint, - - // List of secondary entry-points (e.g. ['http', 'http/testing']). - secondaryEntryPointsArg, - // The bazel-bin dir joined with the srcDir (e.g. 'bazel-bin/package.common'). // This is the intended output location for package artifacts. binDir, + // JSON data mapping each entry point to the generated bundle index and + // flat module metadata, for example + // {"@angular/core": { + // "index": "packages/core/core.js", + // "typing": "packages/core/core.d.ts", + // "metadata": "packages/core/core.metadata.json" + // }, + // ... + // } + modulesManifestArg, + // Path to the package's README.md. readmeMd, // List of ES2015 files generated by rollup. esm2015Arg, - // List of flattenned, ES5 files generated by rollup. + // List of flattened, ES5 files generated by rollup. esm5Arg, // List of all UMD bundles generated by rollup. @@ -56,65 +62,100 @@ function main(args: string[]): number { srcsArg, // Path to the package's LICENSE. - licenseFile] = params; + licenseFile, + ] = params; const esm2015 = esm2015Arg.split(',').filter(s => !!s); const esm5 = esm5Arg.split(',').filter(s => !!s); const bundles = bundlesArg.split(',').filter(s => !!s); const srcs = srcsArg.split(',').filter(s => !!s); - const secondaryEntryPoints = secondaryEntryPointsArg.split(',').filter(s => !!s); - - shx.mkdir('-p', out); + const modulesManifest = JSON.parse(modulesManifestArg); if (readmeMd) { - shx.cp(readmeMd, path.join(out, 'README.md')); + copyFile(readmeMd, out); } - function writeEsmFile(file, suffix, outDir) { + /** + * Relativize the path where the file is written. + * @param f a path relative to the srcDir, typically from a file in the srcs[] + * @param c content of the file + */ + function writeSrcFile(f: string, c: string) { + mkDirWriteFile(path.join(out, path.relative(srcDir, f)), c); + } + + /** + * Relativize the path where the file is written. + * @param f a path relative to the binDir, typically from a file in the deps[] + * @param c content of the file + */ + function writeBinFile(f: string, c: string) { + const outputPath = path.join(out, path.relative(binDir, f)); + mkDirWriteFile(outputPath, c); + return outputPath; + } + + /** + * Copy the file, relativizing the path. + * @param f a path relative to the binDir, typically from a file in the deps[] + */ + function copyBinFile(f: string) { writeBinFile(f, fs.readFileSync(f, 'utf-8')); } + + /** + * Relativize the path where a file is written. + * @param file a path containing a re-rooted segment like .esm5 or .es6 + * @param suffix the re-rooted directory + * @param outDir path where we copy the file, relative to the out + */ + function writeEsmFile(file: string, suffix: string, outDir: string) { const root = file.substr(0, file.lastIndexOf(suffix + path.sep) + suffix.length + 1); - const rel = path.relative(path.join(root, srcDir), file); + const rel = path.dirname(path.relative(path.join(root, srcDir), file)); if (!rel.startsWith('..')) { - writeFile(file, rel, path.join(out, outDir)); + copyFile(file, path.join(out, outDir), rel); } } + esm2015.forEach(file => writeEsmFile(file, '.es6', 'esm2015')); esm5.forEach(file => writeEsmFile(file, '.esm5', 'esm5')); - const bundlesDir = path.join(out, 'bundles'); - shx.mkdir('-p', bundlesDir); - bundles.forEach(bundle => { shx.cp(bundle, bundlesDir); }); + bundles.forEach(bundle => { copyFile(bundle, out, 'bundles'); }); const allsrcs = shx.find('-R', binDir); allsrcs.filter(hasFileExtension('.d.ts')).forEach((f: string) => { const content = fs.readFileSync(f, 'utf-8') // Strip the named AMD module for compatibility with non-bazel users .replace(/^\/\/\/ \n/, ''); - let outputPath: string; - if (f.endsWith('.bundle_index.d.ts')) { - outputPath = moveBundleIndex(f); - } else { - outputPath = path.join(out, path.relative(binDir, f)); - } - shx.mkdir('-p', path.dirname(outputPath)); - fs.writeFileSync(outputPath, content); + const outputPath = writeBinFile(f, content); }); - allsrcs.filter(hasFileExtension('.bundle_index.js')).forEach((f: string) => { - const content = fs.readFileSync(f, 'utf-8'); - fs.writeFileSync(moveBundleIndex(f, 'esm5'), content); - fs.writeFileSync(moveBundleIndex(f, 'esm2015'), content); + + // Iterate through the entry point modules + // We do this first because we also record new paths for the esm5 and esm2015 copies + // of the index JS file, which we need to amend the package.json. + Object.keys(modulesManifest).forEach(moduleName => { + const moduleFiles = modulesManifest[moduleName]; + const indexContent = fs.readFileSync(moduleFiles['index'], 'utf-8'); + const relative = path.relative(binDir, moduleFiles['index']); + + moduleFiles['esm5_index'] = path.join(binDir, 'esm5', relative); + moduleFiles['esm2015_index'] = path.join(binDir, 'esm2015', relative); + + writeBinFile(moduleFiles['esm5_index'], indexContent); + writeBinFile(moduleFiles['esm2015_index'], indexContent); + + copyBinFile(moduleFiles['typings']); + copyBinFile(moduleFiles['metadata']); }); // Root package name (e.g. '@angular/common'), captures as we iterate through sources below. let rootPackageName = ''; const packagesWithExistingPackageJson = new Set(); - // Modify source files as necessary for publishing, including updating the - // version placeholders and the paths in any package.json files. for (const src of srcs) { let content = fs.readFileSync(src, 'utf-8'); + // Modify package.json files as necessary for publishing if (path.basename(src) === 'package.json') { const packageJson = JSON.parse(content); - content = amendPackageJson(packageJson); + content = amendPackageJson(src, packageJson); const packageName = packageJson['name']; packagesWithExistingPackageJson.add(packageName); @@ -126,141 +167,140 @@ function main(args: string[]): number { rootPackageName = packageJson['name']; } } - const outputPath = path.join(out, path.relative(srcDir, src)); - shx.mkdir('-p', path.dirname(outputPath)); - fs.writeFileSync(outputPath, content); + writeSrcFile(src, content); } - allsrcs.filter(hasFileExtension('.bundle_index.metadata.json')).forEach((f: string) => { - fs.writeFileSync(moveBundleIndex(f), fs.readFileSync(f, 'utf-8')); - }); - const licenseBanner = licenseFile ? fs.readFileSync(licenseFile, 'utf-8') : ''; // Generate extra files for secondary entry-points. - for (const secondaryEntryPoint of secondaryEntryPoints) { - const entryPointName = secondaryEntryPoint.split('/').pop(); - const entryPointPackageName = `${rootPackageName}/${secondaryEntryPoint}`; + Object.keys(modulesManifest).forEach(entryPointPackageName => { + const entryPointName = entryPointPackageName.substr(rootPackageName.length + 1); + if (!entryPointName) return; - const dirName = path.join(...secondaryEntryPoint.split('/').slice(0, -1)); - const destDir = path.join(out, dirName); - - createMetadataReexportFile(destDir, entryPointName); - createTypingsReexportFile(destDir, entryPointName, licenseBanner); + createMetadataReexportFile(entryPointName, modulesManifest[entryPointPackageName]['metadata']); + createTypingsReexportFile( + entryPointName, licenseBanner, modulesManifest[entryPointPackageName]['typings']); if (!packagesWithExistingPackageJson.has(entryPointPackageName)) { - createEntryPointPackageJson(path.join(destDir, entryPointName), entryPointPackageName); + createEntryPointPackageJson(entryPointName, entryPointPackageName); } - } + }); return 0; - // Copy these bundle_index outputs from the ng_module rules in the deps - // Mapping looks like: - // $bin/_core.bundle_index.d.ts - // -> $out/core.d.ts - // $bin/testing/_testing.bundle_index.d.ts - // -> $out/testing/testing.d.ts - // $bin/_core.bundle_index.metadata.json - // -> $out/core.metadata.json - // $bin/testing/_testing.bundle_index.metadata.json - // -> $out/testing/testing.metadata.json - // JS is a little different, as controlled by the `dir` parameter - // $bin/_core.bundle_index.js - // -> $out/esm5/core.js - // $bin/testing/_testing.bundle_index.js - // -> $out/esm5/testing.js - function moveBundleIndex(f: string, dir = '.') { - const relative = path.relative(binDir, f); - return path.join(out, dir, relative.replace(/_(.*)\.bundle_index/, '$1')); + /** + * Convert a binDir-relative path to srcDir-relative + * @param from path to a file under the srcDir, like packages/core/testing/package.json + * @param file path to a file under the binDir, like bazel-bin/core/testing/generated.js + */ + function srcDirRelative(from: string, file: string) { + const result = + path.relative(path.dirname(from), path.join(srcDir, path.relative(binDir, file))); + if (result.startsWith('..')) return result; + return `./${result}`; } -} -/** Gets a predicate function to filter non-generated files with a specified extension. */ -function hasFileExtension(ext: string): (path: string) => boolean { - return f => f.endsWith(ext) && !f.endsWith(`.ngfactory${ext}`) && !f.endsWith(`.ngsummary${ext}`); -} + /** Gets a predicate function to filter non-generated files with a specified extension. */ + function hasFileExtension(ext: string): (path: string) => boolean { + return f => f.endsWith(ext) && !f.endsWith(`.ngfactory${ext}`) && + !f.endsWith(`.ngsummary${ext}`); + } -function writeFile(file: string, relative: string, baseDir: string) { - const dir = path.join(baseDir, path.dirname(relative)); - shx.mkdir('-p', dir); - shx.cp(file, dir); -} + function mkDirWriteFile(p: string, content: string) { + shx.mkdir('-p', path.dirname(p)); + fs.writeFileSync(p, content, 'utf-8'); + } -function writeFesm(file: string, baseDir: string) { - const parts = path.basename(file).split('__'); - const entryPointName = parts.join('/').replace(/\..*/, ''); - const filename = parts.splice(-1)[0]; - const dir = path.join(baseDir, ...parts); - shx.mkdir('-p', dir); - shx.cp(file, dir); - shx.mv(path.join(dir, path.basename(file)), path.join(dir, filename)); -} + function copyFile(file: string, baseDir: string, relative = '.') { + const dir = path.join(baseDir, relative); + shx.mkdir('-p', dir); + shx.cp(file, dir); + } -/** - * Inserts or edits properties into the package.json file(s) in the package so that - * they point to all the right generated artifacts. - * - * @param parsedPackage Parsed package.json content - */ -function amendPackageJson(parsedPackage: object) { - const packageName = parsedPackage['name']; - const nameParts = getPackageNameParts(packageName); - const relativePathToPackageRoot = getRelativePathToPackageRoot(packageName); - const basename = nameParts[nameParts.length - 1]; - const indexName = [...nameParts, `${basename}.js`].splice(1).join('/'); + function copyFesm(file: string, baseDir: string) { + const parts = path.basename(file).split('__'); + const entryPointName = parts.join('/').replace(/\..*/, ''); + const filename = parts.splice(-1)[0]; + const dir = path.join(baseDir, ...parts); + shx.mkdir('-p', dir); + shx.cp(file, dir); + shx.mv(path.join(dir, path.basename(file)), path.join(dir, filename)); + } - parsedPackage['main'] = `${relativePathToPackageRoot}/bundles/${nameParts.join('-')}.umd.js`; - parsedPackage['module'] = `${relativePathToPackageRoot}/esm5/${indexName}`; - parsedPackage['es2015'] = `${relativePathToPackageRoot}/esm2015/${indexName}`; - parsedPackage['typings'] = `./${basename}.d.ts`; - return JSON.stringify(parsedPackage, null, 2); -} + /** + * Inserts or edits properties into the package.json file(s) in the package so that + * they point to all the right generated artifacts. + * + * @param parsedPackage Parsed package.json content + */ + function amendPackageJson(packageJson: string, parsedPackage: {[key: string]: string}) { + const packageName = parsedPackage['name']; + const moduleFiles = modulesManifest[packageName]; + if (!moduleFiles) { + // Ideally we should throw here, as we got an entry point that doesn't + // have flat module metadata / bundle index, so it may have been an + // ng_module that's missing a module_name attribute. + // However, @angular/compiler can't be an ng_module, as it's the internals + // of the ngc compiler, yet we want to build an ng_package for it. + // So ignore package.json files when we are missing data. + console.error('WARNING: no module metadata for package', packageName); + console.error(' Not updating the package.json file to point to it'); + return JSON.stringify(parsedPackage, null, 2); + } -/** Gets a package name split into parts, omitting the scope if present. */ -function getPackageNameParts(fullPackageName: string): string[] { - const parts = fullPackageName.split('/'); - return fullPackageName.startsWith('@') ? parts.splice(1) : parts; -} + parsedPackage['main'] = getUmdBundleName(packageName); + parsedPackage['module'] = parsedPackage['esm5'] = + srcDirRelative(packageJson, moduleFiles['esm5_index']); + parsedPackage['es2015'] = parsedPackage['esm2015'] = + srcDirRelative(packageJson, moduleFiles['esm2015_index']); + parsedPackage['typings'] = srcDirRelative(packageJson, moduleFiles['typings']); + return JSON.stringify(parsedPackage, null, 2); + } -/** Gets the relative path to the package root from a given entry-point import path. */ -function getRelativePathToPackageRoot(entryPointPath: string) { - const parts = getPackageNameParts(entryPointPath); - const relativePath = Array(parts.length - 1).fill('..').join('/'); - return relativePath || '.'; -} + // e.g. @angular/common/http/testing -> ../../bundles/common-http-testing.umd.js + function getUmdBundleName(packageName: string) { + const parts = packageName.split('/'); + // Remove the scoped package part, like @angular if present + const nameParts = packageName.startsWith('@') ? parts.splice(1) : parts; + const relativePath = Array(nameParts.length - 1).fill('..').join('/') || '.'; + return `${relativePath}/bundles/${nameParts.join('-')}.umd.js`; + } -/** Creates metadata re-export file for a secondary entry-point. */ -function createMetadataReexportFile(destDir: string, entryPointName: string) { - fs.writeFileSync(path.join(destDir, `${entryPointName}.metadata.json`), JSON.stringify({ - '__symbolic': 'module', - 'version': 3, - 'metadata': {}, - 'exports': [{'from': `./${entryPointName}/${entryPointName}`}], - 'flatModuleIndexRedirect': true - }) + '\n'); -} + /** Creates metadata re-export file for a secondary entry-point. */ + function createMetadataReexportFile(entryPointName: string, metadataFile: string) { + const inputPath = path.join(srcDir, `${entryPointName}.metadata.json`); + writeSrcFile(inputPath, JSON.stringify({ + '__symbolic': 'module', + 'version': 3, + 'metadata': {}, + 'exports': + [{'from': `${srcDirRelative(inputPath, metadataFile.replace(/.metadata.json$/, ''))}`}], + 'flatModuleIndexRedirect': true + }) + '\n'); + } -/** - * Creates a typings (d.ts) re-export file for a secondary-entry point, - * e.g., `export * from './common/common'` - */ -function createTypingsReexportFile(destDir: string, entryPointName: string, license: string) { - // Format carefully to match existing build.sh output: - // LICENSE SPACE NEWLINE SPACE EXPORT NEWLINE - const content = `${license} \n export * from \'./${entryPointName}/${entryPointName}\n`; - fs.writeFileSync(path.join(destDir, `${entryPointName}.d.ts`), content); -} + /** + * Creates a typings (d.ts) re-export file for a secondary-entry point, + * e.g., `export * from './common/common'` + */ + function createTypingsReexportFile(entryPointName: string, license: string, typingsFile: string) { + const inputPath = path.join(srcDir, `${entryPointName}.d.ts`); + const content = `${license} + export * from '${srcDirRelative(inputPath, typingsFile.replace(/\.d\.tsx?$/, ''))}'; + `; + writeSrcFile(inputPath, content); + } -/** - * Creates a package.json for a secondary entry-point. - * @param destDir Directory into which the package.json will be written. - * @param entryPointPackageName The full package name for the entry point, - * e.g. '@angular/common/http'. - */ -function createEntryPointPackageJson(destDir: string, entryPointPackageName: string) { - const content = amendPackageJson({name: entryPointPackageName}); - fs.writeFileSync(path.join(destDir, 'package.json'), content, 'utf-8'); + /** + * Creates a package.json for a secondary entry-point. + * @param entryPointPackageName The full package name for the entry point, + * e.g. '@angular/common/http'. + */ + function createEntryPointPackageJson(dir: string, entryPointPackageName: string) { + const pkgJson = path.join(srcDir, dir, 'package.json'); + const content = amendPackageJson(pkgJson, {name: entryPointPackageName}); + writeSrcFile(pkgJson, content); + } } if (require.main === module) { diff --git a/packages/bazel/src/ng_package/tsconfig.json b/packages/bazel/src/ng_package/tsconfig.json index 8abeba288c..e9b6c07f85 100644 --- a/packages/bazel/src/ng_package/tsconfig.json +++ b/packages/bazel/src/ng_package/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { - "lib": ["es2015"] + "noImplicitAny": true, + "lib": ["es2015"] } } diff --git a/packages/bazel/test/ng_package/BUILD.bazel b/packages/bazel/test/ng_package/BUILD.bazel index 5c1a4b3127..6f512fbca3 100644 --- a/packages/bazel/test/ng_package/BUILD.bazel +++ b/packages/bazel/test/ng_package/BUILD.bazel @@ -1,5 +1,5 @@ load("//tools:defaults.bzl", "ts_library") -load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") +load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test", "nodejs_binary") exports_files(["package.json"]) @@ -37,7 +37,6 @@ jasmine_node_test( ts_library( name = "example_spec_lib", - testonly = True, srcs = ["example_package.spec.ts"], deps = ["//packages:types"], ) @@ -45,5 +44,19 @@ ts_library( jasmine_node_test( name = "example_package", srcs = [":example_spec_lib"], - data = ["//packages/bazel/test/ng_package/example:npm_package"], + data = [ + "example_package.golden", + "//packages/bazel/test/ng_package/example:npm_package", + ], +) + +nodejs_binary( + name = "example_package.accept", + data = [ + "example_package.golden", + ":example_spec_lib", + "//packages/bazel/test/ng_package/example:npm_package", + ], + entry_point = "angular/packages/bazel/test/ng_package/example_package.spec.js", + templated_args = ["--accept"], ) diff --git a/packages/bazel/test/ng_package/example/BUILD.bazel b/packages/bazel/test/ng_package/example/BUILD.bazel index 73b26c1562..cba62be187 100644 --- a/packages/bazel/test/ng_package/example/BUILD.bazel +++ b/packages/bazel/test/ng_package/example/BUILD.bazel @@ -5,6 +5,7 @@ load("//packages/bazel:index.bzl", "ng_module", "ng_package") ng_module( name = "example", srcs = glob(["*.ts"]), + module_name = "example", deps = ["//packages/bazel/test/ng_package/example/secondary"], ) @@ -13,9 +14,10 @@ ng_package( srcs = [ "package.json", "some-file.txt", - "//packages/bazel/test/ng_package/example/secondary:package.json", ], entry_point = "packages/bazel/test/ng_package/example/index.js", - secondary_entry_points = ["secondary"], - deps = [":example"], + deps = [ + ":example", + "//packages/bazel/test/ng_package/example/secondary", + ], ) diff --git a/packages/bazel/test/ng_package/example/secondary/BUILD.bazel b/packages/bazel/test/ng_package/example/secondary/BUILD.bazel index def3a382ed..1026b1636a 100644 --- a/packages/bazel/test/ng_package/example/secondary/BUILD.bazel +++ b/packages/bazel/test/ng_package/example/secondary/BUILD.bazel @@ -2,10 +2,9 @@ package(default_visibility = ["//packages/bazel/test:__subpackages__"]) load("//packages/bazel:index.bzl", "ng_module") -exports_files(["package.json"]) - ng_module( name = "secondary", srcs = glob(["*.ts"]), + module_name = "example/secondary", deps = ["//packages/core"], ) diff --git a/packages/bazel/test/ng_package/example/secondary/package.json b/packages/bazel/test/ng_package/example/secondary/package.json deleted file mode 100644 index 7aed970b84..0000000000 --- a/packages/bazel/test/ng_package/example/secondary/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "example/secondary" -} diff --git a/packages/bazel/test/ng_package/example_package.golden b/packages/bazel/test/ng_package/example_package.golden new file mode 100644 index 0000000000..95dc9b3ecc --- /dev/null +++ b/packages/bazel/test/ng_package/example_package.golden @@ -0,0 +1,741 @@ +bundles + bundles/example-secondary.umd.js + bundles/example-secondary.umd.js.map + bundles/example-secondary.umd.min.js + bundles/example-secondary.umd.min.js.map + bundles/example.umd.js + bundles/example.umd.js.map + bundles/example.umd.min.js + bundles/example.umd.min.js.map +esm2015 + esm2015/example.externs.js + esm2015/example_public_index.js + esm2015/index.js + esm2015/index.ngfactory.js + esm2015/index.ngsummary.js + esm2015/mymodule.js + esm2015/mymodule.ngfactory.js + esm2015/mymodule.ngsummary.js + esm2015/secondary + esm2015/secondary/index.js + esm2015/secondary/index.ngfactory.js + esm2015/secondary/index.ngsummary.js + esm2015/secondary/secondary.externs.js + esm2015/secondary/secondary_public_index.js + esm2015/secondary/secondarymodule.js + esm2015/secondary/secondarymodule.ngfactory.js + esm2015/secondary/secondarymodule.ngsummary.js +esm5 + esm5/example_public_index.js + esm5/index.js + esm5/index.ngfactory.js + esm5/index.ngsummary.js + esm5/mymodule.js + esm5/mymodule.ngfactory.js + esm5/mymodule.ngsummary.js + esm5/secondary + esm5/secondary/index.js + esm5/secondary/index.ngfactory.js + esm5/secondary/index.ngsummary.js + esm5/secondary/secondary_public_index.js + esm5/secondary/secondarymodule.js + esm5/secondary/secondarymodule.ngfactory.js + esm5/secondary/secondarymodule.ngsummary.js +example_public_index.d.ts +example_public_index.metadata.json +index.d.ts +mymodule.d.ts +package.json +secondary + secondary/index.d.ts + secondary/package.json + secondary/secondary_public_index.d.ts + secondary/secondary_public_index.metadata.json + secondary/secondarymodule.d.ts +secondary.d.ts +secondary.metadata.json +some-file.txt +--- bundles/example-secondary.umd.js --- + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) : + typeof define === 'function' && define.amd ? define(['exports', '@angular/core'], factory) : + (factory((global.npm_package = {}),global.core)); +}(this, (function (exports,core) { 'use strict'; + +/** + * @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 + */ +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var SecondaryModule = /** @class */ (function () { + function SecondaryModule() { + } + SecondaryModule = __decorate([ + core.NgModule({}) + ], SecondaryModule); + return SecondaryModule; +}()); +var a = 1; + +/** + * @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 + */ + +exports.SecondaryModule = SecondaryModule; +exports.a = a; + +Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=example-secondary.umd.js.map + + +--- bundles/example-secondary.umd.js.map --- + +{"version":3,"file":"example-secondary.umd.js","sources":["../../../../../../../../../../../../execroot/angular/bazel-bin/packages/bazel/test/ng_package/example/secondary/secondary.esm5/packages/bazel/test/ng_package/example/secondary/index.js"],"sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { NgModule } from '@angular/core';\nvar SecondaryModule = /** @class */ (function () {\n function SecondaryModule() {\n }\n SecondaryModule = __decorate([\n NgModule({})\n ], SecondaryModule);\n return SecondaryModule;\n}());\nexport { SecondaryModule };\nexport var a = 1;\n\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vjb25kYXJ5bW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvc2Vjb25kYXJ5L3NlY29uZGFyeW1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7QUFFSCxPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBR3ZDO0lBQUE7SUFDQSxDQUFDO0lBRFksZUFBZTtRQUQzQixRQUFRLENBQUMsRUFBRSxDQUFDO09BQ0EsZUFBZSxDQUMzQjtJQUFELHNCQUFDO0NBQUEsQUFERCxJQUNDO1NBRFksZUFBZTtBQUc1QixNQUFNLENBQUMsSUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEdvb2dsZSBJbmMuIEFsbCBSaWdodHMgUmVzZXJ2ZWQuXG4gKlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgYW4gTUlULXN0eWxlIGxpY2Vuc2UgdGhhdCBjYW4gYmVcbiAqIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUgYXQgaHR0cHM6Ly9hbmd1bGFyLmlvL2xpY2Vuc2VcbiAqL1xuXG5pbXBvcnQge05nTW9kdWxlfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuQE5nTW9kdWxlKHt9KVxuZXhwb3J0IGNsYXNzIFNlY29uZGFyeU1vZHVsZSB7XG59XG5cbmV4cG9ydCBjb25zdCBhID0gMTtcbiJdfQ==","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nexport * from './secondarymodule';\n\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9zZWNvbmRhcnkvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsY0FBYyxtQkFBbUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCBHb29nbGUgSW5jLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5pby9saWNlbnNlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9zZWNvbmRhcnltb2R1bGUnO1xuIl19"],"names":["this","NgModule"],"mappings":";;;;;;AAAA;;;;;;;AAOA,IAAI,UAAU,GAAG,CAACA,SAAI,IAAIA,SAAI,CAAC,UAAU,KAAK,UAAU,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE;IACnF,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IAC7H,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;SAC1H,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAClJ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACjE,CAAC;AACF,AACA,IAAI,eAAe,kBAAkB,YAAY;IAC7C,SAAS,eAAe,GAAG;KAC1B;IACD,eAAe,GAAG,UAAU,CAAC;QACzBC,aAAQ,CAAC,EAAE,CAAC;KACf,EAAE,eAAe,CAAC,CAAC;IACpB,OAAO,eAAe,CAAC;CAC1B,EAAE,CAAC,CAAC;AACL,AACO,IAAI,CAAC,GAAG,CAAC;;ACvBhB;;;;;;GAMG;;;;;;;;;;;;;"} + +--- bundles/example-secondary.umd.min.js --- + +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@angular/core"],t):t(e.npm_package={},e.core)}(this,function(e,t){"use strict"; +/** + * @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 + */var o=function(){return function(e,t,o,n){var r,c=arguments.length,f=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(e,t,o,n);else for(var u=e.length-1;u>=0;u--)(r=e[u])&&(f=(c<3?r(f):c>3?r(t,o,f):r(t,o))||f);return c>3&&f&&Object.defineProperty(t,o,f),f}([t.NgModule({})],function e(){})}(); +/** + * @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 + */ +e.SecondaryModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})}); + +--- bundles/example-secondary.umd.min.js.map --- + +{"version":3,"sources":["packages/bazel/test/ng_package/example/example-secondary.umd.js"],"names":["global","factory","exports","module","require","define","amd","npm_package","core","this","SecondaryModule","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","__decorate","NgModule","a","value"],"mappings":"CAAC,SAAUA,EAAQC,GACC,iBAAZC,SAA0C,oBAAXC,OAAyBF,EAAQC,QAASE,QAAQ,kBACtE,mBAAXC,QAAyBA,OAAOC,IAAMD,QAAQ,UAAW,iBAAkBJ,GACjFA,EAASD,EAAOO,eAAkBP,EAAOQ,MAH3C,CAIEC,KAAM,SAAWP,EAAQM,GAAQ;;;;;;;GASnC,IAMIE,EAAiC,WAMjC,OAZoD,SAAUC,EAAYC,EAAQC,EAAKC,GACvF,IAA2HC,EAAvHC,EAAIC,UAAUC,OAAQC,EAAIH,EAAI,EAAIJ,EAAkB,OAATE,EAAgBA,EAAOM,OAAOC,yBAAyBT,EAAQC,GAAOC,EACrH,GAAuB,iBAAZQ,SAAoD,mBAArBA,QAAQC,SAAyBJ,EAAIG,QAAQC,SAASZ,EAAYC,EAAQC,EAAKC,QACpH,IAAK,IAAIU,EAAIb,EAAWO,OAAS,EAAGM,GAAK,EAAGA,KAAST,EAAIJ,EAAWa,MAAIL,GAAKH,EAAI,EAAID,EAAEI,GAAKH,EAAI,EAAID,EAAEH,EAAQC,EAAKM,GAAKJ,EAAEH,EAAQC,KAASM,GAChJ,OAAOH,EAAI,GAAKG,GAAKC,OAAOK,eAAeb,EAAQC,EAAKM,GAAIA,EAK1CO,EACdlB,EAAKmB,cAHT,SAASjB,OADuB;;;;;;;;AAkBpCR,EAAQQ,gBAAkBA,EAC1BR,EAAQ0B,EAXA,EAaRR,OAAOK,eAAevB,EAAS,cAAgB2B,OAAO","sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :\n\ttypeof define === 'function' && define.amd ? define(['exports', '@angular/core'], factory) :\n\t(factory((global.npm_package = {}),global.core));\n}(this, (function (exports,core) { 'use strict';\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar SecondaryModule = /** @class */ (function () {\n function SecondaryModule() {\n }\n SecondaryModule = __decorate([\n core.NgModule({})\n ], SecondaryModule);\n return SecondaryModule;\n}());\nvar a = 1;\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexports.SecondaryModule = SecondaryModule;\nexports.a = a;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=example-secondary.umd.js.map\n"]} + +--- bundles/example.umd.js --- + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) : + typeof define === 'function' && define.amd ? define(['exports', '@angular/core'], factory) : + (factory((global.npm_package = {}),global.core)); +}(this, (function (exports,core) { 'use strict'; + +/** + * @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 + */ +var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var MyModule = /** @class */ (function () { + function MyModule() { + } + MyModule = __decorate([ + core.NgModule({}) + ], MyModule); + return MyModule; +}()); + +/** + * @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 + */ + +exports.MyModule = MyModule; + +Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=example.umd.js.map + + +--- bundles/example.umd.js.map --- + +{"version":3,"file":"example.umd.js","sources":["../../../../../../../../../../../../execroot/angular/bazel-bin/packages/bazel/test/ng_package/example/example.esm5/packages/bazel/test/ng_package/example/index.js"],"sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { NgModule } from '@angular/core';\nvar MyModule = /** @class */ (function () {\n function MyModule() {\n }\n MyModule = __decorate([\n NgModule({})\n ], MyModule);\n return MyModule;\n}());\nexport { MyModule };\n\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXltb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9teW1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7QUFFSCxPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBSXZDO0lBQUE7SUFDQSxDQUFDO0lBRFksUUFBUTtRQURwQixRQUFRLENBQUMsRUFBRSxDQUFDO09BQ0EsUUFBUSxDQUNwQjtJQUFELGVBQUM7Q0FBQSxBQURELElBQ0M7U0FEWSxRQUFRIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEdvb2dsZSBJbmMuIEFsbCBSaWdodHMgUmVzZXJ2ZWQuXG4gKlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgYW4gTUlULXN0eWxlIGxpY2Vuc2UgdGhhdCBjYW4gYmVcbiAqIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUgYXQgaHR0cHM6Ly9hbmd1bGFyLmlvL2xpY2Vuc2VcbiAqL1xuXG5pbXBvcnQge05nTW9kdWxlfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7YX0gZnJvbSAnLi9zZWNvbmRhcnkvc2Vjb25kYXJ5bW9kdWxlJztcblxuQE5nTW9kdWxlKHt9KVxuZXhwb3J0IGNsYXNzIE15TW9kdWxlIHtcbn0iXX0=","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nexport * from './mymodule';\n\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxjQUFjLFlBQVksQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCBHb29nbGUgSW5jLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5pby9saWNlbnNlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9teW1vZHVsZSc7Il19"],"names":["this","NgModule"],"mappings":";;;;;;AAAA;;;;;;;AAOA,IAAI,UAAU,GAAG,CAACA,SAAI,IAAIA,SAAI,CAAC,UAAU,KAAK,UAAU,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE;IACnF,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IAC7H,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;SAC1H,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAClJ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACjE,CAAC;AACF,AACA,IAAI,QAAQ,kBAAkB,YAAY;IACtC,SAAS,QAAQ,GAAG;KACnB;IACD,QAAQ,GAAG,UAAU,CAAC;QAClBC,aAAQ,CAAC,EAAE,CAAC;KACf,EAAE,QAAQ,CAAC,CAAC;IACb,OAAO,QAAQ,CAAC;CACnB,EAAE,CAAC;;ACrBJ;;;;;;GAMG;;;;;;;;;;;;"} + +--- bundles/example.umd.min.js --- + +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@angular/core"],t):t(e.npm_package={},e.core)}(this,function(e,t){"use strict"; +/** + * @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 + */var o=function(){return function(e,t,o,n){var r,c=arguments.length,f=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(e,t,o,n);else for(var u=e.length-1;u>=0;u--)(r=e[u])&&(f=(c<3?r(f):c>3?r(t,o,f):r(t,o))||f);return c>3&&f&&Object.defineProperty(t,o,f),f}([t.NgModule({})],function e(){})}(); +/** + * @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 + */ +e.MyModule=o,Object.defineProperty(e,"__esModule",{value:!0})}); + +--- bundles/example.umd.min.js.map --- + +{"version":3,"sources":["packages/bazel/test/ng_package/example/example.umd.js"],"names":["global","factory","exports","module","require","define","amd","npm_package","core","this","MyModule","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","__decorate","NgModule","value"],"mappings":"CAAC,SAAUA,EAAQC,GACC,iBAAZC,SAA0C,oBAAXC,OAAyBF,EAAQC,QAASE,QAAQ,kBACtE,mBAAXC,QAAyBA,OAAOC,IAAMD,QAAQ,UAAW,iBAAkBJ,GACjFA,EAASD,EAAOO,eAAkBP,EAAOQ,MAH3C,CAIEC,KAAM,SAAWP,EAAQM,GAAQ;;;;;;;GASnC,IAMIE,EAA0B,WAM1B,OAZoD,SAAUC,EAAYC,EAAQC,EAAKC,GACvF,IAA2HC,EAAvHC,EAAIC,UAAUC,OAAQC,EAAIH,EAAI,EAAIJ,EAAkB,OAATE,EAAgBA,EAAOM,OAAOC,yBAAyBT,EAAQC,GAAOC,EACrH,GAAuB,iBAAZQ,SAAoD,mBAArBA,QAAQC,SAAyBJ,EAAIG,QAAQC,SAASZ,EAAYC,EAAQC,EAAKC,QACpH,IAAK,IAAIU,EAAIb,EAAWO,OAAS,EAAGM,GAAK,EAAGA,KAAST,EAAIJ,EAAWa,MAAIL,GAAKH,EAAI,EAAID,EAAEI,GAAKH,EAAI,EAAID,EAAEH,EAAQC,EAAKM,GAAKJ,EAAEH,EAAQC,KAASM,GAChJ,OAAOH,EAAI,GAAKG,GAAKC,OAAOK,eAAeb,EAAQC,EAAKM,GAAIA,EAKjDO,EACPlB,EAAKmB,cAHT,SAASjB,OADgB;;;;;;;;AAiB7BR,EAAQQ,SAAWA,EAEnBU,OAAOK,eAAevB,EAAS,cAAgB0B,OAAO","sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :\n\ttypeof define === 'function' && define.amd ? define(['exports', '@angular/core'], factory) :\n\t(factory((global.npm_package = {}),global.core));\n}(this, (function (exports,core) { 'use strict';\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar MyModule = /** @class */ (function () {\n function MyModule() {\n }\n MyModule = __decorate([\n core.NgModule({})\n ], MyModule);\n return MyModule;\n}());\n\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexports.MyModule = MyModule;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=example.umd.js.map\n"]} + +--- esm2015/example.externs.js --- + +/** @externs */ +/** + * @externs + * @suppress {duplicate,checkTypes} + */ +// NOTE: generated by tsickle, do not edit. + + +--- esm2015/example_public_index.js --- + +/** + * Generated bundle index. Do not edit. + */ +export * from './index'; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhhbXBsZV9wdWJsaWNfaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9leGFtcGxlX3B1YmxpY19pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ== + +--- esm2015/index.js --- + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +/** + * @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 + */ +export { MyModule } from './mymodule'; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQVFBLHlCQUFjLFlBQVksQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCBHb29nbGUgSW5jLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5pby9saWNlbnNlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9teW1vZHVsZSc7Il19 + +--- esm2015/index.ngfactory.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgubmdmYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvaW5kZXgubmdmYWN0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmkwLkNvbXBvbmVudEZhY3Rvcnk7XG4iXX0= + +--- esm2015/index.ngsummary.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgubmdzdW1tYXJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvaW5kZXgubmdzdW1tYXJ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmkwLkNvbXBvbmVudEZhY3Rvcnk7XG4iXX0= + +--- esm2015/mymodule.js --- + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +/** + * @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 { NgModule } from '@angular/core'; +export class MyModule { +} +MyModule.decorators = [ + { type: NgModule, args: [{},] } +]; +/** @nocollapse */ +MyModule.ctorParameters = () => []; +function MyModule_tsickle_Closure_declarations() { + /** @type {!Array<{type: !Function, args: (undefined|!Array)}>} */ + MyModule.decorators; + /** + * @nocollapse + * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array)}>)})>} + */ + MyModule.ctorParameters; +} + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXltb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9teW1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQVFBLE9BQU8sRUFBQyxRQUFRLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFJdkMsTUFBTTs7O1lBREwsUUFBUSxTQUFDLEVBQUUiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgR29vZ2xlIEluYy4gQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbiAqXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhbiBNSVQtc3R5bGUgbGljZW5zZSB0aGF0IGNhbiBiZVxuICogZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZSBhdCBodHRwczovL2FuZ3VsYXIuaW8vbGljZW5zZVxuICovXG5cbmltcG9ydCB7TmdNb2R1bGV9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHthfSBmcm9tICcuL3NlY29uZGFyeS9zZWNvbmRhcnltb2R1bGUnO1xuXG5ATmdNb2R1bGUoe30pXG5leHBvcnQgY2xhc3MgTXlNb2R1bGUge1xufSJdfQ== + +--- esm2015/mymodule.ngfactory.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ +import * as i0 from "@angular/core"; +import * as i1 from "angular/packages/bazel/test/ng_package/example/mymodule"; +var MyModuleNgFactory = i0.ɵcmf(i1.MyModule, [], function (_l) { return i0.ɵmod([i0.ɵmpd(512, i0.ComponentFactoryResolver, i0.ɵCodegenComponentFactoryResolver, [[8, []], [3, i0.ComponentFactoryResolver], i0.NgModuleRef]), i0.ɵmpd(1073742336, i1.MyModule, i1.MyModule, [])]); }); +export { MyModuleNgFactory as MyModuleNgFactory }; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXltb2R1bGUubmdmYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvbXltb2R1bGUubmdmYWN0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCAqIGFzIGkxIGZyb20gJ2FuZ3VsYXIvcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvbXltb2R1bGUnO1xuZXhwb3J0IGNvbnN0IE15TW9kdWxlTmdGYWN0b3J5OmkwLk5nTW9kdWxlRmFjdG9yeTxpMS5NeU1vZHVsZT4gPSAobnVsbCBhcyBhbnkpO1xudmFyIF9kZWNsMF8wOmkwLlRlbXBsYXRlUmVmPGFueT4gPSAoPGFueT4obnVsbCBhcyBhbnkpKTtcbnZhciBfZGVjbDBfMTppMC5FbGVtZW50UmVmPGFueT4gPSAoPGFueT4obnVsbCBhcyBhbnkpKTtcbiJdfQ== + +--- esm2015/mymodule.ngsummary.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ +import * as i0 from "angular/packages/bazel/test/ng_package/example/mymodule"; +export function MyModuleNgSummary() { return [{ summaryKind: 2, type: { reference: i0.MyModule, diDeps: [], lifecycleHooks: [] }, entryComponents: [], providers: [], modules: [{ reference: i0.MyModule, diDeps: [], lifecycleHooks: [] }], exportedDirectives: [], exportedPipes: [] }]; } + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXltb2R1bGUubmdzdW1tYXJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvbXltb2R1bGUubmdzdW1tYXJ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmkwLkNvbXBvbmVudEZhY3Rvcnk7XG5leHBvcnQgZnVuY3Rpb24gTXlNb2R1bGVOZ1N1bW1hcnkoKTphbnlbXSB7XG4gIHJldHVybiAobnVsbCBhcyBhbnkpO1xufVxuIl19 + +--- esm2015/secondary/index.js --- + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +/** + * @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 + */ +export { SecondaryModule, a } from './secondarymodule'; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9zZWNvbmRhcnkvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7QUFRQSxtQ0FBYyxtQkFBbUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCBHb29nbGUgSW5jLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5pby9saWNlbnNlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9zZWNvbmRhcnltb2R1bGUnO1xuIl19 + +--- esm2015/secondary/index.ngfactory.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgubmdmYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvc2Vjb25kYXJ5L2luZGV4Lm5nZmFjdG9yeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgaTAgZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pMC5Db21wb25lbnRGYWN0b3J5O1xuIl19 + +--- esm2015/secondary/index.ngsummary.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgubmdzdW1tYXJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvc2Vjb25kYXJ5L2luZGV4Lm5nc3VtbWFyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgaTAgZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pMC5Db21wb25lbnRGYWN0b3J5O1xuIl19 + +--- esm2015/secondary/secondary.externs.js --- + +/** @externs */ +/** + * @externs + * @suppress {duplicate,checkTypes} + */ +// NOTE: generated by tsickle, do not edit. + + +--- esm2015/secondary/secondary_public_index.js --- + +/** + * Generated bundle index. Do not edit. + */ +export * from './index'; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vjb25kYXJ5X3B1YmxpY19pbmRleC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2JhemVsL3Rlc3QvbmdfcGFja2FnZS9leGFtcGxlL3NlY29uZGFyeS9zZWNvbmRhcnlfcHVibGljX2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19 + +--- esm2015/secondary/secondarymodule.js --- + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +/** + * @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 { NgModule } from '@angular/core'; +export class SecondaryModule { +} +SecondaryModule.decorators = [ + { type: NgModule, args: [{},] } +]; +/** @nocollapse */ +SecondaryModule.ctorParameters = () => []; +function SecondaryModule_tsickle_Closure_declarations() { + /** @type {!Array<{type: !Function, args: (undefined|!Array)}>} */ + SecondaryModule.decorators; + /** + * @nocollapse + * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array)}>)})>} + */ + SecondaryModule.ctorParameters; +} +export const /** @type {?} */ a = 1; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vjb25kYXJ5bW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvc2Vjb25kYXJ5L3NlY29uZGFyeW1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQVFBLE9BQU8sRUFBQyxRQUFRLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFHdkMsTUFBTTs7O1lBREwsUUFBUSxTQUFDLEVBQUU7Ozs7Ozs7Ozs7Ozs7QUFJWixNQUFNLENBQUMsdUJBQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCBHb29nbGUgSW5jLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5pby9saWNlbnNlXG4gKi9cblxuaW1wb3J0IHtOZ01vZHVsZX0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5cbkBOZ01vZHVsZSh7fSlcbmV4cG9ydCBjbGFzcyBTZWNvbmRhcnlNb2R1bGUge1xufVxuXG5leHBvcnQgY29uc3QgYSA9IDE7XG4iXX0= + +--- esm2015/secondary/secondarymodule.ngfactory.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ +import * as i0 from "@angular/core"; +import * as i1 from "angular/packages/bazel/test/ng_package/example/secondary/secondarymodule"; +var SecondaryModuleNgFactory = i0.ɵcmf(i1.SecondaryModule, [], function (_l) { return i0.ɵmod([i0.ɵmpd(512, i0.ComponentFactoryResolver, i0.ɵCodegenComponentFactoryResolver, [[8, []], [3, i0.ComponentFactoryResolver], i0.NgModuleRef]), i0.ɵmpd(1073742336, i1.SecondaryModule, i1.SecondaryModule, [])]); }); +export { SecondaryModuleNgFactory as SecondaryModuleNgFactory }; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vjb25kYXJ5bW9kdWxlLm5nZmFjdG9yeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2JhemVsL3Rlc3QvbmdfcGFja2FnZS9leGFtcGxlL3NlY29uZGFyeS9zZWNvbmRhcnltb2R1bGUubmdmYWN0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCAqIGFzIGkxIGZyb20gJ2FuZ3VsYXIvcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvc2Vjb25kYXJ5L3NlY29uZGFyeW1vZHVsZSc7XG5leHBvcnQgY29uc3QgU2Vjb25kYXJ5TW9kdWxlTmdGYWN0b3J5OmkwLk5nTW9kdWxlRmFjdG9yeTxpMS5TZWNvbmRhcnlNb2R1bGU+ID0gKG51bGwgYXMgYW55KTtcbnZhciBfZGVjbDBfMDppMC5UZW1wbGF0ZVJlZjxhbnk+ID0gKDxhbnk+KG51bGwgYXMgYW55KSk7XG52YXIgX2RlY2wwXzE6aTAuRWxlbWVudFJlZjxhbnk+ID0gKDxhbnk+KG51bGwgYXMgYW55KSk7XG4iXX0= + +--- esm2015/secondary/secondarymodule.ngsummary.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ +import * as i0 from "angular/packages/bazel/test/ng_package/example/secondary/secondarymodule"; +export function SecondaryModuleNgSummary() { return [{ summaryKind: 2, type: { reference: i0.SecondaryModule, diDeps: [], lifecycleHooks: [] }, entryComponents: [], providers: [], modules: [{ reference: i0.SecondaryModule, diDeps: [], lifecycleHooks: [] }], exportedDirectives: [], exportedPipes: [] }]; } + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vjb25kYXJ5bW9kdWxlLm5nc3VtbWFyeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2JhemVsL3Rlc3QvbmdfcGFja2FnZS9leGFtcGxlL3NlY29uZGFyeS9zZWNvbmRhcnltb2R1bGUubmdzdW1tYXJ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmkwLkNvbXBvbmVudEZhY3Rvcnk7XG5leHBvcnQgZnVuY3Rpb24gU2Vjb25kYXJ5TW9kdWxlTmdTdW1tYXJ5KCk6YW55W10ge1xuICByZXR1cm4gKG51bGwgYXMgYW55KTtcbn1cbiJdfQ== + +--- esm5/example_public_index.js --- + +/** + * Generated bundle index. Do not edit. + */ +export * from './index'; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhhbXBsZV9wdWJsaWNfaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9leGFtcGxlX3B1YmxpY19pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ== + +--- esm5/index.js --- + +/** + * @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 + */ +export * from './mymodule'; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxjQUFjLFlBQVksQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCBHb29nbGUgSW5jLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5pby9saWNlbnNlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9teW1vZHVsZSc7Il19 + +--- esm5/index.ngfactory.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgubmdmYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvaW5kZXgubmdmYWN0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmkwLkNvbXBvbmVudEZhY3Rvcnk7XG4iXX0= + +--- esm5/index.ngsummary.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgubmdzdW1tYXJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvaW5kZXgubmdzdW1tYXJ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmkwLkNvbXBvbmVudEZhY3Rvcnk7XG4iXX0= + +--- esm5/mymodule.js --- + +/** + * @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 + */ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { NgModule } from '@angular/core'; +var MyModule = /** @class */ (function () { + function MyModule() { + } + MyModule = __decorate([ + NgModule({}) + ], MyModule); + return MyModule; +}()); +export { MyModule }; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXltb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9teW1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7QUFFSCxPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBSXZDO0lBQUE7SUFDQSxDQUFDO0lBRFksUUFBUTtRQURwQixRQUFRLENBQUMsRUFBRSxDQUFDO09BQ0EsUUFBUSxDQUNwQjtJQUFELGVBQUM7Q0FBQSxBQURELElBQ0M7U0FEWSxRQUFRIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEdvb2dsZSBJbmMuIEFsbCBSaWdodHMgUmVzZXJ2ZWQuXG4gKlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgYW4gTUlULXN0eWxlIGxpY2Vuc2UgdGhhdCBjYW4gYmVcbiAqIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUgYXQgaHR0cHM6Ly9hbmd1bGFyLmlvL2xpY2Vuc2VcbiAqL1xuXG5pbXBvcnQge05nTW9kdWxlfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7YX0gZnJvbSAnLi9zZWNvbmRhcnkvc2Vjb25kYXJ5bW9kdWxlJztcblxuQE5nTW9kdWxlKHt9KVxuZXhwb3J0IGNsYXNzIE15TW9kdWxlIHtcbn0iXX0= + +--- esm5/mymodule.ngfactory.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ +import * as i0 from "@angular/core"; +import * as i1 from "angular/packages/bazel/test/ng_package/example/mymodule"; +var MyModuleNgFactory = i0.ɵcmf(i1.MyModule, [], function (_l) { return i0.ɵmod([i0.ɵmpd(512, i0.ComponentFactoryResolver, i0.ɵCodegenComponentFactoryResolver, [[8, []], [3, i0.ComponentFactoryResolver], i0.NgModuleRef]), i0.ɵmpd(1073742336, i1.MyModule, i1.MyModule, [])]); }); +export { MyModuleNgFactory as MyModuleNgFactory }; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXltb2R1bGUubmdmYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvbXltb2R1bGUubmdmYWN0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCAqIGFzIGkxIGZyb20gJ2FuZ3VsYXIvcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvbXltb2R1bGUnO1xuZXhwb3J0IGNvbnN0IE15TW9kdWxlTmdGYWN0b3J5OmkwLk5nTW9kdWxlRmFjdG9yeTxpMS5NeU1vZHVsZT4gPSAobnVsbCBhcyBhbnkpO1xudmFyIF9kZWNsMF8wOmkwLlRlbXBsYXRlUmVmPGFueT4gPSAoPGFueT4obnVsbCBhcyBhbnkpKTtcbnZhciBfZGVjbDBfMTppMC5FbGVtZW50UmVmPGFueT4gPSAoPGFueT4obnVsbCBhcyBhbnkpKTtcbiJdfQ== + +--- esm5/mymodule.ngsummary.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ +import * as i0 from "angular/packages/bazel/test/ng_package/example/mymodule"; +export function MyModuleNgSummary() { return [{ summaryKind: 2, type: { reference: i0.MyModule, diDeps: [], lifecycleHooks: [] }, entryComponents: [], providers: [], modules: [{ reference: i0.MyModule, diDeps: [], lifecycleHooks: [] }], exportedDirectives: [], exportedPipes: [] }]; } + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXltb2R1bGUubmdzdW1tYXJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvbXltb2R1bGUubmdzdW1tYXJ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmkwLkNvbXBvbmVudEZhY3Rvcnk7XG5leHBvcnQgZnVuY3Rpb24gTXlNb2R1bGVOZ1N1bW1hcnkoKTphbnlbXSB7XG4gIHJldHVybiAobnVsbCBhcyBhbnkpO1xufVxuIl19 + +--- esm5/secondary/index.js --- + +/** + * @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 + */ +export * from './secondarymodule'; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9iYXplbC90ZXN0L25nX3BhY2thZ2UvZXhhbXBsZS9zZWNvbmRhcnkvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsY0FBYyxtQkFBbUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCBHb29nbGUgSW5jLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5pby9saWNlbnNlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9zZWNvbmRhcnltb2R1bGUnO1xuIl19 + +--- esm5/secondary/index.ngfactory.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgubmdmYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvc2Vjb25kYXJ5L2luZGV4Lm5nZmFjdG9yeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgaTAgZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pMC5Db21wb25lbnRGYWN0b3J5O1xuIl19 + +--- esm5/secondary/index.ngsummary.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgubmdzdW1tYXJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvc2Vjb25kYXJ5L2luZGV4Lm5nc3VtbWFyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgaTAgZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pMC5Db21wb25lbnRGYWN0b3J5O1xuIl19 + +--- esm5/secondary/secondary_public_index.js --- + +/** + * Generated bundle index. Do not edit. + */ +export * from './index'; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vjb25kYXJ5X3B1YmxpY19pbmRleC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2JhemVsL3Rlc3QvbmdfcGFja2FnZS9leGFtcGxlL3NlY29uZGFyeS9zZWNvbmRhcnlfcHVibGljX2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19 + +--- esm5/secondary/secondarymodule.js --- + +/** + * @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 + */ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import { NgModule } from '@angular/core'; +var SecondaryModule = /** @class */ (function () { + function SecondaryModule() { + } + SecondaryModule = __decorate([ + NgModule({}) + ], SecondaryModule); + return SecondaryModule; +}()); +export { SecondaryModule }; +export var a = 1; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vjb25kYXJ5bW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvc2Vjb25kYXJ5L3NlY29uZGFyeW1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7QUFFSCxPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBR3ZDO0lBQUE7SUFDQSxDQUFDO0lBRFksZUFBZTtRQUQzQixRQUFRLENBQUMsRUFBRSxDQUFDO09BQ0EsZUFBZSxDQUMzQjtJQUFELHNCQUFDO0NBQUEsQUFERCxJQUNDO1NBRFksZUFBZTtBQUc1QixNQUFNLENBQUMsSUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEdvb2dsZSBJbmMuIEFsbCBSaWdodHMgUmVzZXJ2ZWQuXG4gKlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgYW4gTUlULXN0eWxlIGxpY2Vuc2UgdGhhdCBjYW4gYmVcbiAqIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUgYXQgaHR0cHM6Ly9hbmd1bGFyLmlvL2xpY2Vuc2VcbiAqL1xuXG5pbXBvcnQge05nTW9kdWxlfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuQE5nTW9kdWxlKHt9KVxuZXhwb3J0IGNsYXNzIFNlY29uZGFyeU1vZHVsZSB7XG59XG5cbmV4cG9ydCBjb25zdCBhID0gMTtcbiJdfQ== + +--- esm5/secondary/secondarymodule.ngfactory.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ +import * as i0 from "@angular/core"; +import * as i1 from "angular/packages/bazel/test/ng_package/example/secondary/secondarymodule"; +var SecondaryModuleNgFactory = i0.ɵcmf(i1.SecondaryModule, [], function (_l) { return i0.ɵmod([i0.ɵmpd(512, i0.ComponentFactoryResolver, i0.ɵCodegenComponentFactoryResolver, [[8, []], [3, i0.ComponentFactoryResolver], i0.NgModuleRef]), i0.ɵmpd(1073742336, i1.SecondaryModule, i1.SecondaryModule, [])]); }); +export { SecondaryModuleNgFactory as SecondaryModuleNgFactory }; + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vjb25kYXJ5bW9kdWxlLm5nZmFjdG9yeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2JhemVsL3Rlc3QvbmdfcGFja2FnZS9leGFtcGxlL3NlY29uZGFyeS9zZWNvbmRhcnltb2R1bGUubmdmYWN0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCAqIGFzIGkxIGZyb20gJ2FuZ3VsYXIvcGFja2FnZXMvYmF6ZWwvdGVzdC9uZ19wYWNrYWdlL2V4YW1wbGUvc2Vjb25kYXJ5L3NlY29uZGFyeW1vZHVsZSc7XG5leHBvcnQgY29uc3QgU2Vjb25kYXJ5TW9kdWxlTmdGYWN0b3J5OmkwLk5nTW9kdWxlRmFjdG9yeTxpMS5TZWNvbmRhcnlNb2R1bGU+ID0gKG51bGwgYXMgYW55KTtcbnZhciBfZGVjbDBfMDppMC5UZW1wbGF0ZVJlZjxhbnk+ID0gKDxhbnk+KG51bGwgYXMgYW55KSk7XG52YXIgX2RlY2wwXzE6aTAuRWxlbWVudFJlZjxhbnk+ID0gKDxhbnk+KG51bGwgYXMgYW55KSk7XG4iXX0= + +--- esm5/secondary/secondarymodule.ngsummary.js --- + +/** + * @fileoverview This file was generated by the Angular template compiler. Do not edit. + * + * @suppress {suspiciousCode,uselessCode,missingProperties,missingOverride,checkTypes} + * tslint:disable + */ +import * as i0 from "angular/packages/bazel/test/ng_package/example/secondary/secondarymodule"; +export function SecondaryModuleNgSummary() { return [{ summaryKind: 2, type: { reference: i0.SecondaryModule, diDeps: [], lifecycleHooks: [] }, entryComponents: [], providers: [], modules: [{ reference: i0.SecondaryModule, diDeps: [], lifecycleHooks: [] }], exportedDirectives: [], exportedPipes: [] }]; } + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Vjb25kYXJ5bW9kdWxlLm5nc3VtbWFyeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2JhemVsL3Rlc3QvbmdfcGFja2FnZS9leGFtcGxlL3NlY29uZGFyeS9zZWNvbmRhcnltb2R1bGUubmdzdW1tYXJ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpMCBmcm9tICdAYW5ndWxhci9jb3JlJztcbmkwLkNvbXBvbmVudEZhY3Rvcnk7XG5leHBvcnQgZnVuY3Rpb24gU2Vjb25kYXJ5TW9kdWxlTmdTdW1tYXJ5KCk6YW55W10ge1xuICByZXR1cm4gKG51bGwgYXMgYW55KTtcbn1cbiJdfQ== + +--- example_public_index.d.ts --- + +/** + * Generated bundle index. Do not edit. + */ +export * from './index'; + + +--- example_public_index.metadata.json --- + +{"__symbolic":"module","version":4,"metadata":{"MyModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":11,"character":1},"arguments":[{}]}],"members":{}}},"origins":{"MyModule":"./mymodule"},"importAs":"example"} + +--- index.d.ts --- + +/** + * @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 + */ +export * from './mymodule'; + + +--- mymodule.d.ts --- + +export declare class MyModule { +} + + +--- package.json --- + +{ + "name": "example", + "main": "./bundles/example.umd.js", + "esm5": "./esm5/example_public_index.js", + "module": "./esm5/example_public_index.js", + "esm2015": "./esm2015/example_public_index.js", + "es2015": "./esm2015/example_public_index.js", + "typings": "./example_public_index.d.ts" +} + +--- secondary/index.d.ts --- + +/** + * @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 + */ +export * from './secondarymodule'; + + +--- secondary/package.json --- + +{ + "name": "example/secondary", + "main": "../bundles/example-secondary.umd.js", + "esm5": "../esm5/secondary/secondary_public_index.js", + "module": "../esm5/secondary/secondary_public_index.js", + "esm2015": "../esm2015/secondary/secondary_public_index.js", + "es2015": "../esm2015/secondary/secondary_public_index.js", + "typings": "./secondary_public_index.d.ts" +} + +--- secondary/secondary_public_index.d.ts --- + +/** + * Generated bundle index. Do not edit. + */ +export * from './index'; + + +--- secondary/secondary_public_index.metadata.json --- + +{"__symbolic":"module","version":4,"metadata":{"SecondaryModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":10,"character":1},"arguments":[{}]}],"members":{}},"a":1},"origins":{"SecondaryModule":"./secondarymodule","a":"./secondarymodule"},"importAs":"example/secondary"} + +--- secondary/secondarymodule.d.ts --- + +export declare class SecondaryModule { +} +export declare const a = 1; + + +--- secondary.d.ts --- + + + export * from './secondary/secondary_public_index'; + + +--- secondary.metadata.json --- + +{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./secondary/secondary_public_index"}],"flatModuleIndexRedirect":true} + + +--- some-file.txt --- + +This file is just copied into the package. + diff --git a/packages/bazel/test/ng_package/example_package.spec.ts b/packages/bazel/test/ng_package/example_package.spec.ts index fd0064dab8..570cbdfc1e 100644 --- a/packages/bazel/test/ng_package/example_package.spec.ts +++ b/packages/bazel/test/ng_package/example_package.spec.ts @@ -8,62 +8,52 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as shx from 'shelljs'; -const UTF8 = { - encoding: 'utf-8' -}; +const TEST_DIR = path.resolve(path.join('packages', 'bazel', 'test', 'ng_package')); -shx.cd(path.join( - process.env['TEST_SRCDIR'], 'angular', 'packages', 'bazel', 'test', 'ng_package', 'example', - 'npm_package')); +function listDirectories(p: string, depth = 0) { + const result: string[] = []; + if (fs.statSync(p).isDirectory()) { + fs.readdirSync(p).forEach(f => { + result.push( + ' '.repeat(depth) + path.join(p, f), ...listDirectories(path.join(p, f), depth + 1)); + }); + } + return result; +} -describe('example ng_package', () => { - it('should have right bundle files', () => { - expect(shx.ls('-R', 'bundles').stdout.split('\n').filter(n => !!n).sort()).toEqual([ - 'example-secondary.umd.js', - 'example-secondary.umd.js.map', - 'example-secondary.umd.min.js', - 'example-secondary.umd.min.js.map', - 'example.umd.js', - 'example.umd.js.map', - 'example.umd.min.js', - 'example.umd.min.js.map', - ]); +function catFiles(p: string) { + const result: string[] = []; + if (fs.statSync(p).isDirectory()) { + fs.readdirSync(p).forEach(dir => { result.push(...catFiles(path.join(p, dir))); }); + } else { + result.push(`--- ${p} ---`, '', fs.readFileSync(p, 'utf-8'), ''); + } + return result; +} + +const goldenFile = path.join(TEST_DIR, 'example_package.golden'); +process.chdir(path.join(TEST_DIR, 'example/npm_package')); +const actual = [...listDirectories('.'), ...catFiles('.')].join('\n').replace( + /bazel-out\/.*\/bin/g, 'bazel-bin'); +const expected = fs.readFileSync(goldenFile, 'utf-8'); + +if (require.main === module) { + const args = process.argv.slice(2); + if (args[0] === '--accept') { + fs.writeFileSync(require.resolve(goldenFile), actual, 'utf-8'); + } +} else { + describe('example ng_package', () => { + it('should match golden file', () => { + if (actual === expected) { + return; + } + fail(`example ng_package differs from golden file + + Accept the new golden file: + bazel run ${process.env['BAZEL_TARGET']}.accept + `); + }); }); - // FESMS currently not part of APF v6 - xit('should have right fesm files', () => { - const expected = [ - 'example.js', - 'example.js.map', - 'secondary.js', - 'secondary.js.map', - ]; - expect(shx.ls('-R', 'esm5').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected); - expect(shx.ls('-R', 'esm2015').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected); - }); - it('should have right secondary sources', () => { - const expected = [ - 'index.d.ts', - 'package.json', - 'secondary.d.ts', - 'secondary.metadata.json', - 'secondarymodule.d.ts', - ]; - expect(shx.ls('-R', 'secondary').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected); - }); - it('should have main entry point package.json properties set', () => { - const packageJson = JSON.parse(fs.readFileSync('package.json', UTF8)); - expect(packageJson['main']).toBe('./bundles/example.umd.js'); - expect(packageJson['module']).toBe('./esm5/example.js'); - expect(packageJson['es2015']).toBe('./esm2015/example.js'); - expect(packageJson['typings']).toBe('./example.d.ts'); - }); - it('should have secondary entry point package.json properties set', () => { - const packageJson = JSON.parse(fs.readFileSync(path.join('secondary', 'package.json'), UTF8)); - expect(packageJson['main']).toBe('../bundles/example-secondary.umd.js'); - expect(packageJson['module']).toBe('../esm5/secondary/secondary.js'); - expect(packageJson['es2015']).toBe('../esm2015/secondary/secondary.js'); - expect(packageJson['typings']).toBe('./secondary.d.ts'); - }); -}); +} diff --git a/packages/common/BUILD.bazel b/packages/common/BUILD.bazel index 36afb492bb..40b163f516 100644 --- a/packages/common/BUILD.bazel +++ b/packages/common/BUILD.bazel @@ -26,11 +26,6 @@ ng_package( "//packages/common/testing:package.json", ], entry_point = "packages/common/index.js", - secondary_entry_points = [ - "testing", - "http", - "http/testing", - ], deps = [ "//packages/common", "//packages/common/http", diff --git a/packages/compiler-cli/integrationtest/bazel/ng_module/BUILD.bazel b/packages/compiler-cli/integrationtest/bazel/ng_module/BUILD.bazel index 84142c0999..c411ec594a 100644 --- a/packages/compiler-cli/integrationtest/bazel/ng_module/BUILD.bazel +++ b/packages/compiler-cli/integrationtest/bazel/ng_module/BUILD.bazel @@ -4,6 +4,7 @@ ng_module( name = "test_module", srcs = glob(["*.ts"]), entry_point = "index.ts", + flat_module_out_file = "flat_module_filename", module_name = "some_npm_module", deps = ["//packages/core"], ) diff --git a/packages/compiler-cli/integrationtest/bazel/ng_module/extract_flat_module_index.bzl b/packages/compiler-cli/integrationtest/bazel/ng_module/extract_flat_module_index.bzl index e15f4539a9..a7d6e3c0c3 100644 --- a/packages/compiler-cli/integrationtest/bazel/ng_module/extract_flat_module_index.bzl +++ b/packages/compiler-cli/integrationtest/bazel/ng_module/extract_flat_module_index.bzl @@ -6,11 +6,12 @@ """ def _extract_flat_module_index(ctx): - return [DefaultInfo(files = depset(transitive = [ - dep.angular.flat_module_metadata - for dep in ctx.attr.deps - if hasattr(dep, "angular") - ]))] + files = [] + for dep in ctx.attr.deps: + if hasattr(dep, "angular"): + for metadata in dep.angular.flat_module_metadata: + files.extend([metadata.metadata_file, metadata.typings_file]) + return [DefaultInfo(files = depset(files))] extract_flat_module_index = rule( implementation = _extract_flat_module_index, diff --git a/packages/compiler-cli/integrationtest/bazel/ng_module/spec.js b/packages/compiler-cli/integrationtest/bazel/ng_module/spec.js index 99b887af49..7cd28269f2 100644 --- a/packages/compiler-cli/integrationtest/bazel/ng_module/spec.js +++ b/packages/compiler-cli/integrationtest/bazel/ng_module/spec.js @@ -12,7 +12,7 @@ describe('flat module index', () => { describe('child metadata', () => { it('should have contents', () => { const metadata = fs.readFileSync( - require.resolve(`${PKG}/_test_module.bundle_index.metadata.json`), {encoding: 'utf-8'}); + require.resolve(`${PKG}/flat_module_filename.metadata.json`), {encoding: 'utf-8'}); expect(metadata).toContain('"__symbolic":"module"'); expect(metadata).toContain('"__symbolic":"reference","module":"@angular/core"'); expect(metadata).toContain('"origins":{"Child":"./child","ɵa":"./parent"}'); @@ -21,8 +21,8 @@ describe('flat module index', () => { }); describe('child typings', () => { it('should have contents', () => { - const dts = fs.readFileSync( - require.resolve(`${PKG}/_test_module.bundle_index.d.ts`), {encoding: 'utf-8'}); + const dts = + fs.readFileSync(require.resolve(`${PKG}/flat_module_filename.d.ts`), {encoding: 'utf-8'}); expect(dts).toContain('export * from \'./index\';'); expect(dts).toContain('export { Parent as ɵa } from \'./parent\';'); diff --git a/packages/compiler/BUILD.bazel b/packages/compiler/BUILD.bazel index 856abba41a..1641b5bdf9 100644 --- a/packages/compiler/BUILD.bazel +++ b/packages/compiler/BUILD.bazel @@ -11,7 +11,6 @@ ts_library( ], ), module_name = "@angular/compiler", - # module_root = "index.d.ts", ) ng_package( @@ -22,9 +21,6 @@ ng_package( ], entry_point = "packages/compiler/compiler.js", include_devmode_srcs = True, - secondary_entry_points = [ - "testing", - ], deps = [ ":compiler", "//packages/compiler/testing", diff --git a/packages/core/BUILD.bazel b/packages/core/BUILD.bazel index 7a581dd36b..190fb2bded 100644 --- a/packages/core/BUILD.bazel +++ b/packages/core/BUILD.bazel @@ -24,7 +24,6 @@ ng_package( "//packages/core/testing:package.json", ], entry_point = "packages/core/index.js", - secondary_entry_points = ["testing"], deps = [ ":core", "//packages/core/testing", diff --git a/packages/http/BUILD.bazel b/packages/http/BUILD.bazel index 4424f214bc..a9083e0e93 100644 --- a/packages/http/BUILD.bazel +++ b/packages/http/BUILD.bazel @@ -25,9 +25,6 @@ ng_package( "//packages/http/testing:package.json", ], entry_point = "packages/http/index.js", - secondary_entry_points = [ - "testing", - ], deps = [ ":http", "//packages/http/testing", diff --git a/packages/platform-browser-dynamic/BUILD.bazel b/packages/platform-browser-dynamic/BUILD.bazel index bcedbf38f3..756d942e78 100644 --- a/packages/platform-browser-dynamic/BUILD.bazel +++ b/packages/platform-browser-dynamic/BUILD.bazel @@ -27,9 +27,6 @@ ng_package( "//packages/platform-browser-dynamic/testing:package.json", ], entry_point = "packages/platform-browser-dynamic/index.js", - secondary_entry_points = [ - "testing", - ], deps = [ ":platform-browser-dynamic", "//packages/platform-browser-dynamic/testing", diff --git a/packages/platform-browser/BUILD.bazel b/packages/platform-browser/BUILD.bazel index 2b213ed9a0..c3ec79665e 100644 --- a/packages/platform-browser/BUILD.bazel +++ b/packages/platform-browser/BUILD.bazel @@ -26,10 +26,6 @@ ng_package( "//packages/platform-browser/testing:package.json", ], entry_point = "packages/platform-browser/index.js", - secondary_entry_points = [ - "animations", - "testing", - ], deps = [ ":platform-browser", "//packages/platform-browser/animations", diff --git a/packages/platform-server/BUILD.bazel b/packages/platform-server/BUILD.bazel index da0bafbce5..25205306be 100644 --- a/packages/platform-server/BUILD.bazel +++ b/packages/platform-server/BUILD.bazel @@ -32,9 +32,6 @@ ng_package( "//packages/platform-server/testing:package.json", ], entry_point = "packages/platform-server/index.js", - secondary_entry_points = [ - "testing", - ], deps = [ ":platform-server", "//packages/platform-server/testing", diff --git a/packages/router/BUILD.bazel b/packages/router/BUILD.bazel index 7745724a38..599a2e9407 100644 --- a/packages/router/BUILD.bazel +++ b/packages/router/BUILD.bazel @@ -28,10 +28,6 @@ ng_package( "//packages/router/upgrade:package.json", ], entry_point = "packages/router/index.js", - secondary_entry_points = [ - "testing", - "upgrade", - ], deps = [ ":router", "//packages/router/testing", diff --git a/packages/service-worker/BUILD.bazel b/packages/service-worker/BUILD.bazel index de29dc458d..91ad9f6ba1 100644 --- a/packages/service-worker/BUILD.bazel +++ b/packages/service-worker/BUILD.bazel @@ -25,7 +25,6 @@ ng_package( "//packages/service-worker/config:package.json", ], entry_point = "packages/service-worker/index.js", - secondary_entry_points = ["config"], deps = [ ":service-worker", "//packages/service-worker/config", diff --git a/packages/service-worker/config/BUILD.bazel b/packages/service-worker/config/BUILD.bazel index 195e2bdbc3..f96d578375 100644 --- a/packages/service-worker/config/BUILD.bazel +++ b/packages/service-worker/config/BUILD.bazel @@ -10,5 +10,6 @@ ng_module( "*.ts", "src/**/*.ts", ]), + module_name = "@angular/service-worker/config", deps = ["//packages/core"], ) diff --git a/packages/upgrade/BUILD.bazel b/packages/upgrade/BUILD.bazel index 3dcc575fe3..f37fa24bc9 100644 --- a/packages/upgrade/BUILD.bazel +++ b/packages/upgrade/BUILD.bazel @@ -25,9 +25,6 @@ ng_package( "//packages/upgrade/static:package.json", ], entry_point = "packages/upgrade/index.js", - secondary_entry_points = [ - "static", - ], deps = [ ":upgrade", "//packages/upgrade/static", diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 221d0953eb..cae2180fea 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -43,7 +43,7 @@ def ng_module(name, tsconfig = None, entry_point = None, **kwargs): tsconfig = DEFAULT_TSCONFIG if not entry_point: entry_point = "public_api.ts" - _ng_module(name = name, tsconfig = tsconfig, entry_point = entry_point, **kwargs) + _ng_module(name = name, flat_module_out_file = name, tsconfig = tsconfig, entry_point = entry_point, **kwargs) def ng_package(name, readme_md = None, license_banner = None, stamp_data = None, **kwargs): if not readme_md: diff --git a/tools/ts-api-guardian/README.md b/tools/ts-api-guardian/README.md index 3a2bea89a0..0f21e6e0f9 100644 --- a/tools/ts-api-guardian/README.md +++ b/tools/ts-api-guardian/README.md @@ -2,6 +2,22 @@ Keeps track of public API surface of a typescript library. +Examples: + +```sh +# Generate one declaration file +ts-api-guardian --out api_guard.d.ts index.d.ts +# Generate multiple declaration files +# (output location like typescript) +ts-api-guardian --outDir api_guard [--rootDir .] core/index.d.ts core/testing.d.ts +# Print usage +ts-api-guardian --help +# Check against one declaration file +ts-api-guardian --verify api_guard.d.ts index.d.ts +# Check against multiple declaration files +ts-api-guardian --verifyDir api_guard [--rootDir .] core/index.d.ts core/testing.d.ts +``` + # For developers Build and test this library: diff --git a/tools/ts-api-guardian/lib/cli.ts b/tools/ts-api-guardian/lib/cli.ts index cf706dc6e1..ff35a70d16 100644 --- a/tools/ts-api-guardian/lib/cli.ts +++ b/tools/ts-api-guardian/lib/cli.ts @@ -16,25 +16,6 @@ import * as path from 'path'; import {SerializationOptions, generateGoldenFile, verifyAgainstGoldenFile} from './main'; -// Examples: -// -// ```sh -// # Generate one declaration file -// ts-api-guardian --out api_guard.d.ts index.d.ts -// -// # Generate multiple declaration files // # (output location like typescript) -// ts-api-guardian --outDir api_guard [--rootDir .] core/index.d.ts core/testing.d.ts -// -// # Print usage -// ts-api-guardian --help -// -// # Check against one declaration file -// ts-api-guardian --verify api_guard.d.ts index.d.ts -// -// # Check against multiple declaration files -// ts-api-guardian --verifyDir api_guard [--rootDir .] core/index.d.ts core/testing.d.ts -// ``` - const CMD = 'ts-api-guardian'; export function startCli() {