ssqch 0.10.0 → 0.11.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/bundled/completions/bash +62 -16
- package/bundled/completions/elvish +28 -12
- package/bundled/completions/fish +36 -23
- package/bundled/completions/powershell +30 -12
- package/bundled/completions/zsh +40 -19
- package/bundled/docs/agents.md +12 -1
- package/bundled/docs/build-summary.md +31 -1
- package/bundled/docs/comparing-builds.md +37 -5
- package/bundled/docs/configuring.md +30 -5
- package/bundled/docs/field-guide.md +1 -1
- package/bundled/docs/github-pages.md +1 -1
- package/bundled/docs/index.md +1 -1
- package/bundled/docs/known-gaps.md +1 -1
- package/bundled/docs/markdown.md +63 -5
- package/bundled/docs/multilingual.md +20 -3
- package/bundled/docs/nav.yml +1 -0
- package/bundled/docs/netlify.md +2 -2
- package/bundled/docs/plugins.md +4 -4
- package/bundled/docs/seo.md +39 -1
- package/bundled/docs/template-languages.md +6 -4
- package/bundled/docs/templates.md +3 -3
- package/bundled/docs/trailheads/from-eleventy.md +25 -13
- package/bundled/docs/trailheads/from-hugo.md +103 -0
- package/bundled/docs/trailheads/from-jekyll.md +49 -15
- package/bundled/docs/trailheads/from-mkdocs.md +54 -9
- package/bundled/docs/trailheads/from-zola.md +2 -2
- package/bundled/docs/trailheads.md +22 -5
- package/bundled/docs/where-values-come-from.md +1 -1
- package/bundled/mkdocs/404.jinja +6 -0
- package/bundled/ssqch.d.ts +78 -18
- package/lib/assets.js +11 -12
- package/lib/{chunk-3HHRKG33.js → chunk-2L3HR67O.js} +71 -19
- package/lib/{chunk-LCPSKHAV.js → chunk-2QTJTEBV.js} +1 -1
- package/lib/{chunk-RVBNVGZV.js → chunk-3HZZY3Y7.js} +5 -6
- package/lib/{chunk-RKFZSVNF.js → chunk-3K237XAX.js} +10 -11
- package/lib/{chunk-HXCLCXRT.js → chunk-443ZQLVX.js} +5 -3
- package/lib/{chunk-Q4LFTYK2.js → chunk-5ELAUHRL.js} +20 -20
- package/lib/{chunk-SA5KSJ4Y.js → chunk-A75EVUJX.js} +10 -12
- package/lib/{chunk-BGCBSQ4A.js → chunk-AIMEXBTK.js} +163 -29
- package/lib/{chunk-Y2ESFAAD.js → chunk-B5E27PLU.js} +10 -41
- package/lib/{chunk-RJFWTW2Y.js → chunk-CMJ7X5WW.js} +3 -3
- package/lib/{chunk-NKXEPHRZ.js → chunk-ERAIEV3O.js} +106 -4
- package/lib/{chunk-E5UB2YY7.js → chunk-FCM3NYFR.js} +11 -9
- package/lib/{chunk-3EPHKJEG.js → chunk-GJNIQAIH.js} +8 -8
- package/lib/{chunk-CB6YFUXU.js → chunk-GLJQ4C76.js} +40 -21
- package/lib/{chunk-DDV6JEC2.js → chunk-GS5B3CBW.js} +1 -1
- package/lib/chunk-H5K2ZE7B.js +219 -0
- package/lib/{chunk-NFJJKDRI.js → chunk-HFSWUTXX.js} +1 -1
- package/lib/{chunk-4Q6WMTER.js → chunk-HWW5NCVJ.js} +1 -1
- package/lib/{chunk-LAV3DEY4.js → chunk-I3HYKEEW.js} +1 -1
- package/lib/{chunk-JWCCVTTR.js → chunk-IOBC665M.js} +2 -4
- package/lib/chunk-JC54PHIT.js +7992 -0
- package/lib/{chunk-2LEOPLTZ.js → chunk-KCF2Z6N7.js} +3 -5
- package/lib/{chunk-DMVJ53SM.js → chunk-KZZS4W2V.js} +15 -15
- package/lib/{chunk-RM5Q3KFB.js → chunk-LJOURBYT.js} +14 -13
- package/lib/chunk-OQGXZYZS.js +45 -0
- package/lib/chunk-OSBEH67S.js +6296 -0
- package/lib/{chunk-DW7VMJEZ.js → chunk-QJ5ZFTML.js} +14 -13
- package/lib/{chunk-NUUEOGLZ.js → chunk-QLUTNR37.js} +11 -11
- package/lib/{chunk-HGJ5VWUR.js → chunk-RBNPBTDP.js} +1 -1
- package/lib/{chunk-F65YUXZ7.js → chunk-RIAOXEXC.js} +10 -4
- package/lib/chunk-RVXGUMFI.js +21 -0
- package/lib/{chunk-N4O5MDIB.js → chunk-RYIWYWRQ.js} +5 -7
- package/lib/{chunk-EEJDLCD3.js → chunk-RZYAIX2R.js} +12 -11
- package/lib/{chunk-7HXCQEGA.js → chunk-V2FSMOFX.js} +3 -3
- package/lib/{chunk-HDQ4SRWM.js → chunk-X2GAVYV2.js} +525 -75
- package/lib/chunk-XS4EJSEK.js +279 -0
- package/lib/chunk-YCOTX2VM.js +37 -0
- package/lib/{chunk-QMA7CK7B.js → chunk-Z44IAMNG.js} +137 -32
- package/lib/chunk-Z5OP43HU.js +2945 -0
- package/lib/{chunk-JXZT5L7W.js → chunk-ZINLHOX4.js} +2 -3
- package/lib/{chunk-SRNLKWXL.js → chunk-ZR3JYLFB.js} +893 -12382
- package/lib/cli.js +82 -41
- package/lib/elements.js +11 -12
- package/lib/image.js +11 -11
- package/lib/links.js +11 -12
- package/lib/minify.js +71 -13
- package/lib/redirects.js +11 -12
- package/lib/rss.js +13 -11
- package/lib/sass.js +13 -245
- package/lib/sitemap.js +19 -18
- package/lib/ssqch.js +6 -5
- package/package.json +1 -1
- package/types/index.d.ts +59 -13
- package/types/minify.d.ts +15 -3
- package/types/sass.d.ts +2 -0
- package/types/sitemap.d.ts +2 -2
- package/wasm/markdown.wasm +0 -0
- package/wasm/minify.wasm +0 -0
- package/wasm/sass.wasm +0 -0
- package/lib/chunk-5DNDSNTP.js +0 -1541
- package/lib/chunk-VJWQSYEG.js +0 -119
- package/lib/chunk-ZM6TU2JB.js +0 -1287
- /package/lib/{chunk-BGCBSQ4A.js.LEGAL.txt → chunk-AIMEXBTK.js.LEGAL.txt} +0 -0
- /package/lib/{chunk-SRNLKWXL.js.LEGAL.txt → chunk-ZR3JYLFB.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { createRequire as __ssqchCreateRequire } from "node:module";
|
|
2
|
+
const require = __ssqchCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
startReading
|
|
5
|
+
} from "./chunk-3NYSSA2C.js";
|
|
6
|
+
import {
|
|
7
|
+
Options
|
|
8
|
+
} from "./chunk-RBNPBTDP.js";
|
|
9
|
+
import {
|
|
10
|
+
BUILTINS,
|
|
11
|
+
cssWithBase,
|
|
12
|
+
debugString,
|
|
13
|
+
wasi
|
|
14
|
+
} from "./chunk-Z44IAMNG.js";
|
|
15
|
+
import {
|
|
16
|
+
WebAssembly
|
|
17
|
+
} from "./chunk-JC54PHIT.js";
|
|
18
|
+
import {
|
|
19
|
+
BuildError,
|
|
20
|
+
bail,
|
|
21
|
+
comparePaths,
|
|
22
|
+
displayPath,
|
|
23
|
+
isInside,
|
|
24
|
+
messageOf,
|
|
25
|
+
realPath,
|
|
26
|
+
slashes
|
|
27
|
+
} from "./chunk-AIMEXBTK.js";
|
|
28
|
+
|
|
29
|
+
// src/modules/sass.ts
|
|
30
|
+
import fs from "node:fs";
|
|
31
|
+
import path from "node:path";
|
|
32
|
+
import { fileURLToPath } from "node:url";
|
|
33
|
+
function sassPlugin(options = {}) {
|
|
34
|
+
return { name: "ssqch/sass", builtin: "ssqch/sass", options };
|
|
35
|
+
}
|
|
36
|
+
var isSass = (file) => file.endsWith(".scss") || file.endsWith(".sass");
|
|
37
|
+
function entries(root, from, to) {
|
|
38
|
+
const src = path.resolve(root, from);
|
|
39
|
+
const stat = fs.statSync(src, { throwIfNoEntry: false });
|
|
40
|
+
if (stat?.isFile()) {
|
|
41
|
+
if (!isSass(src)) bail(`files: ${from} isn't a .scss or .sass file`);
|
|
42
|
+
return [[src, to.endsWith("/") ? `${to}${path.basename(src).replace(/\.s[ac]ss$/, "")}.css` : to]];
|
|
43
|
+
}
|
|
44
|
+
if (!stat?.isDirectory()) bail(`files: ${from} doesn't exist`);
|
|
45
|
+
const out = [];
|
|
46
|
+
const walk = (dir) => {
|
|
47
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
48
|
+
const file = path.join(dir, entry.name);
|
|
49
|
+
if (entry.isDirectory()) walk(file);
|
|
50
|
+
else if (entry.isFile() && isSass(entry.name) && !entry.name.startsWith("_")) {
|
|
51
|
+
out.push([file, `${to.replace(/\/+$/, "")}/${slashes(path.relative(src, file)).replace(/\.s[ac]ss$/, "")}.css`]);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
walk(src);
|
|
56
|
+
return out.sort((a, b) => comparePaths(a[0], b[0]) || (a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0));
|
|
57
|
+
}
|
|
58
|
+
BUILTINS.set("ssqch/sass", (config, given) => {
|
|
59
|
+
const o = new Options(given, ["files", "style", "loadPaths", "charset"]);
|
|
60
|
+
const files = [];
|
|
61
|
+
const map = o.get("files");
|
|
62
|
+
if (map !== void 0) {
|
|
63
|
+
if (typeof map !== "object" || Array.isArray(map)) bail('files must be an object of { source: "/output" }');
|
|
64
|
+
for (const [from, to] of Object.entries(map)) {
|
|
65
|
+
if (typeof to !== "string") bail(`files.${from}: the output must be a URL path string`);
|
|
66
|
+
files.push([from, to]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const style = o.string("style");
|
|
70
|
+
if (style !== void 0 && style !== "compressed" && style !== "expanded") bail(`style must be "compressed" or "expanded", not ${debugString(style)}`);
|
|
71
|
+
const loadPaths = o.list("loadPaths") ?? [];
|
|
72
|
+
const charset = o.bool("charset") ?? true;
|
|
73
|
+
if (!files.length) bail('files is required: { "src/scss": "/css" } or { "src/app.scss": "/app.css" }');
|
|
74
|
+
for (const [from, to] of files) {
|
|
75
|
+
if (!to.startsWith("/") || to.includes("..")) bail(`files: ${debugString(to)} must be a URL path starting with / (like "/css/app.css" or "/css")`);
|
|
76
|
+
if (from === "") bail("files: a source path can't be empty");
|
|
77
|
+
}
|
|
78
|
+
for (const [from] of files) {
|
|
79
|
+
config.watch.push(from);
|
|
80
|
+
const slash = Math.max(from.lastIndexOf("/"), from.lastIndexOf(path.sep));
|
|
81
|
+
const dir = slash < 0 ? "" : slash === 0 ? from.slice(0, 1) : from.slice(0, slash);
|
|
82
|
+
if (isSass(from) && dir !== "") config.watch.push(dir);
|
|
83
|
+
}
|
|
84
|
+
for (const dir of loadPaths) config.watch.push(dir);
|
|
85
|
+
let count;
|
|
86
|
+
config.fileBuilders.push(["ssqch/sass", (config2) => {
|
|
87
|
+
const chosen = style ?? (config2.env === "production" && !config2.serving ? "compressed" : "expanded");
|
|
88
|
+
const used = startReading(config2, "ssqch/sass");
|
|
89
|
+
const compiler = new Compiler(config2.root, used, loadPaths.map((dir) => path.resolve(config2.root, dir)));
|
|
90
|
+
const options = JSON.stringify({ style: chosen, loadPaths: loadPaths.map((dir) => compiler.name(path.resolve(config2.root, dir))) });
|
|
91
|
+
const out = [];
|
|
92
|
+
for (const [from, to] of files) {
|
|
93
|
+
for (const [src, url] of entries(config2.root, from, to)) {
|
|
94
|
+
const shown = displayPath(config2.root, src);
|
|
95
|
+
const compiled2 = compiler.compile(src, options, shown);
|
|
96
|
+
const css = charset ? compiled2 : compiled2.replace(/^\uFEFF|^@charset "UTF-8";\n?/, "");
|
|
97
|
+
out.push({ path: url, contents: cssWithBase(config2.base, css) });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
count = [out.length, chosen];
|
|
101
|
+
return out;
|
|
102
|
+
}]);
|
|
103
|
+
config.summaries.push(["Sass", () => count === void 0 ? void 0 : `${count[0]} file${count[0] === 1 ? "" : "s"} (${count[1]})`]);
|
|
104
|
+
});
|
|
105
|
+
var compressedCss = /* @__PURE__ */ new Map();
|
|
106
|
+
var KEPT_CSS = 256;
|
|
107
|
+
function compressCss(css, shown = "CSS") {
|
|
108
|
+
const kept = compressedCss.get(css);
|
|
109
|
+
if (kept !== void 0) return kept;
|
|
110
|
+
const name = "ssqch:inline.css";
|
|
111
|
+
const compiler = new Compiler(process.cwd(), /* @__PURE__ */ new Set());
|
|
112
|
+
compiler.inline.set(name, css);
|
|
113
|
+
let out;
|
|
114
|
+
try {
|
|
115
|
+
out = compiler.compile(name, JSON.stringify({ style: "compressed", loadPaths: [] }), shown);
|
|
116
|
+
} catch (e) {
|
|
117
|
+
throw new BuildError(messageOf(e).replace(`compiling ${shown}: ${shown}: `, `${shown}: `).replaceAll(name, shown));
|
|
118
|
+
}
|
|
119
|
+
if (compressedCss.size >= KEPT_CSS) compressedCss.delete(compressedCss.keys().next().value);
|
|
120
|
+
compressedCss.set(css, out);
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
var WASM_FILE = fileURLToPath(new URL("../../wasm/sass.wasm", new URL("../src/modules/sass.ts", import.meta.url).href));
|
|
124
|
+
var compiled;
|
|
125
|
+
var current;
|
|
126
|
+
var active;
|
|
127
|
+
var Compiler = class {
|
|
128
|
+
root;
|
|
129
|
+
used;
|
|
130
|
+
loadPaths;
|
|
131
|
+
/** A stylesheet that's no file, by the name grass is given for it (`minifyCss`'s text). */
|
|
132
|
+
inline = /* @__PURE__ */ new Map();
|
|
133
|
+
constructor(root, used, loadPaths = []) {
|
|
134
|
+
this.root = root;
|
|
135
|
+
this.used = used;
|
|
136
|
+
this.loadPaths = loadPaths;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* A stylesheet as grass should read it. Two things other compilers take that grass doesn't:
|
|
140
|
+
*
|
|
141
|
+
* - Front matter (Jekyll's `---` lines at the top of a site's main stylesheet) becomes blank
|
|
142
|
+
* lines, so error lines still match the file. Sass can't start with `---`, so nothing that
|
|
143
|
+
* compiled before reads differently.
|
|
144
|
+
* - An `@import`, `@use` or `@forward` that names its extension (`"primer-core/index.scss"`)
|
|
145
|
+
* is found in the load paths too: grass 0.13 looks for one only beside the importing file
|
|
146
|
+
* (`find_import`, "todo: consider load paths"), and Dart Sass and Ruby Sass look in both.
|
|
147
|
+
* Where the file isn't beside the importer but is in a load path, the import names it from
|
|
148
|
+
* the importer's folder. primer's packages all import this way (opensource.guide, osg #10).
|
|
149
|
+
*/
|
|
150
|
+
source(file, data) {
|
|
151
|
+
if (!isSass(file)) return data;
|
|
152
|
+
let text = data.toString("utf8");
|
|
153
|
+
const front = /^---[ \t]*\r?\n(?:[\s\S]*?\r?\n)?---[ \t]*(?:\r?\n|$)/.exec(text);
|
|
154
|
+
if (front) text = front[0].replace(/[^\n]/g, "") + text.slice(front[0].length);
|
|
155
|
+
const dir = path.dirname(file);
|
|
156
|
+
const exists = (base, name) => {
|
|
157
|
+
const full = path.resolve(base, name);
|
|
158
|
+
const partial = path.join(path.dirname(full), `_${path.basename(full)}`);
|
|
159
|
+
return fs.existsSync(full) ? full : fs.existsSync(partial) ? partial : void 0;
|
|
160
|
+
};
|
|
161
|
+
const dotted = (name) => {
|
|
162
|
+
if (!/\.[^/.]+$/.test(name) || /\.(?:s[ac]ss|css)$/.test(name) || /^[a-z]+:/i.test(name)) return name;
|
|
163
|
+
for (const base of [dir, ...this.loadPaths]) {
|
|
164
|
+
for (const ext of [".scss", ".sass"]) if (exists(base, `${name}${ext}`)) return `${name}${ext}`;
|
|
165
|
+
}
|
|
166
|
+
return name;
|
|
167
|
+
};
|
|
168
|
+
const changed = text.replace(/@(import|use|forward)(\s+)([^;{}]+)/g, (statement, rule, space, rest) => `@${rule}${space}${rest.replace(/(["'])([^"'\n]+)\1/g, (quoted, q, name) => `${q}${dotted(name)}${q}`).replace(/(["'])([^"'\n]+\.s[ac]ss)\1/g, (quoted, q, name) => {
|
|
169
|
+
if (path.isAbsolute(name) || /^[a-z]+:/i.test(name) || exists(dir, name)) return quoted;
|
|
170
|
+
for (const load of this.loadPaths) {
|
|
171
|
+
const found = exists(load, name);
|
|
172
|
+
if (found) return `${q}${slashes(path.relative(dir, path.join(path.dirname(found), path.basename(name))))}${q}`;
|
|
173
|
+
}
|
|
174
|
+
return quoted;
|
|
175
|
+
})}`);
|
|
176
|
+
return front || changed !== text ? Buffer.from(changed, "utf8") : data;
|
|
177
|
+
}
|
|
178
|
+
/** A path as grass sees it: from the root for the site's own files, else whole; with `/`. */
|
|
179
|
+
name(file) {
|
|
180
|
+
return isInside(this.root, file) && file !== this.root ? slashes(path.relative(this.root, file)) : slashes(file);
|
|
181
|
+
}
|
|
182
|
+
/** A path grass gave back, as a real one. */
|
|
183
|
+
file(name) {
|
|
184
|
+
return path.resolve(this.root, name);
|
|
185
|
+
}
|
|
186
|
+
compile(src, options, shown) {
|
|
187
|
+
const x = instance();
|
|
188
|
+
const parts = [this.name(src), options];
|
|
189
|
+
const lens = parts.map((p) => Buffer.byteLength(p, "utf8"));
|
|
190
|
+
const ptr = x.sass_alloc(lens[0] + lens[1]);
|
|
191
|
+
const bytes = Buffer.from(x.memory.buffer);
|
|
192
|
+
bytes.write(parts[0], ptr, lens[0], "utf8");
|
|
193
|
+
bytes.write(parts[1], ptr + lens[0], lens[1], "utf8");
|
|
194
|
+
active = this;
|
|
195
|
+
let status;
|
|
196
|
+
try {
|
|
197
|
+
status = x.sass_compile(ptr, lens[0], lens[1]);
|
|
198
|
+
} catch (e) {
|
|
199
|
+
current = void 0;
|
|
200
|
+
let message = messageOf(e);
|
|
201
|
+
if (e instanceof WebAssembly.RuntimeError) {
|
|
202
|
+
try {
|
|
203
|
+
x.sass_panic();
|
|
204
|
+
message = resultOf(x) || message;
|
|
205
|
+
} catch {
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
throw new BuildError(`compiling ${shown}: ssqch's Sass crashed (${message.replace(/\s*\n\s*/g, " ")})`);
|
|
209
|
+
} finally {
|
|
210
|
+
active = void 0;
|
|
211
|
+
}
|
|
212
|
+
const text = resultOf(x);
|
|
213
|
+
if (status !== 0) throw new BuildError(`compiling ${shown}: ${shown}: ${text}`);
|
|
214
|
+
return text;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
function resultOf(x) {
|
|
218
|
+
const ptr = x.sass_result_ptr();
|
|
219
|
+
return Buffer.from(x.memory.buffer).toString("utf8", ptr, ptr + x.sass_result_len());
|
|
220
|
+
}
|
|
221
|
+
function instance() {
|
|
222
|
+
if (current) return current;
|
|
223
|
+
if (!compiled) {
|
|
224
|
+
let bytes;
|
|
225
|
+
try {
|
|
226
|
+
bytes = fs.readFileSync(WASM_FILE);
|
|
227
|
+
} catch (e) {
|
|
228
|
+
throw new BuildError(`ssqch's Sass isn't there (${WASM_FILE}: ${messageOf(e)}); build it with node packages/ssqch/scripts/build-wasm.ts sass`);
|
|
229
|
+
}
|
|
230
|
+
compiled = new WebAssembly.Module(bytes);
|
|
231
|
+
}
|
|
232
|
+
let x;
|
|
233
|
+
const memory = () => x.memory;
|
|
234
|
+
const text = (ptr, len) => Buffer.from(x.memory.buffer).toString("utf8", ptr, ptr + len);
|
|
235
|
+
const reply = (out, status, answer) => {
|
|
236
|
+
const data = typeof answer === "string" ? Buffer.from(answer, "utf8") : answer;
|
|
237
|
+
const ptr = x.sass_alloc(data.length);
|
|
238
|
+
const bytes = Buffer.from(x.memory.buffer);
|
|
239
|
+
bytes.set(data, ptr);
|
|
240
|
+
bytes.writeUInt32LE(ptr, out);
|
|
241
|
+
bytes.writeUInt32LE(data.length, out + 4);
|
|
242
|
+
return status;
|
|
243
|
+
};
|
|
244
|
+
const stat = (ptr, len) => fs.statSync(active.file(text(ptr, len)), { throwIfNoEntry: false });
|
|
245
|
+
const inline = (ptr, len) => active.inline.get(text(ptr, len));
|
|
246
|
+
const host = {
|
|
247
|
+
is_file: (ptr, len) => inline(ptr, len) !== void 0 || stat(ptr, len)?.isFile() ? 1 : 0,
|
|
248
|
+
is_dir: (ptr, len) => inline(ptr, len) === void 0 && stat(ptr, len)?.isDirectory() ? 1 : 0,
|
|
249
|
+
read: (ptr, len, out) => {
|
|
250
|
+
const given = inline(ptr, len);
|
|
251
|
+
if (given !== void 0) return reply(out, 0, given);
|
|
252
|
+
const file = active.file(text(ptr, len));
|
|
253
|
+
try {
|
|
254
|
+
const data = active.source(file, fs.readFileSync(file));
|
|
255
|
+
active.used.add(realPath(file));
|
|
256
|
+
return reply(out, 0, data);
|
|
257
|
+
} catch (e) {
|
|
258
|
+
return reply(out, 1, messageOf(e));
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
// The same file under two names is one module (grass uses it to load each once).
|
|
262
|
+
canonicalize: (ptr, len, out) => {
|
|
263
|
+
if (inline(ptr, len) !== void 0) return reply(out, 0, text(ptr, len));
|
|
264
|
+
try {
|
|
265
|
+
return reply(out, 0, active.name(fs.realpathSync.native(active.file(text(ptr, len)))));
|
|
266
|
+
} catch (e) {
|
|
267
|
+
return reply(out, 1, messageOf(e));
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
x = new WebAssembly.Instance(compiled, { wasi_snapshot_preview1: wasi(memory), ssqch: host }).exports;
|
|
272
|
+
x._initialize();
|
|
273
|
+
return current = x;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export {
|
|
277
|
+
sassPlugin,
|
|
278
|
+
compressCss
|
|
279
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createRequire as __ssqchCreateRequire } from "node:module";
|
|
2
|
+
const require = __ssqchCreateRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// src/bundled.ts
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
var PACKAGE = path.dirname(path.dirname(fileURLToPath(new URL("../src/bundled.ts", import.meta.url).href)));
|
|
9
|
+
var BUNDLED = path.join(PACKAGE, "bundled");
|
|
10
|
+
var FROM_REPOSITORY = [
|
|
11
|
+
["docs", "site/src/docs"]
|
|
12
|
+
];
|
|
13
|
+
function bundledPath(rel) {
|
|
14
|
+
const inPackage = path.join(BUNDLED, rel);
|
|
15
|
+
if (fs.existsSync(inPackage)) return inPackage;
|
|
16
|
+
for (const [prefix, original] of FROM_REPOSITORY) {
|
|
17
|
+
if (rel === prefix || rel.startsWith(`${prefix}/`)) return path.join(PACKAGE, "../..", original + rel.slice(prefix.length));
|
|
18
|
+
}
|
|
19
|
+
return inPackage;
|
|
20
|
+
}
|
|
21
|
+
var cache = /* @__PURE__ */ new Map();
|
|
22
|
+
function bundled(rel) {
|
|
23
|
+
let text = cache.get(rel);
|
|
24
|
+
if (text === void 0) cache.set(rel, text = fs.readFileSync(bundledPath(rel), "utf8"));
|
|
25
|
+
return text;
|
|
26
|
+
}
|
|
27
|
+
function bundledNames(rel) {
|
|
28
|
+
return fs.readdirSync(bundledPath(rel)).sort();
|
|
29
|
+
}
|
|
30
|
+
var types = () => bundled("ssqch.d.ts");
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
bundledPath,
|
|
34
|
+
bundled,
|
|
35
|
+
bundledNames,
|
|
36
|
+
types
|
|
37
|
+
};
|