orga-build 0.2.2 → 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/app.jsx CHANGED
@@ -1,6 +1,6 @@
1
- import pages from '@orga-build/pages'
2
- import layouts from '@orga-build/layouts'
3
- import * as components from '@orga-build/components'
1
+ import pages from '/@orga-build/pages'
2
+ import layouts from '/@orga-build/layouts'
3
+ import * as components from '/@orga-build/components'
4
4
  import { Route, Switch, Link } from 'wouter'
5
5
 
6
6
  export function App() {
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,iBAwJtC"}
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
  */
@@ -40,6 +49,7 @@ export async function build({
40
49
  build: {
41
50
  ssr: true,
42
51
  cssCodeSplit: false,
52
+ emptyOutDir: true,
43
53
  rollupOptions: {
44
54
  input: fileURLToPath(new URL('./ssr.jsx', import.meta.url)),
45
55
  output: {
@@ -52,6 +62,9 @@ export async function build({
52
62
  },
53
63
  ssr: {
54
64
  noExternal: true
65
+ },
66
+ resolve: {
67
+ alias: alias
55
68
  }
56
69
  })
57
70
 
@@ -67,6 +80,7 @@ export async function build({
67
80
  plugins,
68
81
  build: {
69
82
  cssCodeSplit: false,
83
+ emptyOutDir: true,
70
84
  rollupOptions: {
71
85
  input: fileURLToPath(new URL('./client.jsx', import.meta.url)),
72
86
  preserveEntrySignatures: 'allow-extension'
@@ -76,6 +90,9 @@ export async function build({
76
90
  },
77
91
  ssr: {
78
92
  noExternal: true
93
+ },
94
+ resolve: {
95
+ alias: alias
79
96
  }
80
97
  })
81
98
 
@@ -0,0 +1,2 @@
1
+ export { Link } from "wouter";
2
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["components.js"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export { Link } from 'wouter'
@@ -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/lib/ssr.jsx CHANGED
@@ -1,4 +1,4 @@
1
- import pages from '@orga-build/pages'
1
+ import pages from '/@orga-build/pages'
2
2
  import { renderToString } from 'react-dom/server'
3
3
  import { App } from './app.jsx'
4
4
  import { Router } from 'wouter'
package/lib/vite.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["vite.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,uCAHG;IAAwB,GAAG,EAAnB,MAAM;CACd,GAAU,OAAO,MAAM,EAAE,MAAM,CA+FjC"}
1
+ {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["vite.js"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,uCAHG;IAAwB,GAAG,EAAnB,MAAM;CACd,GAAU,OAAO,MAAM,EAAE,MAAM,CA2GjC"}
package/lib/vite.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { setup } from './files.js'
2
2
  import path from 'node:path'
3
3
 
4
- const magicModulePrefix = '@orga-build'
5
- const appEntryId = `/${magicModulePrefix}/main.js`
4
+ const magicModulePrefix = '/@orga-build/'
5
+ const pagesModuleId = magicModulePrefix + 'pages'
6
+ const appEntryId = `${magicModulePrefix}main.js`
6
7
 
7
8
  /**
8
9
  * @param {Object} options
@@ -15,6 +16,19 @@ export function pluginFactory({ dir }) {
15
16
  return {
16
17
  name: 'vite-plugin-orga-pages',
17
18
  enforce: 'pre',
19
+ config: (config, env) => ({
20
+ optimizeDeps: {
21
+ include: [
22
+ 'react',
23
+ 'react/jsx-runtime',
24
+ 'react-dom',
25
+ 'react-dom/client',
26
+ 'wouter'
27
+ ],
28
+ exclude: ['orga-build']
29
+ }
30
+ }),
31
+
18
32
  configureServer({ watcher, moduleGraph }) {
19
33
  const reloadVirtualModule = (/** @type {string} */ moduleId) => {
20
34
  const module = moduleGraph.getModuleById(moduleId)
@@ -27,8 +41,7 @@ export function pluginFactory({ dir }) {
27
41
  reloadVirtualModule('/')
28
42
  },
29
43
 
30
- buildStart() {
31
- },
44
+ buildStart() {},
32
45
 
33
46
  async resolveId(id, importer) {
34
47
  if (id === appEntryId) {
@@ -40,13 +53,13 @@ export function pluginFactory({ dir }) {
40
53
  },
41
54
  async load(id) {
42
55
  if (id === appEntryId) {
43
- return `import "orga-build/csr.jsx";`
56
+ return `import "orga-build/csr";`
44
57
  }
45
- if (id === `${magicModulePrefix}/pages`) {
58
+ if (id === pagesModuleId) {
46
59
  return await renderPageList()
47
60
  }
48
- if (id.startsWith(`${magicModulePrefix}/pages/`)) {
49
- let pageId = id.replace(`${magicModulePrefix}/pages/`, '/')
61
+ if (id.startsWith(pagesModuleId)) {
62
+ let pageId = id.replace(pagesModuleId, '')
50
63
  const page = await files.page(pageId)
51
64
  if (page) {
52
65
  return `
@@ -56,7 +69,7 @@ export {default} from '${page.dataPath}';
56
69
  }
57
70
  }
58
71
 
59
- if (id === `${magicModulePrefix}/layouts`) {
72
+ if (id === `${magicModulePrefix}layouts`) {
60
73
  const layouts = await files.layouts()
61
74
  /** @type {string[]} */
62
75
  const imports = []
@@ -72,7 +85,7 @@ export default layouts;
72
85
  `
73
86
  }
74
87
 
75
- if (id === `${magicModulePrefix}/components`) {
88
+ if (id === `${magicModulePrefix}components`) {
76
89
  return await renderComponents()
77
90
  }
78
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orga-build",
3
- "version": "0.2.2",
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": {
@@ -18,7 +18,8 @@
18
18
  "types": "./index.d.ts",
19
19
  "import": "./index.js"
20
20
  },
21
- "./csr.jsx": "./lib/csr.jsx"
21
+ "./csr": "./lib/csr.jsx",
22
+ "./components": "./lib/components.js"
22
23
  },
23
24
  "keywords": [
24
25
  "orgajs",
@@ -31,15 +32,14 @@
31
32
  "license": "MIT",
32
33
  "dependencies": {
33
34
  "@vitejs/plugin-react": "^4.4.0",
34
- "esbuild": "^0.24.2",
35
35
  "express": "^5.1.0",
36
36
  "globby": "^14.1.0",
37
+ "react": "^19.0.0",
38
+ "react-dom": "^19.0.0",
37
39
  "rehype-katex": "^7.0.1",
38
40
  "unist-util-visit-parents": "^6.0.1",
39
41
  "vite": "6.3.2",
40
42
  "wouter": "^3.7.0",
41
- "@orgajs/esbuild": "^1.1.3",
42
- "@orgajs/node-loader": "^1.1.3",
43
43
  "@orgajs/rollup": "1.3.2"
44
44
  },
45
45
  "devDependencies": {
@@ -47,13 +47,7 @@
47
47
  "@types/hast": "^3.0.4",
48
48
  "@types/node": "^22.13.1",
49
49
  "@types/react": "^19.0.8",
50
- "@types/react-dom": "^19.0.3",
51
- "@orgajs/orgx": "^2.5.2",
52
- "orga": "^4.5.1"
53
- },
54
- "peerDependencies": {
55
- "react": "^19.0.0",
56
- "react-dom": "^19.0.0"
50
+ "@types/react-dom": "^19.0.3"
57
51
  },
58
52
  "scripts": {}
59
53
  }