ng-packagr 19.2.0-next.2 → 19.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,32 +24,39 @@ function createCssResourcePlugin(url, cache) {
24
24
  name: 'angular-css-resource',
25
25
  setup(build) {
26
26
  build.onResolve({ filter: /.*/ }, async (args) => {
27
- var _a, _b;
27
+ var _a;
28
+ const { importer, path, kind, resolveDir, namespace, pluginData = {} } = args;
28
29
  // Only attempt to resolve url tokens which only exist inside CSS.
29
30
  // Also, skip this plugin if already attempting to resolve the url-token.
30
- if (args.kind !== 'url-token' || ((_a = args.pluginData) === null || _a === void 0 ? void 0 : _a[CSS_RESOURCE_RESOLUTION])) {
31
+ if (kind !== 'url-token' || pluginData[CSS_RESOURCE_RESOLUTION]) {
31
32
  return null;
32
33
  }
34
+ let [containingDir, resourceUrl] = path.split('||file:', 2);
35
+ if (resourceUrl === undefined) {
36
+ // This can happen due to early exit checks in rebasing-importer
37
+ // logic such as when the url is an external URL.
38
+ resourceUrl = containingDir;
39
+ containingDir = '';
40
+ }
33
41
  // If root-relative, absolute or protocol relative url, mark as external to leave the
34
42
  // path/URL in place.
35
- if (url !== stylesheet_processor_1.CssUrl.inline || /^((?:\w+:)?\/\/|data:|chrome:|#|\/)/.test(args.path)) {
43
+ if (url !== stylesheet_processor_1.CssUrl.inline || /^((?:\w+:)?\/\/|data:|chrome:|#|\/)/.test(resourceUrl)) {
36
44
  return {
37
- path: args.path,
45
+ path: resourceUrl,
38
46
  external: true,
39
47
  };
40
48
  }
41
- const { importer, kind, resolveDir, namespace, pluginData = {} } = args;
42
49
  pluginData[CSS_RESOURCE_RESOLUTION] = true;
43
- const result = await build.resolve(args.path, {
50
+ const result = await build.resolve(resourceUrl, {
44
51
  importer,
45
52
  kind,
46
53
  namespace,
47
54
  pluginData,
48
- resolveDir,
55
+ resolveDir: (0, node_path_1.join)(resolveDir, containingDir),
49
56
  });
50
57
  if (result.errors.length) {
51
58
  const error = result.errors[0];
52
- if (args.path[0] === '~') {
59
+ if (resourceUrl[0] === '~') {
53
60
  error.notes = [
54
61
  {
55
62
  location: null,
@@ -57,7 +64,7 @@ function createCssResourcePlugin(url, cache) {
57
64
  },
58
65
  ];
59
66
  }
60
- else if (args.path[0] === '^') {
67
+ else if (resourceUrl[0] === '^') {
61
68
  error.notes = [
62
69
  {
63
70
  location: null,
@@ -83,7 +90,7 @@ function createCssResourcePlugin(url, cache) {
83
90
  ...result,
84
91
  // Use a relative path to prevent fully resolved paths in the metafile (JSON stats file).
85
92
  // This is only necessary for custom namespaces. esbuild will handle the file namespace.
86
- path: (0, node_path_1.relative)((_b = build.initialOptions.absWorkingDir) !== null && _b !== void 0 ? _b : '', result.path),
93
+ path: (0, node_path_1.relative)((_a = build.initialOptions.absWorkingDir) !== null && _a !== void 0 ? _a : '', result.path),
87
94
  namespace: CSS_RESOURCE_NAMESPACE,
88
95
  };
89
96
  });
@@ -1 +1 @@
1
- {"version":3,"file":"css-resource-plugin.js","sourceRoot":"","sources":["../../../../src/lib/styles/stylesheets/css-resource-plugin.ts"],"names":[],"mappings":";;AAsBA,0DAwFC;AA7GD,+CAA4C;AAC5C,yCAAoD;AACpD,4DAAyE;AACzE,kEAAiD;AAEjD,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAEtD;;;GAGG;AACH,MAAM,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAElE;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,GAAW,EAAE,KAAuB;IAC1E,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,u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oBAChD,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;wBACzB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;4BACf,QAAQ,EAAE,IAAI;4BACd,IAAI,EAAE,6EAA6E;yBACpF,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAED,2FAA2F;gBAC3F,uCAAuC;gBACvC,IAAI,MAAM,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;oBAChC,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAED,uFAAuF;gBACvF,OAAO;oBACL,GAAG,MAAM;oBACT,yFAAyF;oBACzF,wFAAwF;oBACxF,IAAI,EAAE,IAAA,oBAAQ,EAAC,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,CACV,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,sBAAsB,EAAE,EAClD,IAAA,oCAAgB,EAAC,KAAK,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;;gBACnC,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,CACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Plugin, PluginBuild } from 'esbuild';\nimport { readFile } from 'node:fs/promises';\nimport { extname, join, relative } from 'node:path';\nimport { LoadResultCache, createCachedLoad } from '../load-result-cache';\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, cache?: LoadResultCache): 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(\n { filter: /./, namespace: CSS_RESOURCE_NAMESPACE },\n createCachedLoad(cache, 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}\n"]}
1
+ {"version":3,"file":"css-resource-plugin.js","sourceRoot":"","sources":["../../../../src/lib/styles/stylesheets/css-resource-plugin.ts"],"names":[],"mappings":";;AAsBA,0DAiGC;AAtHD,+CAA4C;AAC5C,yCAAoD;AACpD,4DAAyE;AACzE,kEAAiD;AAEjD,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAEtD;;;GAGG;AACH,MAAM,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAElE;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,GAAW,EAAE,KAAuB;IAC1E,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,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;gBAE9E,kEAAkE;gBAClE,yEAAyE;gBACzE,IAAI,IAAI,KAAK,WAAW,IAAI,UAAU,CAAC,uBAAuB,CAAC,EAAE,CAAC;oBAChE,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,G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,EAAC,QAAQ,CAAC,CAAC;oBAChD,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;wBACzB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;4BACf,QAAQ,EAAE,IAAI;4BACd,IAAI,EAAE,6EAA6E;yBACpF,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAED,2FAA2F;gBAC3F,uCAAuC;gBACvC,IAAI,MAAM,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;oBAChC,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAED,uFAAuF;gBACvF,OAAO;oBACL,GAAG,MAAM;oBACT,yFAAyF;oBACzF,wFAAwF;oBACxF,IAAI,EAAE,IAAA,oBAAQ,EAAC,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,CACV,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,sBAAsB,EAAE,EAClD,IAAA,oCAAgB,EAAC,KAAK,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;;gBACnC,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,CACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Plugin, PluginBuild } from 'esbuild';\nimport { readFile } from 'node:fs/promises';\nimport { extname, join, relative } from 'node:path';\nimport { LoadResultCache, createCachedLoad } from '../load-result-cache';\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, cache?: LoadResultCache): Plugin {\n return {\n name: 'angular-css-resource',\n setup(build: PluginBuild): void {\n build.onResolve({ filter: /.*/ }, async args => {\n const { importer, path, kind, resolveDir, namespace, pluginData = {} } = args;\n\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 (kind !== 'url-token' || pluginData[CSS_RESOURCE_RESOLUTION]) {\n return null;\n }\n\n let [containingDir, resourceUrl] = path.split('||file:', 2);\n if (resourceUrl === undefined) {\n // This can happen due to early exit checks in rebasing-importer\n // logic such as when the url is an external URL.\n resourceUrl = containingDir;\n containingDir = '';\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(resourceUrl)) {\n return {\n path: resourceUrl,\n external: true,\n };\n }\n\n pluginData[CSS_RESOURCE_RESOLUTION] = true;\n\n const result = await build.resolve(resourceUrl, {\n importer,\n kind,\n namespace,\n pluginData,\n resolveDir: join(resolveDir, containingDir),\n });\n\n if (result.errors.length) {\n const error = result.errors[0];\n if (resourceUrl[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 (resourceUrl[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(\n { filter: /./, namespace: CSS_RESOURCE_NAMESPACE },\n createCachedLoad(cache, 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}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-packagr",
3
- "version": "19.2.0-next.2",
3
+ "version": "19.2.1",
4
4
  "description": "Compile and package Angular libraries in Angular Package Format (APF)",
5
5
  "keywords": [
6
6
  "apf",
@@ -71,5 +71,6 @@
71
71
  "tailwindcss": {
72
72
  "optional": true
73
73
  }
74
- }
74
+ },
75
+ "packageManager": "pnpm@9.15.6+sha512.139cab068fdf0b751268179ac5f909b5be72afb4a75c513d1905d151befc8977b593d3cf8671ed83d4d6637c5c94b98ffbce108125de4a5a27a31233601a99de"
75
76
  }