Skip to content

Commit 07dc806

Browse files
josephperrottAndrewKushnir
authored andcommitted
refactor(bazel): remove primary_bundle_name as attr for ng_package (angular#60306)
Remove primary_bundle_name as an attr for ng_package as it is unused. PR Close angular#60306
1 parent c0ce5ec commit 07dc806

File tree

3 files changed

+32
-38
lines changed

3 files changed

+32
-38
lines changed

packages/bazel/src/ng_package/ng_package.bzl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,9 @@ def _ng_package_impl(ctx):
265265
npm_package_directory = ctx.actions.declare_directory("%s.ng_pkg" % ctx.label.name)
266266
owning_package = ctx.label.package
267267

268-
# The name of the primary entry-point FESM bundles. If not explicitly provided through
269-
# the entry-point name attribute, we compute the name from the owning package
270-
# e.g. if defined in `packages/core:npm_package`, the name is resolved to be `core`.
271-
primary_bundle_name = \
272-
ctx.attr.primary_bundle_name if ctx.attr.primary_bundle_name else owning_package.split("/")[-1]
268+
# The name of the primary entry-point FESM bundles, computed name from the owning package
269+
# e.g. For `packages/core:npm_package`, the name is resolved to be `core`.
270+
primary_bundle_name = owning_package.split("/")[-1]
273271

274272
# Static files are files which are simply copied over into the tree artifact. These files
275273
# are not picked up by the entry-point bundling etc. Can also be generated by e.g. a genrule.
@@ -564,9 +562,6 @@ _NG_PACKAGE_ATTRS = dict(PKG_NPM_ATTRS, **{
564562
cfg = partial_compilation_transition,
565563
),
566564
"readme_md": attr.label(allow_single_file = [".md"]),
567-
"primary_bundle_name": attr.string(
568-
doc = "Name to use when generating bundle files for the primary entry-point.",
569-
),
570565
"ng_packager": attr.label(
571566
default = Label(_DEFAULT_NG_PACKAGER),
572567
executable = True,

packages/bazel/test/ng_package/example/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ ng_package(
2828
nested_packages = [
2929
":arbitrary_npm_package",
3030
],
31-
primary_bundle_name = "waffels",
3231
deps = [
3332
":example",
3433
"//packages/bazel/test/ng_package/example/a11y",

packages/bazel/test/ng_package/example_package.golden

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ extra-styles.css
1010
fesm2022
1111
fesm2022/a11y.mjs
1212
fesm2022/a11y.mjs.map
13+
fesm2022/example.mjs
14+
fesm2022/example.mjs.map
1315
fesm2022/imports.mjs
1416
fesm2022/imports.mjs.map
1517
fesm2022/index-1e1ea2d8.mjs
1618
fesm2022/index-1e1ea2d8.mjs.map
1719
fesm2022/secondary.mjs
1820
fesm2022/secondary.mjs.map
19-
fesm2022/waffels.mjs
20-
fesm2022/waffels.mjs.map
2121
imports
2222
imports/index.d.ts
2323
index.d.ts
@@ -143,6 +143,31 @@ export { A11yModule };
143143
//# sourceMappingURL=a11y.mjs.map
144144

145145

146+
--- fesm2022/example.mjs ---
147+
148+
/**
149+
* @license Angular v0.0.0
150+
* (c) 2010-2025 Google LLC. https://angular.io/
151+
* License: MIT
152+
*/
153+
154+
import * as i0 from '@angular/core';
155+
import { NgModule } from '@angular/core';
156+
157+
class MyModule {
158+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0", ngImport: i0, type: MyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
159+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "0.0.0", ngImport: i0, type: MyModule });
160+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "0.0.0", ngImport: i0, type: MyModule });
161+
}
162+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0", ngImport: i0, type: MyModule, decorators: [{
163+
type: NgModule,
164+
args: [{}]
165+
}] });
166+
167+
export { MyModule };
168+
//# sourceMappingURL=example.mjs.map
169+
170+
146171
--- fesm2022/imports.mjs ---
147172

148173
/**
@@ -222,31 +247,6 @@ export { SecondaryModule, a };
222247
//# sourceMappingURL=secondary.mjs.map
223248

224249

225-
--- fesm2022/waffels.mjs ---
226-
227-
/**
228-
* @license Angular v0.0.0
229-
* (c) 2010-2025 Google LLC. https://angular.io/
230-
* License: MIT
231-
*/
232-
233-
import * as i0 from '@angular/core';
234-
import { NgModule } from '@angular/core';
235-
236-
class MyModule {
237-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0", ngImport: i0, type: MyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
238-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "0.0.0", ngImport: i0, type: MyModule });
239-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "0.0.0", ngImport: i0, type: MyModule });
240-
}
241-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0", ngImport: i0, type: MyModule, decorators: [{
242-
type: NgModule,
243-
args: [{}]
244-
}] });
245-
246-
export { MyModule };
247-
//# sourceMappingURL=waffels.mjs.map
248-
249-
250250
--- imports/index.d.ts ---
251251

252252
/**
@@ -308,7 +308,7 @@ export { }
308308
".": {
309309
"sass": "./_index.scss",
310310
"types": "./index.d.ts",
311-
"default": "./fesm2022/waffels.mjs"
311+
"default": "./fesm2022/example.mjs"
312312
},
313313
"./package.json": {
314314
"default": "./package.json"
@@ -326,7 +326,7 @@ export { }
326326
"default": "./fesm2022/secondary.mjs"
327327
}
328328
},
329-
"module": "./fesm2022/waffels.mjs",
329+
"module": "./fesm2022/example.mjs",
330330
"typings": "./index.d.ts",
331331
"type": "module"
332332
}

0 commit comments

Comments
 (0)