ng-packagr 18.0.0-next.2 → 18.0.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,6 +31,9 @@ async function bundle({ entryName, entry, watch, buildContext, outdir }) {
31
31
  var _a, _b;
32
32
  const dir = path.dirname(entry);
33
33
  const esbuildOptions = {
34
+ // Esbuild will try to locate a tsconfig from the project root.
35
+ // Provide an empty one since we don't want to handle TS code here.
36
+ tsconfigRaw: {},
34
37
  format: 'esm',
35
38
  outdir,
36
39
  bundle: true,
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../../../src/lib/flatten/esbuild.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAqF;AACrF,2CAA6B;AAE7B,kDAAoC;AAiB7B,KAAK,UAAU,MAAM,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAiB;;IAC3F,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,cAAc,GAAiB;QACnC,MAAM,EAAE,KAAK;QACb,MAAM;QACN,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,iBAAiB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;QAClC,gBAAgB,EAAE,IAAI;QACtB,SAAS,EAAE,QAAQ;QACnB,aAAa,EAAE,GAAG;QAClB,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,KAAK;QAClB,UAAU,EAAE,SAAS,GAAG,gBAAgB;QACxC,UAAU,EAAE,SAAS;QACrB,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;QAC/B,OAAO,EAAE,MAAM;KAChB,CAAC;IAEF,IAAI,cAAwC,CAAC;IAC7C,IAAI,KAAK,EAAE,CAAC;QACV,cAAc,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,CAAC,MAAM,IAAA,iBAAO,EAAC,cAAc,CAAC,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,MAAA,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,8DAAI,mCAAI,IAAA,eAAK,EAAC,cAAc,CAAC,CAAC,CAAC;IAEvG,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,IAAA,wBAAc,EAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,IAAA,wBAAc,EAAC,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAExE,MAAM,IAAI,KAAK,CAAC,0CAA0C,KAAK,GAAG,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,cAAc;QACd,WAAW,EAAE,WAAW;KACzB,CAAC;AACJ,CAAC;AA7CD,wBA6CC","sourcesContent":["import { BuildContext, BuildOptions, build, context, formatMessages } from 'esbuild';\nimport * as path from 'path';\nimport { OutputFileCache } from '../ng-package/nodes';\nimport * as log from '../utils/log';\n\n/**\n * Options used in `ng-packagr` for writing flat bundle files.\n *\n * These options are passed through to rollup.\n */\nexport interface BundleOptions {\n moduleName: string;\n entry: string;\n outdir: string;\n entryName: string;\n buildContext?: BuildContext;\n fileCache: OutputFileCache;\n watch: boolean;\n}\n\nexport async function bundle({ entryName, entry, watch, buildContext, outdir }: BundleOptions) {\n const dir = path.dirname(entry);\n const esbuildOptions: BuildOptions = {\n format: 'esm',\n outdir,\n bundle: true,\n logLevel: 'silent',\n minify: false,\n legalComments: 'eof',\n packages: 'external',\n write: true,\n entryPoints: [entry],\n resolveExtensions: ['.mjs', '.js'],\n preserveSymlinks: true,\n sourcemap: 'linked',\n absWorkingDir: dir,\n splitting: true,\n treeShaking: false,\n chunkNames: entryName + '-[name]-[hash]',\n entryNames: entryName,\n outExtension: { '.js': '.mjs' },\n charset: 'utf8',\n };\n\n let esbuildContext: BuildContext | undefined;\n if (watch) {\n esbuildContext = buildContext ?? (await context(esbuildOptions));\n }\n\n const { outputFiles, errors, warnings } = await (esbuildContext?.rebuild?.() ?? build(esbuildOptions));\n\n if (warnings.length > 0) {\n log.warn((await formatMessages(warnings, { kind: 'warning' })).join('\\n'));\n }\n\n if (errors.length > 0) {\n log.error((await formatMessages(errors, { kind: 'error' })).join('\\n'));\n\n throw new Error(`An error has occuried while processing ${entry}.`);\n }\n\n return {\n esbuildContext,\n outputFiles: outputFiles,\n };\n}\n"]}
1
+ {"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../../../src/lib/flatten/esbuild.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAqF;AACrF,2CAA6B;AAE7B,kDAAoC;AAiB7B,KAAK,UAAU,MAAM,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAiB;;IAC3F,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,cAAc,GAAiB;QACnC,+DAA+D;QAC/D,mEAAmE;QACnE,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,KAAK;QACb,MAAM;QACN,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,QAAQ;QAClB,MAAM,E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AC,CAAC;QAExE,MAAM,IAAI,KAAK,CAAC,0CAA0C,KAAK,GAAG,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,cAAc;QACd,WAAW,EAAE,WAAW;KACzB,CAAC;AACJ,CAAC;AAhDD,wBAgDC","sourcesContent":["import { BuildContext, BuildOptions, build, context, formatMessages } from 'esbuild';\nimport * as path from 'path';\nimport { OutputFileCache } from '../ng-package/nodes';\nimport * as log from '../utils/log';\n\n/**\n * Options used in `ng-packagr` for writing flat bundle files.\n *\n * These options are passed through to rollup.\n */\nexport interface BundleOptions {\n moduleName: string;\n entry: string;\n outdir: string;\n entryName: string;\n buildContext?: BuildContext;\n fileCache: OutputFileCache;\n watch: boolean;\n}\n\nexport async function bundle({ entryName, entry, watch, buildContext, outdir }: BundleOptions) {\n const dir = path.dirname(entry);\n const esbuildOptions: BuildOptions = {\n // Esbuild will try to locate a tsconfig from the project root.\n // Provide an empty one since we don't want to handle TS code here.\n tsconfigRaw: {},\n format: 'esm',\n outdir,\n bundle: true,\n logLevel: 'silent',\n minify: false,\n legalComments: 'eof',\n packages: 'external',\n write: true,\n entryPoints: [entry],\n resolveExtensions: ['.mjs', '.js'],\n preserveSymlinks: true,\n sourcemap: 'linked',\n absWorkingDir: dir,\n splitting: true,\n treeShaking: false,\n chunkNames: entryName + '-[name]-[hash]',\n entryNames: entryName,\n outExtension: { '.js': '.mjs' },\n charset: 'utf8',\n };\n\n let esbuildContext: BuildContext | undefined;\n if (watch) {\n esbuildContext = buildContext ?? (await context(esbuildOptions));\n }\n\n const { outputFiles, errors, warnings } = await (esbuildContext?.rebuild?.() ?? build(esbuildOptions));\n\n if (warnings.length > 0) {\n log.warn((await formatMessages(warnings, { kind: 'warning' })).join('\\n'));\n }\n\n if (errors.length > 0) {\n log.error((await formatMessages(errors, { kind: 'error' })).join('\\n'));\n\n throw new Error(`An error has occuried while processing ${entry}.`);\n }\n\n return {\n esbuildContext,\n outputFiles: outputFiles,\n };\n}\n"]}
@@ -67,8 +67,7 @@ function createCssResourcePlugin(url) {
67
67
  error.notes = [
68
68
  {
69
69
  location: null,
70
- text: 'You can remove the caret and add the path to the `externalDependencies` build option,' +
71
- ' which should remove this error.',
70
+ text: 'You can remove the caret and use a relative path to reference it, which should remove this error.',
72
71
  },
73
72
  ];
74
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"css-resource-plugin.js","sourceRoot":"","sources":["../../../src/lib/styles/css-resource-plugin.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAGH,+CAA4C;AAC5C,yCAAoD;AACpD,iEAAgD;AAEhD,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAEtD;;;GAGG;AACH,MAAM,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAElE;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,GAAW;IACjD,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,KAAK,CAAC,KAAkB;YACtB,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;;gBAC7C,kEAAkE;gBAClE,yEAAyE;gBACzE,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,KAAI,MAAA,IAAI,CAAC,UAAU,0CAAG,uBAAuB,CAAC,CAAA,EAAE,CAAC;oBAC5E,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,qFAAqF;gBACrF,qBAAqB;gBACrB,IAAI,GAAG,KAAK,6BAAM,CAAC,MAAM,IAAI,qCAAqC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACnF,OAAO;wBACL,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,QAAQ,EAAE,IAAI;qBACf,CAAC;gBACJ,CAAC;gBAED,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;gBACxE,U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AAC,MAAA,KAAK,CAAC,cAAc,CAAC,aAAa,mCAAI,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC;oBACrE,SAAS,EAAE,sBAAsB;iBAClC,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,sBAAsB,EAAE,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;;gBAC5E,MAAM,YAAY,GAAG,IAAA,gBAAI,EAAC,MAAA,KAAK,CAAC,cAAc,CAAC,aAAa,mCAAI,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAE/E,OAAO;oBACL,QAAQ,EAAE,MAAM,IAAA,mBAAQ,EAAC,YAAY,CAAC;oBACtC,MAAM,EAAE,SAAS;oBACjB,UAAU,EAAE,CAAC,YAAY,CAAC;iBAC3B,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAvFD,0DAuFC","sourcesContent":["/**\n * @license\n * Copyright Google LLC 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\nimport type { Plugin, PluginBuild } from 'esbuild';\nimport { readFile } from 'node:fs/promises';\nimport { extname, join, relative } from 'node:path';\nimport { CssUrl } from './stylesheet-processor';\n\nconst CSS_RESOURCE_NAMESPACE = 'angular:css-resource';\n\n/**\n * Symbol marker used to indicate CSS resource resolution is being attempted.\n * This is used to prevent an infinite loop within the plugin's resolve hook.\n */\nconst CSS_RESOURCE_RESOLUTION = Symbol('CSS_RESOURCE_RESOLUTION');\n\n/**\n * Creates an esbuild {@link Plugin} that loads all CSS url token references using the\n * built-in esbuild `file` loader. A plugin is used to allow for all file extensions\n * and types to be supported without needing to manually specify all extensions\n * within the build configuration.\n *\n * @returns An esbuild {@link Plugin} instance.\n */\nexport function createCssResourcePlugin(url: CssUrl): Plugin {\n return {\n name: 'angular-css-resource',\n setup(build: PluginBuild): void {\n build.onResolve({ filter: /.*/ }, async args => {\n // Only attempt to resolve url tokens which only exist inside CSS.\n // Also, skip this plugin if already attempting to resolve the url-token.\n if (args.kind !== 'url-token' || args.pluginData?.[CSS_RESOURCE_RESOLUTION]) {\n return null;\n }\n\n // If root-relative, absolute or protocol relative url, mark as external to leave the\n // path/URL in place.\n if (url !== CssUrl.inline || /^((?:\\w+:)?\\/\\/|data:|chrome:|#|\\/)/.test(args.path)) {\n return {\n path: args.path,\n external: true,\n };\n }\n\n const { importer, kind, resolveDir, namespace, pluginData = {} } = args;\n pluginData[CSS_RESOURCE_RESOLUTION] = true;\n\n const result = await build.resolve(args.path, {\n importer,\n kind,\n namespace,\n pluginData,\n resolveDir,\n });\n\n if (result.errors.length) {\n const error = result.errors[0];\n if (args.path[0] === '~') {\n error.notes = [\n {\n location: null,\n text: 'You can remove the tilde and use a relative path to reference it, which should remove this error.',\n },\n ];\n } else if (args.path[0] === '^') {\n error.notes = [\n {\n location: null,\n text:\n 'You can remove the caret and add the path to the `externalDependencies` build option,' +\n ' which should remove this error.',\n },\n ];\n }\n\n const extension = importer && extname(importer);\n if (extension !== '.css') {\n error.notes.push({\n location: null,\n text: 'Preprocessor stylesheets may not show the exact file location of the error.',\n });\n }\n }\n\n // Return results that are not files since these are most likely specific to another plugin\n // and cannot be loaded by this plugin.\n if (result.namespace !== 'file') {\n return result;\n }\n\n // All file results are considered CSS resources and will be loaded via the file loader\n return {\n ...result,\n // Use a relative path to prevent fully resolved paths in the metafile (JSON stats file).\n // This is only necessary for custom namespaces. esbuild will handle the file namespace.\n path: relative(build.initialOptions.absWorkingDir ?? '', result.path),\n namespace: CSS_RESOURCE_NAMESPACE,\n };\n });\n\n build.onLoad({ filter: /./, namespace: CSS_RESOURCE_NAMESPACE }, async args => {\n const resourcePath = join(build.initialOptions.absWorkingDir ?? '', args.path);\n\n return {\n contents: await readFile(resourcePath),\n loader: 'dataurl',\n watchFiles: [resourcePath],\n };\n });\n },\n };\n}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AS,EAAE,sBAAsB,EAAE,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;;gBAC5E,MAAM,YAAY,GAAG,IAAA,gBAAI,EAAC,MAAA,KAAK,CAAC,cAAc,CAAC,aAAa,mCAAI,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAE/E,OAAO;oBACL,QAAQ,EAAE,MAAM,IAAA,mBAAQ,EAAC,YAAY,CAAC;oBACtC,MAAM,EAAE,SAAS;oBACjB,UAAU,EAAE,CAAC,YAAY,CAAC;iBAC3B,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AArFD,0DAqFC","sourcesContent":["/**\n * @license\n * Copyright Google LLC 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\nimport type { Plugin, PluginBuild } from 'esbuild';\nimport { readFile } from 'node:fs/promises';\nimport { extname, join, relative } from 'node:path';\nimport { CssUrl } from './stylesheet-processor';\n\nconst CSS_RESOURCE_NAMESPACE = 'angular:css-resource';\n\n/**\n * Symbol marker used to indicate CSS resource resolution is being attempted.\n * This is used to prevent an infinite loop within the plugin's resolve hook.\n */\nconst CSS_RESOURCE_RESOLUTION = Symbol('CSS_RESOURCE_RESOLUTION');\n\n/**\n * Creates an esbuild {@link Plugin} that loads all CSS url token references using the\n * built-in esbuild `file` loader. A plugin is used to allow for all file extensions\n * and types to be supported without needing to manually specify all extensions\n * within the build configuration.\n *\n * @returns An esbuild {@link Plugin} instance.\n */\nexport function createCssResourcePlugin(url: CssUrl): Plugin {\n return {\n name: 'angular-css-resource',\n setup(build: PluginBuild): void {\n build.onResolve({ filter: /.*/ }, async args => {\n // Only attempt to resolve url tokens which only exist inside CSS.\n // Also, skip this plugin if already attempting to resolve the url-token.\n if (args.kind !== 'url-token' || args.pluginData?.[CSS_RESOURCE_RESOLUTION]) {\n return null;\n }\n\n // If root-relative, absolute or protocol relative url, mark as external to leave the\n // path/URL in place.\n if (url !== CssUrl.inline || /^((?:\\w+:)?\\/\\/|data:|chrome:|#|\\/)/.test(args.path)) {\n return {\n path: args.path,\n external: true,\n };\n }\n\n const { importer, kind, resolveDir, namespace, pluginData = {} } = args;\n pluginData[CSS_RESOURCE_RESOLUTION] = true;\n\n const result = await build.resolve(args.path, {\n importer,\n kind,\n namespace,\n pluginData,\n resolveDir,\n });\n\n if (result.errors.length) {\n const error = result.errors[0];\n if (args.path[0] === '~') {\n error.notes = [\n {\n location: null,\n text: 'You can remove the tilde and use a relative path to reference it, which should remove this error.',\n },\n ];\n } else if (args.path[0] === '^') {\n error.notes = [\n {\n location: null,\n text: 'You can remove the caret and use a relative path to reference it, which should remove this error.',\n },\n ];\n }\n\n const extension = importer && extname(importer);\n if (extension !== '.css') {\n error.notes.push({\n location: null,\n text: 'Preprocessor stylesheets may not show the exact file location of the error.',\n });\n }\n }\n\n // Return results that are not files since these are most likely specific to another plugin\n // and cannot be loaded by this plugin.\n if (result.namespace !== 'file') {\n return result;\n }\n\n // All file results are considered CSS resources and will be loaded via the file loader\n return {\n ...result,\n // Use a relative path to prevent fully resolved paths in the metafile (JSON stats file).\n // This is only necessary for custom namespaces. esbuild will handle the file namespace.\n path: relative(build.initialOptions.absWorkingDir ?? '', result.path),\n namespace: CSS_RESOURCE_NAMESPACE,\n };\n });\n\n build.onLoad({ filter: /./, namespace: CSS_RESOURCE_NAMESPACE }, async args => {\n const resourcePath = join(build.initialOptions.absWorkingDir ?? '', args.path);\n\n return {\n contents: await readFile(resourcePath),\n loader: 'dataurl',\n watchFiles: [resourcePath],\n };\n });\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-packagr",
3
- "version": "18.0.0-next.2",
3
+ "version": "18.0.0-next.4",
4
4
  "description": "Compile and package Angular libraries in Angular Package Format (APF)",
5
5
  "keywords": [
6
6
  "apf",
package/public_api.d.ts CHANGED
@@ -8,3 +8,4 @@ export * from './lib/commands/version.command';
8
8
  * ngPackagr() programmatic API
9
9
  */
10
10
  export * from './lib/packagr';
11
+ export { NgPackagrOptions } from './lib/ng-package/options.di';
package/public_api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"public_api.js","sourceRoot":"","sources":["../src/public_api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,yDAAuC;AACvC,+DAA6C;AAC7C,iEAA+C;AAE/C;;GAEG;AACH,gDAA8B","sourcesContent":["/**\n * Commands API\n */\nexport * from './lib/commands/command';\nexport * from './lib/commands/build.command';\nexport * from './lib/commands/version.command';\n\n/**\n * ngPackagr() programmatic API\n */\nexport * from './lib/packagr';\n"]}
1
+ {"version":3,"file":"public_api.js","sourceRoot":"","sources":["../src/public_api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,yDAAuC;AACvC,+DAA6C;AAC7C,iEAA+C;AAE/C;;GAEG;AACH,gDAA8B","sourcesContent":["/**\n * Commands API\n */\nexport * from './lib/commands/command';\nexport * from './lib/commands/build.command';\nexport * from './lib/commands/version.command';\n\n/**\n * ngPackagr() programmatic API\n */\nexport * from './lib/packagr';\nexport { NgPackagrOptions } from './lib/ng-package/options.di';\n"]}