orga-build 0.6.1 → 0.6.2

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.
@@ -29,6 +29,10 @@ Here's [[file:more.org][another page]].
29
29
  )
30
30
  await fs.writeFile(path.join(fixtureDir, 'docs', 'index.org'), 'Docs index page.')
31
31
  await fs.writeFile(path.join(fixtureDir, 'more.org'), 'Another page.')
32
+ await fs.writeFile(
33
+ path.join(fixtureDir, 'style.css'),
34
+ '.global-style-marker { color: rgb(1, 2, 3); }'
35
+ )
32
36
  })
33
37
 
34
38
  after(async () => {
@@ -70,4 +74,29 @@ Here's [[file:more.org][another page]].
70
74
  .catch(() => false)
71
75
  assert.ok(assetsExists, 'assets directory should exist')
72
76
  })
77
+
78
+ test('processes configured global styles through vite and injects built css', async () => {
79
+ await build({
80
+ root: fixtureDir,
81
+ outDir: outDir,
82
+ containerClass: [],
83
+ styles: ['/style.css'],
84
+ vitePlugins: [],
85
+ preBuild: [],
86
+ postBuild: []
87
+ })
88
+
89
+ const html = await fs.readFile(path.join(outDir, 'index.html'), 'utf-8')
90
+ assert.ok(!html.includes('href="/style.css"'), 'should not link raw source css path')
91
+
92
+ const cssHrefMatch = html.match(/href="\/(assets\/[^"]+\.css)"/)
93
+ assert.ok(cssHrefMatch, 'should link built css asset from assets with hashed name')
94
+
95
+ const builtCssPath = cssHrefMatch[1]
96
+ const builtCss = await fs.readFile(path.join(outDir, builtCssPath), 'utf-8')
97
+ assert.ok(
98
+ builtCss.includes('.global-style-marker'),
99
+ 'built css should include configured global style content'
100
+ )
101
+ })
73
102
  })
package/lib/build.js CHANGED
@@ -5,12 +5,12 @@ import { emptyDir, ensureDir, exists } from './fs.js'
5
5
  import fs from 'fs/promises'
6
6
  import { createOrgaBuildConfig, alias } from './plugin.js'
7
7
  import { escapeHtml } from './util.js'
8
+ import { appEntryId } from './vite.js'
8
9
 
9
10
  // Re-export alias for backwards compatibility
10
11
  export { alias }
11
12
 
12
13
  const ssrEntry = fileURLToPath(new URL('./ssr.jsx', import.meta.url))
13
- const clientEntry = fileURLToPath(new URL('./client.jsx', import.meta.url))
14
14
  const defaultIndexHtml = fileURLToPath(new URL('./index.html', import.meta.url))
15
15
 
16
16
  /**
@@ -66,7 +66,7 @@ export async function build({
66
66
  emptyOutDir: false,
67
67
  assetsDir: 'assets',
68
68
  rollupOptions: {
69
- input: clientEntry,
69
+ input: appEntryId,
70
70
  preserveEntrySignatures: 'allow-extension'
71
71
  }
72
72
  }
package/lib/vite.d.ts CHANGED
@@ -10,4 +10,5 @@ export function pluginFactory({ dir, outDir, styles }: {
10
10
  outDir?: string | undefined;
11
11
  styles?: string[] | undefined;
12
12
  }): import("vite").Plugin;
13
+ export const appEntryId: "/@orga-build/main.js";
13
14
  //# sourceMappingURL=vite.d.ts.map
package/lib/vite.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["vite.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,uDALG;IAAwB,GAAG,EAAnB,MAAM;IACW,MAAM;IACJ,MAAM;CACjC,GAAU,OAAO,MAAM,EAAE,MAAM,CA8JjC"}
1
+ {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["vite.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,uDALG;IAAwB,GAAG,EAAnB,MAAM;IACW,MAAM;IACJ,MAAM;CACjC,GAAU,OAAO,MAAM,EAAE,MAAM,CA8JjC;AAvKD,gDAAuD"}
package/lib/vite.js CHANGED
@@ -3,7 +3,7 @@ import path from 'node:path'
3
3
 
4
4
  const magicModulePrefix = '/@orga-build/'
5
5
  const pagesModuleId = magicModulePrefix + 'pages'
6
- const appEntryId = `${magicModulePrefix}main.js`
6
+ export const appEntryId = `${magicModulePrefix}main.js`
7
7
  const contentModuleId = 'orga-build:content'
8
8
  const contentModuleIdResolved = '\0' + contentModuleId
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orga-build",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "A simple tool that builds org-mode files into a website",
5
5
  "type": "module",
6
6
  "engines": {
package/lib/client.jsx DELETED
@@ -1,12 +0,0 @@
1
- import { hydrateRoot } from 'react-dom/client'
2
- import { Router } from 'wouter'
3
- import { App } from './app.jsx'
4
-
5
- const ssr = window._ssr
6
-
7
- hydrateRoot(
8
- document.getElementById('root'),
9
- <Router>
10
- <App />
11
- </Router>
12
- )