@ascribed/astro 0.1.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/LICENSE +373 -0
- package/README.md +69 -0
- package/dist/attributes.d.ts +35 -0
- package/dist/attributes.js +114 -0
- package/dist/attributes.js.map +1 -0
- package/dist/binary.d.ts +5 -0
- package/dist/binary.js +21 -0
- package/dist/binary.js.map +1 -0
- package/dist/content.d.ts +16 -0
- package/dist/content.js +27 -0
- package/dist/content.js.map +1 -0
- package/dist/dev.d.ts +25 -0
- package/dist/dev.js +135 -0
- package/dist/dev.js.map +1 -0
- package/dist/files.d.ts +7 -0
- package/dist/files.js +71 -0
- package/dist/files.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +137 -0
- package/dist/index.js.map +1 -0
- package/dist/project.d.ts +33 -0
- package/dist/project.js +79 -0
- package/dist/project.js.map +1 -0
- package/dist/rehype.d.ts +3 -0
- package/dist/rehype.js +46 -0
- package/dist/rehype.js.map +1 -0
- package/dist/run.d.ts +17 -0
- package/dist/run.js +30 -0
- package/dist/run.js.map +1 -0
- package/dist/satteri.d.ts +5 -0
- package/dist/satteri.js +33 -0
- package/dist/satteri.js.map +1 -0
- package/package.json +72 -0
- package/src/Elements.astro +14 -0
package/dist/run.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** What a successful build printed. */
|
|
2
|
+
export interface BuildResult {
|
|
3
|
+
/** The checks' report, which is more than a summary line when there are warnings. */
|
|
4
|
+
diagnostics: string;
|
|
5
|
+
/** The `built <build>/site: …` lines. */
|
|
6
|
+
summary: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Builds one build's site output. Rejects, with the compiler's report as the
|
|
10
|
+
* message, if the build has errors: the Astro build fails with them.
|
|
11
|
+
*/
|
|
12
|
+
export declare function runBuild(options: {
|
|
13
|
+
binary: string;
|
|
14
|
+
configPath: string;
|
|
15
|
+
build: string;
|
|
16
|
+
cwd: string;
|
|
17
|
+
}): Promise<BuildResult>;
|
package/dist/run.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Running `ascribe build --emit site` for the configured build.
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
/**
|
|
4
|
+
* Builds one build's site output. Rejects, with the compiler's report as the
|
|
5
|
+
* message, if the build has errors: the Astro build fails with them.
|
|
6
|
+
*/
|
|
7
|
+
export function runBuild(options) {
|
|
8
|
+
const args = [
|
|
9
|
+
"build",
|
|
10
|
+
"--emit",
|
|
11
|
+
"site",
|
|
12
|
+
"--build",
|
|
13
|
+
options.build,
|
|
14
|
+
"--config",
|
|
15
|
+
options.configPath,
|
|
16
|
+
"--color",
|
|
17
|
+
"never",
|
|
18
|
+
];
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
execFile(options.binary, args, { cwd: options.cwd, maxBuffer: 64 * 1024 * 1024 }, (error, stdout, stderr) => {
|
|
21
|
+
if (error !== null) {
|
|
22
|
+
const report = `${stdout}${stderr}`.trim();
|
|
23
|
+
reject(new Error(`\`ascribe build --build ${options.build}\` failed${report === "" ? `: ${error.message}` : `:\n${report}`}`, { cause: error }));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
resolve({ diagnostics: stdout.trim(), summary: stderr.trim() });
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=run.js.map
|
package/dist/run.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAU9C;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,OAKxB;IACC,MAAM,IAAI,GAAG;QACX,OAAO;QACP,QAAQ;QACR,MAAM;QACN,SAAS;QACT,OAAO,CAAC,KAAK;QACb,UAAU;QACV,OAAO,CAAC,UAAU;QAClB,SAAS;QACT,OAAO;KACR,CAAC;IACF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,QAAQ,CACN,OAAO,CAAC,MAAM,EACd,IAAI,EACJ,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,EACjD,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACxB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACnB,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;gBAC3C,MAAM,CACJ,IAAI,KAAK,CACP,2BAA2B,OAAO,CAAC,KAAK,YAAY,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,EAAE,EAC3G,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CACF,CAAC;gBACF,OAAO;YACT,CAAC;YACD,OAAO,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAClE,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/satteri.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// The attribute marker as a Sätteri hast plugin, for Astro 7.3's default
|
|
2
|
+
// markdown processor (`@astrojs/markdown-satteri`).
|
|
3
|
+
//
|
|
4
|
+
// Astro runs that processor's hast plugins in this order: highlighting, the
|
|
5
|
+
// user's plugins, its image marker (which reads an `<img>`'s properties), and
|
|
6
|
+
// its heading ids (which keeps an id a heading already has). A user plugin
|
|
7
|
+
// therefore runs before both, and sees a marker as two `raw` nodes, as the
|
|
8
|
+
// unified processor's plugin does. The rules are `findEdits`'s.
|
|
9
|
+
import { findEdits, toProperty } from "./attributes.js";
|
|
10
|
+
/** Applies the site output's attribute markers (`ascribe-attributes`). */
|
|
11
|
+
export function satteriAscribeAttributes() {
|
|
12
|
+
return {
|
|
13
|
+
name: "ascribe-attributes",
|
|
14
|
+
before(root, ctx) {
|
|
15
|
+
for (const edit of findEdits(root)) {
|
|
16
|
+
const target = edit.target;
|
|
17
|
+
for (const attribute of edit.attributes) {
|
|
18
|
+
const [name, value] = toProperty(attribute);
|
|
19
|
+
ctx.setProperty(target, name, value);
|
|
20
|
+
}
|
|
21
|
+
for (const node of edit.remove)
|
|
22
|
+
ctx.removeNode(node);
|
|
23
|
+
for (const { node, value } of edit.trim) {
|
|
24
|
+
if (value === "")
|
|
25
|
+
ctx.removeNode(node);
|
|
26
|
+
else
|
|
27
|
+
ctx.replaceNode(node, { type: "text", value });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=satteri.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"satteri.js","sourceRoot":"","sources":["../src/satteri.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,oDAAoD;AACpD,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,2EAA2E;AAC3E,gEAAgE;AAGhE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAiB,MAAM,iBAAiB,CAAC;AAEvE,0EAA0E;AAC1E,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,IAAI,EAAE,oBAAoB;QAC1B,MAAM,CAAC,IAAI,EAAE,GAAG;YACd,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,IAAgB,CAAC,EAAE,CAAC;gBAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAgC,CAAC;gBACrD,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;oBACxC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;oBAC5C,GAAG,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;gBACvC,CAAC;gBACD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM;oBAAE,GAAG,CAAC,UAAU,CAAC,IAA8B,CAAC,CAAC;gBAC/E,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBACxC,IAAI,KAAK,KAAK,EAAE;wBAAE,GAAG,CAAC,UAAU,CAAC,IAA8B,CAAC,CAAC;;wBAC5D,GAAG,CAAC,WAAW,CAAC,IAA8B,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;gBAChF,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ascribed/astro",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The Astro integration for Ascribe.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MPL-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/ascribed-dev/ascribe.git",
|
|
10
|
+
"directory": "packages/astro"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/ascribed-dev/ascribe/tree/main/packages/astro#readme",
|
|
13
|
+
"bugs": "https://github.com/ascribed-dev/ascribe/issues",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src/Elements.astro"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./rehype": {
|
|
25
|
+
"types": "./dist/rehype.d.ts",
|
|
26
|
+
"default": "./dist/rehype.js"
|
|
27
|
+
},
|
|
28
|
+
"./satteri": {
|
|
29
|
+
"types": "./dist/satteri.d.ts",
|
|
30
|
+
"default": "./dist/satteri.js"
|
|
31
|
+
},
|
|
32
|
+
"./Elements.astro": "./src/Elements.astro",
|
|
33
|
+
"./content": {
|
|
34
|
+
"types": "./dist/content.d.ts",
|
|
35
|
+
"default": "./dist/content.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=24"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@ascribed/cli": "0.1.0",
|
|
43
|
+
"@ascribed/elements": "0.1.0",
|
|
44
|
+
"property-information": "^7.2.0",
|
|
45
|
+
"smol-toml": "^1.9.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"astro": "^7.3.5"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/hast": "^3.0.4",
|
|
52
|
+
"@types/node": "^24.0.0",
|
|
53
|
+
"astro": "7.3.5",
|
|
54
|
+
"hast-util-from-html": "^2.0.3",
|
|
55
|
+
"rehype-raw": "^7.0.0",
|
|
56
|
+
"rehype-stringify": "^10.0.1",
|
|
57
|
+
"remark-gfm": "^4.0.1",
|
|
58
|
+
"remark-parse": "^11.0.0",
|
|
59
|
+
"remark-rehype": "^11.1.2",
|
|
60
|
+
"remark-smartypants": "^3.0.2",
|
|
61
|
+
"satteri": "0.10.5",
|
|
62
|
+
"unified": "^11.0.5"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "tsc -p tsconfig.build.json",
|
|
69
|
+
"typecheck": "tsc --noEmit",
|
|
70
|
+
"test": "vitest run"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Loads the element library (`@ascribed/elements`) on the pages that render Ascribe
|
|
3
|
+
// content: put `<Elements />` in the layout's <head>. The stylesheet is
|
|
4
|
+
// imported in the frontmatter, so Astro links it in the page that uses this
|
|
5
|
+
// component; the script is bundled once and loaded as a module.
|
|
6
|
+
//
|
|
7
|
+
// (`injectScript("page", …)` is not used: Astro 7.3.5 bundles an injected
|
|
8
|
+
// script but drops the CSS it imports.)
|
|
9
|
+
import "@ascribed/elements/style.css";
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import "@ascribed/elements";
|
|
14
|
+
</script>
|