orga-build 0.2.3 → 0.2.4

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/lib/build.d.ts CHANGED
@@ -2,4 +2,9 @@
2
2
  * @param {import('./config.js').Config} config
3
3
  */
4
4
  export function build({ outDir, root, containerClass, vitePlugins }: import("./config.js").Config): Promise<void>;
5
+ export const alias: {
6
+ react: string;
7
+ 'react-dom': string;
8
+ wouter: string;
9
+ };
5
10
  //# sourceMappingURL=build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["build.js"],"names":[],"mappings":"AAWA;;GAEG;AACH,qEAFW,OAAO,aAAa,EAAE,MAAM,iBA0JtC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["build.js"],"names":[],"mappings":"AAoBA;;GAEG;AACH,qEAFW,OAAO,aAAa,EAAE,MAAM,iBAgKtC;AAvKD;;;;EAIC"}
package/lib/build.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import path from 'node:path'
2
+ import { createRequire } from 'node:module'
2
3
  import { build as viteBuild } from 'vite'
3
4
  import orga from '@orgajs/rollup'
4
5
  import react from '@vitejs/plugin-react'
@@ -9,6 +10,14 @@ import fs from 'fs/promises'
9
10
  import assert from 'node:assert'
10
11
  import { rehypeWrap } from './plugins.js'
11
12
 
13
+ const require = createRequire(import.meta.url)
14
+
15
+ export const alias = {
16
+ react: path.dirname(require.resolve('react/package.json')),
17
+ 'react-dom': path.dirname(require.resolve('react-dom/package.json')),
18
+ wouter: path.dirname(require.resolve('wouter'))
19
+ }
20
+
12
21
  /**
13
22
  * @param {import('./config.js').Config} config
14
23
  */
@@ -53,6 +62,9 @@ export async function build({
53
62
  },
54
63
  ssr: {
55
64
  noExternal: true
65
+ },
66
+ resolve: {
67
+ alias: alias
56
68
  }
57
69
  })
58
70
 
@@ -78,6 +90,9 @@ export async function build({
78
90
  },
79
91
  ssr: {
80
92
  noExternal: true
93
+ },
94
+ resolve: {
95
+ alias: alias
81
96
  }
82
97
  })
83
98
 
@@ -1 +1 @@
1
- {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["serve.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH,8BAHW,OAAO,aAAa,EAAE,MAAM,SAC5B,MAAM,iBA0ChB"}
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["serve.js"],"names":[],"mappings":"AASA;;;GAGG;AACH,8BAHW,OAAO,aAAa,EAAE,MAAM,SAC5B,MAAM,iBA6ChB"}
package/lib/serve.js CHANGED
@@ -5,6 +5,7 @@ import orga from '@orgajs/rollup'
5
5
  import react from '@vitejs/plugin-react'
6
6
  import { pluginFactory } from './vite.js'
7
7
  import { rehypeWrap } from './plugins.js'
8
+ import { alias } from './build.js'
8
9
 
9
10
  /**
10
11
  * @param {import('./config.js').Config} config
@@ -22,7 +23,10 @@ export async function serve(config, port = 3000) {
22
23
  ...config.vitePlugins
23
24
  ],
24
25
  server: { middlewareMode: true },
25
- appType: 'custom'
26
+ appType: 'custom',
27
+ resolve: {
28
+ alias: alias
29
+ }
26
30
  })
27
31
 
28
32
  app.use(vite.middlewares)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orga-build",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "A simple tool that builds org-mode files into a website",
5
5
  "type": "module",
6
6
  "bin": {