@fougere/next 0.15.1-alpha.0 → 0.16.2-alpha.0
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/dist/config.d.ts +3 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +8 -5
- package/dist/config.js.map +1 -1
- package/package.json +4 -4
- package/src/config.ts +8 -5
- package/template/scaffold.json +1 -4
package/dist/config.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { NextConfig } from 'next';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* takes for Vite and `fougere:` for Nuxt. The facade is written in the app,
|
|
5
|
-
* looks for it, and the boot learns the root through `FOUGERE_ROOT
|
|
3
|
+
* The fronds are found on their own (`projectRootOf`) — `root` is for when they sit elsewhere, the
|
|
4
|
+
* same option `fougere()` takes for Vite and `fougere:` for Nuxt. The facade is written in the app,
|
|
5
|
+
* where its tsconfig looks for it, and the boot learns the root through `FOUGERE_ROOT`.
|
|
6
6
|
*/
|
|
7
7
|
export declare function withFougere(config?: NextConfig, options?: {
|
|
8
8
|
root?: string;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAoCvC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,GAAE,UAAe,EAAE,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,UAAU,CAkDhG"}
|
package/dist/config.js
CHANGED
|
@@ -3,6 +3,7 @@ import { mkdirSync, writeFileSync } from 'node:fs';
|
|
|
3
3
|
import { dirname, join, resolve } from 'node:path';
|
|
4
4
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
5
5
|
import { RUNTIME_PACKAGES } from '@fougere/compiler';
|
|
6
|
+
import { projectRootOf } from '@fougere/core/node';
|
|
6
7
|
/** Where the facades land, and what a page imports them by. */
|
|
7
8
|
const FACADE = '.fougere/facade.generated.ts';
|
|
8
9
|
const SPECIFIER = '@fronds/facade';
|
|
@@ -32,14 +33,14 @@ async function writeFacades(root, app) {
|
|
|
32
33
|
catch { /* a host with no fronds, or a scan that could not run */ }
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
-
* takes for Vite and `fougere:` for Nuxt. The facade is written in the app,
|
|
37
|
-
* looks for it, and the boot learns the root through `FOUGERE_ROOT
|
|
36
|
+
* The fronds are found on their own (`projectRootOf`) — `root` is for when they sit elsewhere, the
|
|
37
|
+
* same option `fougere()` takes for Vite and `fougere:` for Nuxt. The facade is written in the app,
|
|
38
|
+
* where its tsconfig looks for it, and the boot learns the root through `FOUGERE_ROOT`.
|
|
38
39
|
*/
|
|
39
40
|
export function withFougere(config = {}, options = {}) {
|
|
40
41
|
const userWebpack = config.webpack;
|
|
41
42
|
const app = process.cwd();
|
|
42
|
-
const root = resolve(app, options.root
|
|
43
|
+
const root = options.root ? resolve(app, options.root) : projectRootOf(app);
|
|
43
44
|
process.env.FOUGERE_ROOT = root;
|
|
44
45
|
const written = writeFacades(root, app);
|
|
45
46
|
return {
|
|
@@ -54,7 +55,9 @@ export function withFougere(config = {}, options = {}) {
|
|
|
54
55
|
// project that never generated it fails to resolve rather than losing its types in silence.
|
|
55
56
|
turbopack: {
|
|
56
57
|
...config.turbopack,
|
|
57
|
-
|
|
58
|
+
// Relative to the app: Turbopack refuses an absolute target — "server relative imports are
|
|
59
|
+
// not implemented yet" — where webpack, below, wants one.
|
|
60
|
+
resolveAlias: { ...config.turbopack?.resolveAlias, [SPECIFIER]: `./${FACADE}` },
|
|
58
61
|
},
|
|
59
62
|
webpack: (webpackConfig, context) => {
|
|
60
63
|
// The app's own webpack function runs FIRST, so it sees an untouched config
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,+DAA+D;AAC/D,MAAM,MAAM,GAAG,8BAA8B,CAAC;AAC9C,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC;;;;;;;GAOG;AACH,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,GAAW;IACnD,IAAI,CAAC;QACH,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACpF,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAC/D,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;QAC7D,MAAM,EAA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,CAAC;gBAC/E,2EAA2E;gBAC3E,0EAA0E;gBAC1E,+DAA+D;gBAC/D,IAAI,YAAY,CAAC,EAAE,aAAa,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC;aAC/D,CAAC;YAEF,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fougere/next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.2-alpha.0",
|
|
4
4
|
"description": "The Next.js adapter: mounting, and the one import that is genuinely Next.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fougere",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"template"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@fougere/app": "0.
|
|
53
|
-
"@fougere/compiler": "0.
|
|
54
|
-
"@fougere/core": "0.
|
|
52
|
+
"@fougere/app": "0.16.2-alpha.0",
|
|
53
|
+
"@fougere/compiler": "0.16.2-alpha.0",
|
|
54
|
+
"@fougere/core": "0.16.2-alpha.0",
|
|
55
55
|
"jiti": "^2.7.0",
|
|
56
56
|
"terser-webpack-plugin": "^5.3.14"
|
|
57
57
|
},
|
package/src/config.ts
CHANGED
|
@@ -5,6 +5,7 @@ import TerserPlugin from 'terser-webpack-plugin';
|
|
|
5
5
|
import type { NextConfig } from 'next';
|
|
6
6
|
|
|
7
7
|
import { RUNTIME_PACKAGES } from '@fougere/compiler';
|
|
8
|
+
import { projectRootOf } from '@fougere/core/node';
|
|
8
9
|
|
|
9
10
|
/** Where the facades land, and what a page imports them by. */
|
|
10
11
|
const FACADE = '.fougere/facade.generated.ts';
|
|
@@ -38,14 +39,14 @@ async function writeFacades(root: string, app: string): Promise<void> {
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
|
-
*
|
|
42
|
-
* takes for Vite and `fougere:` for Nuxt. The facade is written in the app,
|
|
43
|
-
* looks for it, and the boot learns the root through `FOUGERE_ROOT
|
|
42
|
+
* The fronds are found on their own (`projectRootOf`) — `root` is for when they sit elsewhere, the
|
|
43
|
+
* same option `fougere()` takes for Vite and `fougere:` for Nuxt. The facade is written in the app,
|
|
44
|
+
* where its tsconfig looks for it, and the boot learns the root through `FOUGERE_ROOT`.
|
|
44
45
|
*/
|
|
45
46
|
export function withFougere(config: NextConfig = {}, options: { root?: string } = {}): NextConfig {
|
|
46
47
|
const userWebpack = config.webpack;
|
|
47
48
|
const app = process.cwd();
|
|
48
|
-
const root = resolve(app, options.root
|
|
49
|
+
const root = options.root ? resolve(app, options.root) : projectRootOf(app);
|
|
49
50
|
process.env.FOUGERE_ROOT = root;
|
|
50
51
|
const written = writeFacades(root, app);
|
|
51
52
|
|
|
@@ -61,7 +62,9 @@ export function withFougere(config: NextConfig = {}, options: { root?: string }
|
|
|
61
62
|
// project that never generated it fails to resolve rather than losing its types in silence.
|
|
62
63
|
turbopack: {
|
|
63
64
|
...config.turbopack,
|
|
64
|
-
|
|
65
|
+
// Relative to the app: Turbopack refuses an absolute target — "server relative imports are
|
|
66
|
+
// not implemented yet" — where webpack, below, wants one.
|
|
67
|
+
resolveAlias: { ...config.turbopack?.resolveAlias, [SPECIFIER]: `./${FACADE}` },
|
|
65
68
|
},
|
|
66
69
|
webpack: (webpackConfig, context) => {
|
|
67
70
|
// The app's own webpack function runs FIRST, so it sees an untouched config
|
package/template/scaffold.json
CHANGED