Skip to content

Commit 2c348bf

Browse files
alan-agius4devversion
authored andcommitted
Revert "feat: move package types under /types"
This reverts commit ccc2985.
1 parent ccc2985 commit 2c348bf

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

src/ng_package/angular_package_format.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ def _angular_package_format_impl(ctx):
259259
module_name = module_name,
260260
es2022_entry_point = es2022_entry_point,
261261
fesm2022_file = "fesm2022/%s.mjs" % bundle_name_base,
262-
dts_bundle_relative_path = "types/%s.d.ts" % dts_bundle_name_base,
262+
# TODO(devversion): Put all types under `/types/` folder. Breaking change in v20.
263+
dts_bundle_relative_path = "%s.d.ts" % dts_bundle_name_base,
263264
typings_entry_point = typings_entry_point,
264265
# TODO: Determine if we can just remove this as we are always "guessing" now
265266
guessed_paths = True,

src/ng_package/packager/index.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function main(args: string[]): void {
150150
return getEntryPointSubpath(moduleName) !== '';
151151
}
152152

153-
const crossEntryPointFailures = esm2022.flatMap(file =>
153+
const crossEntryPointFailures = esm2022.flatMap((file) =>
154154
analyzeFileAndEnsureNoCrossImports(file, metadata),
155155
);
156156

@@ -161,13 +161,16 @@ function main(args: string[]): void {
161161

162162
// Copy all FESM files (and their potential shared chunks) into the package output.
163163
const fesmFiles = globSync('**/*', {cwd: metadata.fesmBundlesOut.path});
164-
fesmFiles.forEach(f =>
164+
fesmFiles.forEach((f) =>
165165
copyFile(path.join(metadata.fesmBundlesOut.path, f), path.join('fesm2022', f)),
166166
);
167167

168168
// Copy all dts files (and their potential shared chunks) into the package output.
169169
const dtsFiles = globSync('**/*', {cwd: metadata.dtsBundlesOut.path});
170-
dtsFiles.forEach(f => copyFile(path.join(metadata.dtsBundlesOut.path, f), path.join('types', f)));
170+
dtsFiles.forEach((f) =>
171+
// TODO(devversion): Put all types under `/types/` folder. Breaking change in v20.
172+
copyFile(path.join(metadata.dtsBundlesOut.path, f), f),
173+
);
171174

172175
for (const file of staticFiles) {
173176
// We copy all files into the package output while preserving the sub-path from
@@ -323,10 +326,10 @@ function main(args: string[]): void {
323326

324327
const sideEffects = packageJson.sideEffects as undefined | false | string[];
325328
const neededSideEffects = sideEffectEntryPoints.map(
326-
entryPointModule => `./${metadata.entryPoints[entryPointModule].fesm2022RelativePath}`,
329+
(entryPointModule) => `./${metadata.entryPoints[entryPointModule].fesm2022RelativePath}`,
327330
);
328331
const missingSideEffects = neededSideEffects.filter(
329-
p =>
332+
(p) =>
330333
// It's missing, if the whole package is marked as having no side effects.
331334
sideEffects === false ||
332335
// Alternatively, it's missing if the explicit list doesn't contain the pattern.
@@ -345,7 +348,9 @@ function main(args: string[]): void {
345348
// of the `ng_package` known entry points.
346349
const unexpectedExtra =
347350
sideEffects !== false
348-
? (sideEffects ?? []).filter(p => p.includes('fesm2022') && !neededSideEffects.includes(p))
351+
? (sideEffects ?? []).filter(
352+
(p) => p.includes('fesm2022') && !neededSideEffects.includes(p),
353+
)
349354
: [];
350355
if (unexpectedExtra.length > 0) {
351356
throw Error(

src/ng_package/rollup/rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ const input = {};
165165
for (const info of Object.values(entrypointMetadata)) {
166166
const entryFile = dtsMode ? info.typingsEntryPoint.path : info.index.path;
167167
const chunkName = dtsMode
168-
? info.dtsBundleRelativePath.replace(/\.d\.ts$/, '').replace('types/', '')
168+
? info.dtsBundleRelativePath.replace(/\.d\.ts$/, '')
169169
: info.fesm2022RelativePath.replace(/\.mjs$/, '').replace('fesm2022/', '');
170170

171171
input[chunkName] = entryFile;

0 commit comments

Comments
 (0)