Skip to content

Commit da21944

Browse files
committed
fix build and tests
1 parent 528cdbb commit da21944

File tree

5 files changed

+46
-10
lines changed

5 files changed

+46
-10
lines changed

packages/astro/index.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,44 @@ export default function org({ recmaPlugins, ...options }) {
4141
slug: Array.isArray(data.slug) ? data.slug[0] : data.slug,
4242
}
4343
},
44+
handlePropagation: true,
4445
})
4546

47+
// TODO: add org-components support
48+
// const components = new URL('org-components', config.srcDir)
49+
4650
updateConfig({
4751
vite: {
52+
/** @type {import('vite').Plugin[]} */
4853
plugins: [
4954
{
5055
enforce: 'pre',
5156
...orga({
5257
...options,
5358
jsxImportSource: 'astro',
59+
// providerImportSource: components.pathname,
5460
recmaPlugins: [...(recmaPlugins ?? []), addAstroFragment],
5561
elementAttributeNameCase: 'html',
5662
development: false,
5763
}),
64+
configResolved(resolved) {
65+
// HACK: move ourselves before Astro's JSX plugin to transform things in the right order
66+
const jsxPluginIndex = resolved.plugins.findIndex(
67+
(p) => p.name === 'astro:jsx'
68+
)
69+
if (jsxPluginIndex !== -1) {
70+
const myPluginIndex = resolved.plugins.findIndex(
71+
(p) => p.name === '@orgajs/rollup'
72+
)
73+
if (myPluginIndex !== -1) {
74+
const myPlugin = resolved.plugins[myPluginIndex]
75+
// @ts-ignore-error ignore readonly annotation
76+
resolved.plugins.splice(myPluginIndex, 1)
77+
// @ts-ignore-error ignore readonly annotation
78+
resolved.plugins.splice(jsxPluginIndex, 0, myPlugin)
79+
}
80+
}
81+
},
5882
},
5983
{
6084
name: '@orgajs/org-postprocess',
@@ -64,7 +88,6 @@ export default function org({ recmaPlugins, ...options }) {
6488
*/
6589
transform(code, id) {
6690
if (!id.endsWith('.org')) return
67-
// console.log(code)
6891
return { code, map: null }
6992
},
7093
},

packages/astro/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@types/estree": "^1.0.1",
3939
"@types/estree-jsx": "^1.0.0",
4040
"astro": "^2.10.15",
41-
"unified": "^10.1.2"
41+
"unified": "^10.1.2",
42+
"vite": "^4.4.9"
4243
}
4344
}

packages/editor/lib/editor.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export function makeEditor(config) {
3939
const editor = new EditorView({
4040
state,
4141
parent: target,
42-
contentHeight: '100%',
4342
dispatch: (tr) => {
4443
editor.update([tr])
4544
tr.docChanged && onChange && onChange(editor.state)

packages/loader/tests/loader.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('basic org-mode parsing', async () => {
1111
await new Promise((resolve) => setTimeout(resolve, 3000))
1212
console.log('after the wait')
1313

14-
const output = stats.toJson({ source: true }).modules[0].source
14+
const output = `${stats.toJson({ source: true }).modules[0].source}`
1515
assert.equal(
1616
output.trim(),
1717
`
@@ -25,8 +25,8 @@ function _createOrgContent(props) {
2525
}, props.components);
2626
return _jsxs(_components.div, {
2727
className: "section",
28-
children: [_jsxs(_components.h1, {
29-
children: ["headline one", " "]
28+
children: [_jsx(_components.h1, {
29+
children: "headline one"
3030
}), _jsx(_components.div, {
3131
style: {
3232
color: 'red'

pnpm-lock.yaml

Lines changed: 17 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)