Skip to content

Commit ae24696

Browse files
authored
fix: add support for non-bundler module resolution (tsconfig) (#279)
* test: add fixture using non-bundler module resolution * fix: add support non-bundler module resolution (tsconfig) * fix: add some more known nx generated signatures * chore: fix list of files to package
1 parent 77ea085 commit ae24696

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+40266
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ If you did not opt into the App Engine Developer Preview:
115115

116116
```ts
117117
import { CommonEngine } from '@angular/ssr/node'
118-
import { render } from '@netlify/angular-runtime/common-engine'
118+
import { render } from '@netlify/angular-runtime/common-engine.mjs'
119119

120120
const commonEngine = new CommonEngine()
121121

@@ -135,7 +135,7 @@ If you opted into the App Engine Developer Preview:
135135

136136
```ts
137137
import { AngularAppEngine, createRequestHandler } from '@angular/ssr'
138-
import { getContext } from '@netlify/angular-runtime/context'
138+
import { getContext } from '@netlify/angular-runtime/context.mjs'
139139

140140
const angularAppEngine = new AngularAppEngine()
141141

common-engine.d.mts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is duplicating module resolution from package.json#exports
2+
// because some module resolution settings in tsconfig.json are not honoring export maps
3+
// https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution
4+
export * from './src/common-engine.mjs'

common-engine.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is duplicating module resolution from package.json#exports
2+
// because some module resolution settings in tsconfig.json are not honoring export maps
3+
// https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution
4+
export * from './src/common-engine.mjs'

context.d.mts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is duplicating module resolution from package.json#exports
2+
// because some module resolution settings in tsconfig.json are not honoring export maps
3+
// https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution
4+
export * from './src/context.mjs'

context.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is duplicating module resolution from package.json#exports
2+
// because some module resolution settings in tsconfig.json are not honoring export maps
3+
// https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution
4+
export * from './src/context.mjs'

demo/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AngularAppEngine, createRequestHandler } from '@angular/ssr'
2-
import { getContext } from '@netlify/angular-runtime/context'
2+
import { getContext } from '@netlify/angular-runtime/context.mjs'
33

44
const angularAppEngine = new AngularAppEngine()
55

package.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
"src/**/*.js",
88
"src/**/*.mjs",
99
"src/**/*.json",
10-
"src/**/*.d.ts",
10+
"src/**/*.d.mts",
11+
"context.mjs",
12+
"context.d.mts",
13+
"common-engine.mjs",
14+
"common-engine.d.mts",
1115
"manifest.yml"
1216
],
1317
"exports": {
@@ -18,11 +22,19 @@
1822
"default": "./src/index.js"
1923
},
2024
"./common-engine": {
21-
"types": "./src/common-engine.d.ts",
25+
"types": "./src/common-engine.d.mts",
26+
"default": "./src/common-engine.mjs"
27+
},
28+
"./common-engine.mjs": {
29+
"types": "./src/common-engine.d.mts",
2230
"default": "./src/common-engine.mjs"
2331
},
2432
"./context": {
25-
"types": "./src/context.d.ts",
33+
"types": "./src/context.d.mts",
34+
"default": "./src/context.mjs"
35+
},
36+
"./context.mjs": {
37+
"types": "./src/context.d.mts",
2638
"default": "./src/context.mjs"
2739
}
2840
},
@@ -46,6 +58,7 @@
4658
"pretest:fixtures:angular-17": "cd tests/fixtures/angular-17 && npm ci",
4759
"pretest:fixtures:angular-19-common-engine": "cd tests/fixtures/angular-19-common-engine && npm ci",
4860
"pretest:fixtures:angular-19-app-engine": "cd tests/fixtures/angular-19-app-engine && npm ci",
61+
"pretest:fixtures:angular-19-app-engine-node-module-resolution": "cd tests/fixtures/angular-19-app-engine-node-module-resolution && npm ci",
4962
"pretest:fixtures:angular-19-prerender-false": "cd tests/fixtures/angular-19-prerender-false && npm ci",
5063
"pretest:fixtures:nx-angular-19-common-engine": "cd tests/fixtures/nx-angular-19-common-engine && npm ci",
5164
"pretest:fixtures:nx-angular-19-app-engine": "cd tests/fixtures/nx-angular-19-app-engine && npm ci",
File renamed without changes.
File renamed without changes.

src/helpers/knownServerTsSignatures.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"577f7bc87c16bd10bac499e228ef24d23dc4dd516e469b5db3eefae4edcf6345": "CommonEngine",
66
"5678601ed12556305074503967b44ae42c45c268579db057c25cbf4b21a7212e": "CommonEngine",
77
"33d360cdf4819d90afeecd49952241191ee490900fa919a46f990186be3e8b5f": "CommonEngine",
8+
"140c0a0b4a8b648378d53630bee6bef9c3418daf27b372f50c06ab83c9d84a39": "CommonEngine",
89
"76419eb94b4b8672ba3bd79d34c5a66c7c30ff173995ecc6e0adc5808b86822d": "AppEngine",
9-
"a5aad843a116e34ce61264117cba981cff5eea3e6672815a4db08e7b4e5599d6": "AppEngine"
10+
"a5aad843a116e34ce61264117cba981cff5eea3e6672815a4db08e7b4e5599d6": "AppEngine",
11+
"5e0de282eb33582f8ec4c3da2946762d4c95794cb749cfb589407f4d4a0115a7": "AppEngine"
1012
}

0 commit comments

Comments
 (0)