@fougere/next 0.15.0-alpha.0 → 0.16.0-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 CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { NextConfig } from 'next';
2
2
  /**
3
- * `root` is where the fronds are — `'../..'` for an app under `apps/`, the same option `fougere()`
4
- * takes for Vite and `fougere:` for Nuxt. The facade is written in the app, where its tsconfig
5
- * looks for it, and the boot learns the root through `FOUGERE_ROOT`, as it does under Vite.
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;
@@ -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;AAmCvC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,GAAE,UAAe,EAAE,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,UAAU,CAgDhG"}
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,CAgDhG"}
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
- * `root` is where the fronds are — `'../..'` for an app under `apps/`, the same option `fougere()`
36
- * takes for Vite and `fougere:` for Nuxt. The facade is written in the app, where its tsconfig
37
- * looks for it, and the boot learns the root through `FOUGERE_ROOT`, as it does under Vite.
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 {
@@ -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;AAErD,+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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E;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.15.0-alpha.0",
3
+ "version": "0.16.0-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.15.0-alpha.0",
53
- "@fougere/compiler": "0.15.0-alpha.0",
54
- "@fougere/core": "0.15.0-alpha.0",
52
+ "@fougere/app": "0.16.0-alpha.0",
53
+ "@fougere/compiler": "0.16.0-alpha.0",
54
+ "@fougere/core": "0.16.0-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
- * `root` is where the fronds are — `'../..'` for an app under `apps/`, the same option `fougere()`
42
- * takes for Vite and `fougere:` for Nuxt. The facade is written in the app, where its tsconfig
43
- * looks for it, and the boot learns the root through `FOUGERE_ROOT`, as it does under Vite.
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
 
@@ -29,10 +29,7 @@
29
29
  "kind": "wrapExport",
30
30
  "file": "next.config.ts",
31
31
  "from": "@fougere/next/config",
32
- "imported": "withFougere",
33
- "options": {
34
- "root": "../.."
35
- }
32
+ "imported": "withFougere"
36
33
  },
37
34
  "tsconfig": "tsconfig.json"
38
35
  }