Skip to content

Commit d0bc565

Browse files
committed
feat: support Angular 17.x-next.x
1 parent 53a9aa7 commit d0bc565

File tree

8 files changed

+51
-18
lines changed

8 files changed

+51
-18
lines changed
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@softarc/native-federation",
3-
"version": "2.0.0",
3+
"version": "2.0.4",
44
"type": "commonjs",
55
"dependencies": {
66
"json5": "^2.2.0",
77
"npmlog": "^6.0.2",
8-
"@softarc/native-federation-runtime": "2.0.0"
8+
"@softarc/native-federation-runtime": "2.0.4"
99
}
1010
}

libs/native-federation-core/src/lib/config/share-utils.ts

+22
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,15 @@ function readConfiguredSecondaries(
232232
continue;
233233
}
234234

235+
const entry = getDefaultEntry(exports, key);
236+
if (
237+
entry?.endsWith('.css') ||
238+
entry?.endsWith('.scss') ||
239+
entry?.endsWith('.less')
240+
) {
241+
continue;
242+
}
243+
235244
result[secondaryName] = {
236245
...shareObject,
237246
// import: path.join(libPath, relPath)
@@ -241,6 +250,19 @@ function readConfiguredSecondaries(
241250
return result;
242251
}
243252

253+
function getDefaultEntry(
254+
exports: Record<string, Record<string, string>>,
255+
key: string
256+
) {
257+
let entry = '';
258+
if (typeof exports[key] === 'string') {
259+
entry = exports[key] as unknown as string;
260+
} else {
261+
entry = exports[key]?.['default'];
262+
}
263+
return entry;
264+
}
265+
244266
export function shareAll(
245267
config: CustomSharedConfig = {},
246268
skip: SkipList = DEFAULT_SKIP_LIST,

libs/native-federation-core/src/lib/core/bundle-exposed-and-mappings.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
lookupInResultMap,
99
} from '../utils/build-result-map';
1010
import { logger } from '../utils/logger';
11+
import { normalize } from '../utils/normalize';
1112

1213
export interface ArtefactInfo {
1314
mappings: SharedInfo[];
@@ -64,7 +65,7 @@ export async function bundleExposedAndMappings(
6465
dev: !fedOptions.dev
6566
? undefined
6667
: {
67-
entryPoint: path.normalize(item.fileName),
68+
entryPoint: normalize(path.normalize(item.fileName)),
6869
},
6970
});
7071
}
@@ -78,7 +79,9 @@ export async function bundleExposedAndMappings(
7879
dev: !fedOptions.dev
7980
? undefined
8081
: {
81-
entryPoint: item.fileName,
82+
entryPoint: normalize(
83+
path.join(fedOptions.workspaceRoot, item.fileName)
84+
),
8285
},
8386
});
8487
}
@@ -93,8 +96,8 @@ export function describeExposed(
9396
const result: Array<ExposesInfo> = [];
9497

9598
for (const key in config.exposes) {
96-
const localPath = path.normalize(
97-
path.join(options.workspaceRoot, config.exposes[key])
99+
const localPath = normalize(
100+
path.normalize(path.join(options.workspaceRoot, config.exposes[key]))
98101
);
99102

100103
result.push({
@@ -128,7 +131,7 @@ export function describeSharedMappings(
128131
dev: !fedOptions.dev
129132
? undefined
130133
: {
131-
entryPoint: path.normalize(m.path),
134+
entryPoint: normalize(path.normalize(m.path)),
132135
},
133136
});
134137
}

libs/native-federation-esbuild/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "@softarc/native-federation-esbuild",
3-
"version": "2.0.0",
3+
"version": "2.0.4",
44
"type": "commonjs",
55
"dependencies": {
66
"@rollup/plugin-commonjs": "^22.0.2",
77
"@rollup/plugin-node-resolve": "^13.3.0",
88
"@rollup/plugin-replace": "^4.0.0",
99
"rollup": "^2.79.0",
1010
"rollup-plugin-node-externals": "^4.1.1",
11-
"esbuild": "^0.15.5",
11+
"esbuild": "^0.18.12",
1212
"npmlog": "^6.0.2",
1313
"acorn": "^8.8.1"
1414
}

libs/native-federation-runtime/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@softarc/native-federation-runtime",
3-
"version": "2.0.0",
3+
"version": "2.0.4",
44
"peerDependencies": {},
55
"dependencies": {
66
"tslib": "^2.3.0"

libs/native-federation/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular-architects/native-federation",
3-
"version": "16.3.0",
3+
"version": "16.3.4",
44
"main": "src/index.js",
55
"generators": "./collection.json",
66
"builders": "./builders.json",
@@ -16,8 +16,8 @@
1616
},
1717
"dependencies": {
1818
"@babel/core": "^7.19.0",
19-
"@softarc/native-federation": "2.0.0",
20-
"@softarc/native-federation-runtime": "2.0.0",
19+
"@softarc/native-federation": "2.0.4",
20+
"@softarc/native-federation-runtime": "2.0.4",
2121
"@types/browser-sync": "^2.26.3",
2222
"browser-sync": "^2.29.3",
2323
"esbuild": "^0.18.12",

libs/native-federation/src/schematics/init/schematic.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ function updateWorkspaceConfig(
107107
originalBuild.builder = '@angular-devkit/build-angular:browser-esbuild';
108108
}
109109

110+
if (originalBuild.options.browser) {
111+
const browser = originalBuild.options.browser;
112+
delete originalBuild.options.browser;
113+
originalBuild.options.main = browser;
114+
}
115+
110116
projectConfig.architect.esbuild = originalBuild;
111117

112118
projectConfig.architect.build = {
@@ -190,7 +196,9 @@ function normalizeOptions(
190196
.join(projectRoot, 'src/assets/federation.manifest.json')
191197
.replace(/\\/g, '/');
192198

193-
const main = projectConfig.architect.build.options.main;
199+
const main =
200+
projectConfig.architect.build.options.main ||
201+
projectConfig.architect.build.options.browser;
194202

195203
if (!projectConfig.architect.build.options.polyfills) {
196204
projectConfig.architect.build.options.polyfills = [];

update-local.bat

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
call npm unpublish @softarc/native-federation@2.0.0 --registry http://localhost:4873
2-
call npm unpublish @softarc/native-federation-runtime@2.0.0 --registry http://localhost:4873
3-
call npm unpublish @softarc/native-federation-esbuild@2.0.0 --registry http://localhost:4873
4-
call npm unpublish @angular-architects/native-federation@16.3.0 --registry http://localhost:4873
1+
call npm unpublish @softarc/native-federation@2.0.3 --registry http://localhost:4873
2+
call npm unpublish @softarc/native-federation-runtime@2.0.3 --registry http://localhost:4873
3+
call npm unpublish @softarc/native-federation-esbuild@2.0.3 --registry http://localhost:4873
4+
call npm unpublish @angular-architects/native-federation@16.3.3 --registry http://localhost:4873
55

66
call npx nx build native-federation
77
call npx nx build native-federation-core

0 commit comments

Comments
 (0)