@emberkit/core 0.3.6 → 0.3.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/signals/helpers/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKzD,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,GACV;IAAE,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,KAAK,MAAM,IAAI,CAAA;CAAE,GAAG,SAAS,CAErE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAC5B,YAAY,EAAE,CAAC,EACf,OAAO,GAAE,aAAa,CAAC,CAAC,CAAM,GAC7B,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAoEjE;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAqB1F;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/signals/helpers/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKzD,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EA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
|
139
139
|
await writeFile(filePath, html, 'utf-8');
|
|
140
140
|
prerendered.set(route.path, filePath);
|
|
141
|
-
console.log(`
|
|
141
|
+
console.log(` \x1b[38;5;51m✦\x1b[0m Prerendered: ${route.path}`);
|
|
142
142
|
}
|
|
143
143
|
catch (error) {
|
|
144
|
-
console.error(`
|
|
144
|
+
console.error(` \x1b[38;5;196m◆\x1b[0m Failed to prerender: ${route.path}`, error);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
return prerendered;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite-plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA8CtE,wBAAgB,kBAAkB,CAAC,WAAW,GAAE,qBAA0B,GAAG,MAAM,CA8IlF;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite-plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA8CtE,wBAAgB,kBAAkB,CAAC,WAAW,GAAE,qBAA0B,GAAG,MAAM,CA8IlF;AAskCD,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -285,11 +285,9 @@ async function transformMDX(code, _id) {
|
|
|
285
285
|
let body = typeof compiled === 'object' && compiled !== null && 'value' in compiled
|
|
286
286
|
? String(compiled.value)
|
|
287
287
|
: String(compiled);
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
body = enhanceMDXCodeBlocks(body);
|
|
289
|
+
body = enhanceMDXHeadings(body);
|
|
290
290
|
body = body.replace(/export default function MDXContent/, 'function _MDXContent');
|
|
291
|
-
// Wrapper re-exports the component with the styling containers.
|
|
292
|
-
// We reuse _jsx/_jsxs already imported by the compiled output.
|
|
293
291
|
const wrapper = `
|
|
294
292
|
export default function MDXComponent(props) {
|
|
295
293
|
var p = props ?? {};
|
|
@@ -304,6 +302,39 @@ export default function MDXComponent(props) {
|
|
|
304
302
|
`;
|
|
305
303
|
return { code: insertAfterLeadingImports(body + wrapper, exportLines.join('\n')) };
|
|
306
304
|
}
|
|
305
|
+
/** Add `id` attributes to headings with simple text children for anchor linking. */
|
|
306
|
+
function enhanceMDXHeadings(jsCode) {
|
|
307
|
+
const headingRe = /_jsx\(_components\.(h[1-6]),\s*\{\s*children:\s*("(?:[^"\\]|\\.)*")\s*\}\)/g;
|
|
308
|
+
return jsCode.replace(headingRe, (_match, tag, textStr) => {
|
|
309
|
+
const text = JSON.parse(textStr);
|
|
310
|
+
const id = text
|
|
311
|
+
.toLowerCase()
|
|
312
|
+
.replace(/[^\w]+/g, '-')
|
|
313
|
+
.replace(/^-|-$/g, '');
|
|
314
|
+
return `_jsx(_components.${tag}, { id: ${JSON.stringify(id)}, children: ${textStr} })`;
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Post-process the compiled MDX JS output to replace plain `<pre><code>`
|
|
319
|
+
* blocks with syntax-highlighted code blocks that include copy buttons
|
|
320
|
+
* and `data-lang` attributes — matching the HTML that the `.md` transform
|
|
321
|
+
* produces via `renderCodeBlock`.
|
|
322
|
+
*/
|
|
323
|
+
function enhanceMDXCodeBlocks(jsCode) {
|
|
324
|
+
const codeBlockRe = /_jsx\(_components\.pre,\s*\{\s*children:\s*_jsx\(_components\.code,\s*\{(?:\s*className:\s*"language-([^"]+)",)?\s*children:\s*("(?:[^"\\]|\\.)*")\s*\}\)\s*\}\)/g;
|
|
325
|
+
return jsCode.replace(codeBlockRe, (_match, lang, codeStr) => {
|
|
326
|
+
const rawCode = JSON.parse(codeStr);
|
|
327
|
+
const language = lang ?? '';
|
|
328
|
+
const fullHtml = renderCodeBlock(language, rawCode);
|
|
329
|
+
const innerHtml = fullHtml.replace(/^<pre[^>]*>/, '').replace(/<\/pre>$/, '');
|
|
330
|
+
const attrs = [];
|
|
331
|
+
if (language) {
|
|
332
|
+
attrs.push(`"data-lang": ${JSON.stringify(language)}`);
|
|
333
|
+
}
|
|
334
|
+
attrs.push(`dangerouslySetInnerHTML: { __html: ${JSON.stringify(innerHtml)} }`);
|
|
335
|
+
return `_jsx("pre", { ${attrs.join(', ')} })`;
|
|
336
|
+
});
|
|
337
|
+
}
|
|
307
338
|
function parseFrontmatter(content) {
|
|
308
339
|
const result = {};
|
|
309
340
|
const lines = content.split('\n');
|
|
@@ -1131,7 +1162,7 @@ const routeToRegex = (routePath) => {
|
|
|
1131
1162
|
paramNames.push(name);
|
|
1132
1163
|
return '([^/]+)';
|
|
1133
1164
|
});
|
|
1134
|
-
return { regex: new RegExp('^' + regexStr + '$'), paramNames };
|
|
1165
|
+
return { regex: new RegExp('^' + regexStr.replace(/\\/$/, '/?') + '$'), paramNames };
|
|
1135
1166
|
};
|
|
1136
1167
|
|
|
1137
1168
|
const renderToString = (element) => {
|