@equinor/roma-nx-plugin 6.1.0 → 6.2.0-beta.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.
- package/CHANGELOG.md +29 -0
- package/migrations.json +18 -0
- package/package.json +16 -15
- package/src/generators/app/data/generated-dependencies.json +1 -0
- package/src/generators/app/files/src/App.tsx.template +20 -42
- package/src/generators/app/files/vite.config.mts.template +16 -0
- package/src/generators/app/files/vite.config.ts.template +16 -0
- package/src/generators/app/files-routing/src/Root.tsx.template +22 -0
- package/src/generators/app/files-routing/src/pages/Home.tsx.template +7 -0
- package/src/generators/app/files-routing/src/pages/Sub.tsx.template +7 -0
- package/src/generators/app/files-routing/src/routes.ts.template +13 -0
- package/src/generators/app/generator.js +3 -0
- package/src/generators/app/generator.js.map +1 -1
- package/src/generators/app/schema.json +1 -1
- package/src/migrations/migrate-fusion-router/detect.d.ts +7 -0
- package/src/migrations/migrate-fusion-router/detect.js +48 -0
- package/src/migrations/migrate-fusion-router/detect.js.map +1 -0
- package/src/migrations/migrate-fusion-router/ensure-default-exports.d.ts +2 -0
- package/src/migrations/migrate-fusion-router/ensure-default-exports.js +52 -0
- package/src/migrations/migrate-fusion-router/ensure-default-exports.js.map +1 -0
- package/src/migrations/migrate-fusion-router/extract-routes.d.ts +12 -0
- package/src/migrations/migrate-fusion-router/extract-routes.js +315 -0
- package/src/migrations/migrate-fusion-router/extract-routes.js.map +1 -0
- package/src/migrations/migrate-fusion-router/generate-routes-file.d.ts +2 -0
- package/src/migrations/migrate-fusion-router/generate-routes-file.js +66 -0
- package/src/migrations/migrate-fusion-router/generate-routes-file.js.map +1 -0
- package/src/migrations/migrate-fusion-router/migrate-fusion-router.d.ts +2 -0
- package/src/migrations/migrate-fusion-router/migrate-fusion-router.js +282 -0
- package/src/migrations/migrate-fusion-router/migrate-fusion-router.js.map +1 -0
- package/src/migrations/migrate-fusion-router/transform-app.d.ts +1 -0
- package/src/migrations/migrate-fusion-router/transform-app.js +187 -0
- package/src/migrations/migrate-fusion-router/transform-app.js.map +1 -0
- package/src/migrations/migrate-fusion-router/update-vite-config.d.ts +1 -0
- package/src/migrations/migrate-fusion-router/update-vite-config.js +34 -0
- package/src/migrations/migrate-fusion-router/update-vite-config.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
# [6.2.0-beta.1](https://github.com/equinor/tops-roma/compare/roma-6.2.0-beta.0...roma-6.2.0-beta.1) (2026-06-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **ROMA-308:** Adjust the router migration ([4c8f53f](https://github.com/equinor/tops-roma/commit/4c8f53fc28530e4a32f9cea92265319aae3af523))
|
|
11
|
+
* **ROMA-308:** code review fix ([0893f57](https://github.com/equinor/tops-roma/commit/0893f574c414c3693786cbfde58a26902eee3214))
|
|
12
|
+
* **ROMA-308:** Remove react-router if manually installed ([31c6275](https://github.com/equinor/tops-roma/commit/31c627550bce49ca18fc326def813ce88fa6d447))
|
|
13
|
+
* **ROMA-308:** Update app generator to use new router ([addff65](https://github.com/equinor/tops-roma/commit/addff65b889008d4a3fdfb77c55f8d8ff7b78e0b))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [6.2.0-beta.0](https://github.com/equinor/tops-roma/compare/roma-6.1.0...roma-6.2.0-beta.0) (2026-06-01)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **ROMA-308:** Change version for fusion-router migration ([5017571](https://github.com/equinor/tops-roma/commit/50175715d885eaca2dcc00a8432b99b47963c9c7))
|
|
23
|
+
* **roma-plugin:** implement AST-based route extraction ([6faeeb5](https://github.com/equinor/tops-roma/commit/6faeeb5732bd8bdea61068b9c9e79ea2a6bedaee))
|
|
24
|
+
* **roma-plugin:** implement default export addition for route components ([71dd64e](https://github.com/equinor/tops-roma/commit/71dd64e4504a9cf03a678d8a11ed5fa8a104e1ee))
|
|
25
|
+
* **roma-plugin:** implement router migration detection logic ([9fe68b0](https://github.com/equinor/tops-roma/commit/9fe68b004a828dbf8e6b4e47999b6f106318f9db))
|
|
26
|
+
* **roma-plugin:** implement routes.ts code generation ([25876e2](https://github.com/equinor/tops-roma/commit/25876e20e5d377b45d10053b9379ed26f8d349d9))
|
|
27
|
+
* **roma-plugin:** implement vite config update ([f30b6e4](https://github.com/equinor/tops-roma/commit/f30b6e4e11ae08af7f6a1ed43c8b1c2408badc0c))
|
|
28
|
+
* **roma-plugin:** register migrate-fusion-router migration at v6.2.0 ([6ddc163](https://github.com/equinor/tops-roma/commit/6ddc163dc132d643b55be1f5305eaf2f5e7017d1))
|
|
29
|
+
* **roma-plugin:** scaffold migrate-fusion-router migration ([66c9844](https://github.com/equinor/tops-roma/commit/66c9844f659a3f232f811ef4ba1ec07c03600391))
|
|
30
|
+
* **roma-plugin:** wire up migration orchestrator with integration tests ([9601636](https://github.com/equinor/tops-roma/commit/960163690d81bb1abe0682c02f82a22c2092c614))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
5
34
|
# [6.1.0](https://github.com/equinor/tops-roma/compare/roma-6.0.4...roma-6.1.0) (2026-05-26)
|
|
6
35
|
|
|
7
36
|
|
package/migrations.json
CHANGED
|
@@ -29,6 +29,11 @@
|
|
|
29
29
|
"version": "6.0.0-beta.0",
|
|
30
30
|
"description": "Migrate useNavigationModule().navigator.push() to useFrameworkModule-based navigation",
|
|
31
31
|
"implementation": "./src/migrations/migrate-global-navigation/migrate-global-navigation"
|
|
32
|
+
},
|
|
33
|
+
"migrate-fusion-router": {
|
|
34
|
+
"version": "6.2.0-beta.0",
|
|
35
|
+
"description": "Migrate apps to fusion-framework-react-router v2 Router component",
|
|
36
|
+
"implementation": "./src/migrations/migrate-fusion-router/migrate-fusion-router"
|
|
32
37
|
}
|
|
33
38
|
},
|
|
34
39
|
"packageJsonUpdates": {
|
|
@@ -451,6 +456,19 @@
|
|
|
451
456
|
"is-mergeable-object": { "version": "^1.1.1" }
|
|
452
457
|
}
|
|
453
458
|
},
|
|
459
|
+
"migrate-fusion-router-deps": {
|
|
460
|
+
"version": "6.2.0-beta.0",
|
|
461
|
+
"packages": {
|
|
462
|
+
"@equinor/fusion-framework-react-router": {
|
|
463
|
+
"version": "^2.0.2",
|
|
464
|
+
"alwaysAddToPackageJson": true
|
|
465
|
+
},
|
|
466
|
+
"@equinor/fusion-framework-module-navigation": {
|
|
467
|
+
"version": "^7.0.0",
|
|
468
|
+
"alwaysAddToPackageJson": true
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
},
|
|
454
472
|
"roma-6": {
|
|
455
473
|
"version": "6.0.0-beta.0",
|
|
456
474
|
"packages": {
|
package/package.json
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/roma-nx-plugin",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.2.0-beta.1",
|
|
5
5
|
"repository": "https://github.com/equinor/tops-roma",
|
|
6
6
|
"dependencies": {
|
|
7
|
+
"@azure/identity": "^4.4.1",
|
|
8
|
+
"@equinor/fusion-framework-module-app": "8.0.0",
|
|
9
|
+
"@equinor/roma-framework": "6.0.0",
|
|
7
10
|
"@nx/devkit": "^22.0.3",
|
|
8
11
|
"@nx/react": "^22.0.3",
|
|
9
|
-
"open": "^10.2.0",
|
|
10
|
-
"vite-plugin-checker": "^0.12.0",
|
|
11
|
-
"tslib": "^2.3.0",
|
|
12
|
-
"@azure/identity": "^4.4.1",
|
|
13
|
-
"vite": "^7.3.2",
|
|
14
12
|
"@vitejs/plugin-react": "^5.1.2",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"rollup": "^4.20.0",
|
|
13
|
+
"cypress": "^15.13.0",
|
|
14
|
+
"esbuild": "0.27.3",
|
|
18
15
|
"express": "^4.18.3",
|
|
16
|
+
"get-port": "^7.2.0",
|
|
19
17
|
"http-proxy-middleware": "^3.0.5",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
18
|
+
"open": "^10.2.0",
|
|
19
|
+
"rollup": "^4.20.0",
|
|
20
|
+
"semver": "6.3.1",
|
|
21
|
+
"ts-morph": "^25.0.1",
|
|
22
|
+
"tslib": "^2.3.0",
|
|
23
|
+
"vite": "^7.3.2",
|
|
24
|
+
"vite-plugin-checker": "^0.12.0",
|
|
25
|
+
"vite-plugin-environment": "^1.1.3"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
28
|
"@nx/devkit": "^22.0.3",
|
|
28
|
-
"@nx/vite": "^22.0.3",
|
|
29
29
|
"@nx/react": "^22.0.3",
|
|
30
|
+
"@nx/vite": "^22.0.3",
|
|
30
31
|
"nx": "^22.0.3"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
@@ -1,46 +1,17 @@
|
|
|
1
|
-
<% if (!minimal && !routing) { %>
|
|
2
|
-
import { Card, Typography, Button, Icon } from '@equinor/eds-core-react';
|
|
3
|
-
import { more_vertical } from '@equinor/eds-icons';
|
|
4
|
-
<% } else { %>
|
|
5
|
-
import { Typography } from '@equinor/eds-core-react';
|
|
6
|
-
<% } %>
|
|
7
1
|
<% if (routing) { %>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { useAppModule } from '@equinor/fusion-framework-react-app';
|
|
11
|
-
|
|
12
|
-
const Root = () => <>
|
|
13
|
-
<Typography variant="body_short_link" as={Link} to="/sub">
|
|
14
|
-
Go to Sub-Root
|
|
15
|
-
</Typography>
|
|
16
|
-
<Typography variant="h1">Welcome to Root route</Typography>
|
|
17
|
-
</>
|
|
18
|
-
const SubRoot = () => (
|
|
19
|
-
<>
|
|
20
|
-
<Typography variant="body_short_link" as={Link} to="/">
|
|
21
|
-
Go back to Root
|
|
22
|
-
</Typography>
|
|
23
|
-
<Typography variant="h1">Welcome to route /sub</Typography>
|
|
24
|
-
</>
|
|
25
|
-
);
|
|
2
|
+
import { Router } from '@equinor/fusion-framework-react-router';
|
|
3
|
+
import { routes } from './routes';
|
|
26
4
|
|
|
5
|
+
export const App = ({ appKey }: { appKey?: string }) => {
|
|
6
|
+
return <Router routes={routes} />;
|
|
7
|
+
};
|
|
27
8
|
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
export default App;
|
|
10
|
+
<% } else if (!minimal) { %>
|
|
11
|
+
import { Card, Typography, Button, Icon } from '@equinor/eds-core-react';
|
|
12
|
+
import { more_vertical } from '@equinor/eds-icons';
|
|
30
13
|
|
|
31
14
|
export const App = (props: Record<string, unknown>) => {
|
|
32
|
-
<% if (!minimal && routing) { %>
|
|
33
|
-
const module = useAppModule<NavigationModule>('navigation');
|
|
34
|
-
const router = module.createRouter([
|
|
35
|
-
{ path: '/', element: <Root /> },
|
|
36
|
-
{ path: '/sub', element: <SubRoot /> },
|
|
37
|
-
] as Array<RouteObject>);
|
|
38
|
-
return (<>
|
|
39
|
-
<Typography variant="h1">Hello <%= name %>!</Typography>
|
|
40
|
-
<RouterProvider router={router}/>
|
|
41
|
-
</>
|
|
42
|
-
)
|
|
43
|
-
<% } else if (!minimal) { %>
|
|
44
15
|
return (
|
|
45
16
|
<Card>
|
|
46
17
|
<Card.Header>
|
|
@@ -70,10 +41,17 @@ export const App = (props: Record<string, unknown>) => {
|
|
|
70
41
|
</Card.Content>
|
|
71
42
|
</Card>
|
|
72
43
|
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default App;
|
|
73
47
|
<% } else { %>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
48
|
+
import { Typography } from '@equinor/eds-core-react';
|
|
49
|
+
|
|
50
|
+
export const App = (props: Record<string, unknown>) => {
|
|
51
|
+
return (
|
|
52
|
+
<Typography variant="h1">Hello <%= name %>!</Typography>
|
|
53
|
+
)
|
|
77
54
|
}
|
|
78
55
|
|
|
79
|
-
export default App;
|
|
56
|
+
export default App;
|
|
57
|
+
<% } %>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
<% if (routing) { %>
|
|
1
2
|
import { defineConfig } from 'vite';
|
|
3
|
+
import { reactRouterPlugin } from '@equinor/fusion-framework-react-router/vite-plugin';
|
|
2
4
|
|
|
3
5
|
export default defineConfig({
|
|
6
|
+
plugins: [reactRouterPlugin()],
|
|
4
7
|
build: {
|
|
5
8
|
lib: {
|
|
6
9
|
entry: 'src/index.ts',
|
|
@@ -9,3 +12,16 @@ export default defineConfig({
|
|
|
9
12
|
},
|
|
10
13
|
},
|
|
11
14
|
});
|
|
15
|
+
<% } else { %>
|
|
16
|
+
import { defineConfig } from 'vite';
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
build: {
|
|
20
|
+
lib: {
|
|
21
|
+
entry: 'src/index.ts',
|
|
22
|
+
fileName: 'app-bundle',
|
|
23
|
+
formats: ['es'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
<% } %>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
<% if (routing) { %>
|
|
1
2
|
import { defineConfig } from 'vite';
|
|
3
|
+
import { reactRouterPlugin } from '@equinor/fusion-framework-react-router/vite-plugin';
|
|
2
4
|
|
|
3
5
|
export default defineConfig({
|
|
6
|
+
plugins: [reactRouterPlugin()],
|
|
4
7
|
build: {
|
|
5
8
|
lib: {
|
|
6
9
|
entry: 'src/index.ts',
|
|
@@ -9,3 +12,16 @@ export default defineConfig({
|
|
|
9
12
|
},
|
|
10
13
|
},
|
|
11
14
|
});
|
|
15
|
+
<% } else { %>
|
|
16
|
+
import { defineConfig } from 'vite';
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
build: {
|
|
20
|
+
lib: {
|
|
21
|
+
entry: 'src/index.ts',
|
|
22
|
+
fileName: 'app-bundle',
|
|
23
|
+
formats: ['es'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
<% } %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Typography } from '@equinor/eds-core-react';
|
|
2
|
+
import { Link, Outlet } from '@equinor/fusion-framework-react-router';
|
|
3
|
+
|
|
4
|
+
export const Root = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<Typography variant="h1"><%= name %></Typography>
|
|
8
|
+
<nav>
|
|
9
|
+
<Typography variant="body_short_link" as={Link} to="/">
|
|
10
|
+
Home
|
|
11
|
+
</Typography>
|
|
12
|
+
{' | '}
|
|
13
|
+
<Typography variant="body_short_link" as={Link} to="/sub">
|
|
14
|
+
Sub
|
|
15
|
+
</Typography>
|
|
16
|
+
</nav>
|
|
17
|
+
<Outlet />
|
|
18
|
+
</>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Root;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
index,
|
|
3
|
+
prefix,
|
|
4
|
+
layout,
|
|
5
|
+
} from '@equinor/fusion-framework-react-router/routes';
|
|
6
|
+
|
|
7
|
+
const pages = [
|
|
8
|
+
index('./pages/Home.tsx'),
|
|
9
|
+
prefix('sub', [index('./pages/Sub.tsx')]),
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export const routes = layout('./Root.tsx', pages);
|
|
13
|
+
export default routes;
|
|
@@ -71,6 +71,9 @@ async function appGenerator(tree, options) {
|
|
|
71
71
|
console.log('name', options.name);
|
|
72
72
|
updateTargets(tree, options);
|
|
73
73
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), outputDir, options);
|
|
74
|
+
if (options.routing) {
|
|
75
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files-routing'), outputDir, options);
|
|
76
|
+
}
|
|
74
77
|
await addDependencies(tree, options);
|
|
75
78
|
await (0, devkit_1.formatFiles)(tree);
|
|
76
79
|
tree.delete(`${outputDir}/src/app`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/generators/app/generator.ts"],"names":[],"mappings":";;AAqFA,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/generators/app/generator.ts"],"names":[],"mappings":";;AAqFA,oCA6CC;;AAlID,uCAUoB;AACpB,2BAAkC;AAClC,mDAA6B;AAE7B,qCAAiD;AAEjD,mHAA6F;AAE7F,SAAS,yBAAyB;IAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,6BAA6B,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5D,OAAO,OAAO,CAAC,YAAY,CAAC;AAC9B,CAAC;AAED,KAAK,UAAU,eAAe,CAC5B,IAAU,EACV,OAA2E;IAE3E,MAAM,YAAY,GAAG,yBAAyB,EAAE,CAAC;IACjD,MAAM,eAAe,GAAG,EAAE,CAAC;IAC3B,OAAO,IAAA,yBAAgB,EACrB,GAAG;QACD,IAAA,qCAA4B,EAC1B,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,SAAS,EACT,KAAK,CACN;KACF,CACF,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CACpB,IAAU,EACV,OAA+D;;IAE/D,MAAM,QAAQ,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,kCACxC,QAAQ,KACX,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,QAAQ,EAAE,+BAA+B;gBACzC,OAAO,EAAE,EAAE;aACZ;YACD,KAAK,E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QACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectAppsToMigrate = detectAppsToMigrate;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function detectAppsToMigrate(tree) {
|
|
6
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
7
|
+
const detected = [];
|
|
8
|
+
for (const [name, project] of projects) {
|
|
9
|
+
if (project.projectType !== 'application')
|
|
10
|
+
continue;
|
|
11
|
+
const appFilePath = findAppFile(tree, project.root);
|
|
12
|
+
if (!appFilePath)
|
|
13
|
+
continue;
|
|
14
|
+
const content = tree.read(appFilePath, 'utf-8');
|
|
15
|
+
if (!content)
|
|
16
|
+
continue;
|
|
17
|
+
if (isAlreadyMigrated(content))
|
|
18
|
+
continue;
|
|
19
|
+
if (!usesOldRouterPattern(content))
|
|
20
|
+
continue;
|
|
21
|
+
detected.push({
|
|
22
|
+
projectName: name,
|
|
23
|
+
projectRoot: project.root,
|
|
24
|
+
appFilePath,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return detected;
|
|
28
|
+
}
|
|
29
|
+
function findAppFile(tree, projectRoot) {
|
|
30
|
+
var _a;
|
|
31
|
+
const candidates = [
|
|
32
|
+
`${projectRoot}/src/App.tsx`,
|
|
33
|
+
`${projectRoot}/src/app.tsx`,
|
|
34
|
+
`${projectRoot}/src/app/App.tsx`,
|
|
35
|
+
`${projectRoot}/src/app/app.tsx`,
|
|
36
|
+
];
|
|
37
|
+
return (_a = candidates.find((path) => tree.exists(path))) !== null && _a !== void 0 ? _a : null;
|
|
38
|
+
}
|
|
39
|
+
function isAlreadyMigrated(content) {
|
|
40
|
+
return (content.includes("from '@equinor/fusion-framework-react-router'") &&
|
|
41
|
+
content.includes('Router'));
|
|
42
|
+
}
|
|
43
|
+
function usesOldRouterPattern(content) {
|
|
44
|
+
const hasRouterProvider = content.includes('RouterProvider');
|
|
45
|
+
const hasCreateRouter = content.includes('createRouter');
|
|
46
|
+
return hasRouterProvider && hasCreateRouter;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/migrations/migrate-fusion-router/detect.ts"],"names":[],"mappings":";;AAQA,kDAwBC;AAhCD,uCAA+C;AAQ/C,SAAgB,mBAAmB,CAAC,IAAU;IAC5C,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAkB,EAAE,CAAC;IAEnC,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,QAAQ,EAAE,CAAC;QACvC,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa;YAAE,SAAS;QAEpD,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,WAAW;YAAE,SAAS;QAE3B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO;YAAE,SAAS;QAEvB,IAAI,iBAAiB,CAAC,OAAO,CAAC;YAAE,SAAS;QACzC,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;YAAE,SAAS;QAE7C,QAAQ,CAAC,IAAI,CAAC;YACZ,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,OAAO,CAAC,IAAI;YACzB,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,WAAW,CAAC,IAAU,EAAE,WAAmB;;IAClD,MAAM,UAAU,GAAG;QACjB,GAAG,WAAW,cAAc;QAC5B,GAAG,WAAW,cAAc;QAC5B,GAAG,WAAW,kBAAkB;QAChC,GAAG,WAAW,kBAAkB;KACjC,CAAC;IACF,OAAO,MAAA,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,mCAAI,IAAI,CAAC;AAC9D,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAe;IACxC,OAAO,CACL,OAAO,CAAC,QAAQ,CAAC,+CAA+C,CAAC;QACjE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAC3B,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAe;IAC3C,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC7D,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IACzD,OAAO,iBAAiB,IAAI,eAAe,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureDefaultExports = ensureDefaultExports;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
function ensureDefaultExports(tree, filePaths) {
|
|
6
|
+
for (const filePath of filePaths) {
|
|
7
|
+
if (!tree.exists(filePath))
|
|
8
|
+
continue;
|
|
9
|
+
const content = tree.read(filePath, 'utf-8');
|
|
10
|
+
if (!content)
|
|
11
|
+
continue;
|
|
12
|
+
if (hasDefaultExport(content))
|
|
13
|
+
continue;
|
|
14
|
+
const componentName = findMainExportName(content);
|
|
15
|
+
if (!componentName)
|
|
16
|
+
continue;
|
|
17
|
+
const updated = content.trimEnd() + `\n\nexport default ${componentName};\n`;
|
|
18
|
+
tree.write(filePath, updated);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function hasDefaultExport(content) {
|
|
22
|
+
return /export\s+default\s/.test(content);
|
|
23
|
+
}
|
|
24
|
+
function findMainExportName(content) {
|
|
25
|
+
const project = new ts_morph_1.Project({ useInMemoryFileSystem: true });
|
|
26
|
+
const sourceFile = project.createSourceFile('temp.tsx', content);
|
|
27
|
+
// Look for named exports that are likely components (PascalCase)
|
|
28
|
+
const exportedDecls = sourceFile.getExportedDeclarations();
|
|
29
|
+
for (const [name] of exportedDecls) {
|
|
30
|
+
if (/^[A-Z]/.test(name) && name !== 'default') {
|
|
31
|
+
return name;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Fallback: find first exported const/function with PascalCase name
|
|
35
|
+
const varStatements = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.VariableStatement);
|
|
36
|
+
for (const stmt of varStatements) {
|
|
37
|
+
if (stmt.isExported()) {
|
|
38
|
+
const decl = stmt.getDeclarationList().getDeclarations()[0];
|
|
39
|
+
if (decl && /^[A-Z]/.test(decl.getName())) {
|
|
40
|
+
return decl.getName();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const functions = sourceFile.getFunctions();
|
|
45
|
+
for (const fn of functions) {
|
|
46
|
+
if (fn.isExported() && fn.getName() && /^[A-Z]/.test(fn.getName())) {
|
|
47
|
+
return fn.getName();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=ensure-default-exports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-default-exports.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/migrations/migrate-fusion-router/ensure-default-exports.ts"],"names":[],"mappings":";;AAGA,oDAeC;AAjBD,uCAA+C;AAE/C,SAAgB,oBAAoB,CAAC,IAAU,EAAE,SAAmB;IAClE,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,C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AAI,CAAC,kBAAkB,EAAE,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC;YAC5D,IAAI,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;gBAC1C,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,EAAE,CAAC;IAC5C,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;QAC3B,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAG,CAAC,EAAE,CAAC;YACpE,OAAO,EAAE,CAAC,OAAO,EAAG,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ExtractedRoute = {
|
|
2
|
+
type: 'layout' | 'index' | 'prefix' | 'route';
|
|
3
|
+
path?: string;
|
|
4
|
+
componentImportName?: string;
|
|
5
|
+
componentFilePath?: string;
|
|
6
|
+
children?: Array<ExtractedRoute>;
|
|
7
|
+
hasLoader?: boolean;
|
|
8
|
+
hasErrorElement?: boolean;
|
|
9
|
+
hasComplexElement?: boolean;
|
|
10
|
+
navigateTo?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function extractRoutes(appFileContent: string): ExtractedRoute | null;
|