astro 0.20.12 → 0.21.0-next.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/CHANGELOG.md +24 -0
- package/astro.js +5 -4
- package/components/Code.astro +6 -6
- package/components/Debug.astro +25 -277
- package/components/Markdown.astro +18 -11
- package/dist/@types/{astro.js → astro-core.js} +0 -0
- package/dist/@types/{compiler.js → astro-runtime.js} +0 -0
- package/dist/{check.js → cli/check.js} +1 -1
- package/dist/cli/index.js +166 -0
- package/dist/core/build/index.js +186 -0
- package/dist/core/build/stats.js +93 -0
- package/dist/core/config.js +66 -0
- package/dist/core/create-vite.js +73 -0
- package/dist/core/dev/index.js +257 -0
- package/dist/core/dev/messages.js +35 -0
- package/dist/core/dev/template/error.js +48 -0
- package/dist/core/dev/util.js +11 -0
- package/dist/core/logger.js +141 -0
- package/dist/core/preview/index.js +47 -0
- package/dist/core/ssr/css.js +34 -0
- package/dist/core/ssr/html.js +78 -0
- package/dist/core/ssr/index.js +173 -0
- package/dist/{build → core/ssr}/paginate.js +1 -1
- package/dist/core/ssr/routing.js +251 -0
- package/dist/{build → core/ssr}/rss.js +15 -13
- package/dist/core/ssr/sitemap.js +15 -0
- package/dist/core/util.js +69 -0
- package/dist/core/vite.js +6 -0
- package/dist/runtime/client/hmr.js +27 -0
- package/dist/{frontend/hydrate → runtime/client}/idle.js +1 -1
- package/dist/{frontend/hydrate → runtime/client}/load.js +1 -1
- package/dist/{frontend/hydrate → runtime/client}/media.js +1 -1
- package/dist/{frontend/hydrate → runtime/client}/only.js +1 -1
- package/dist/{frontend/hydrate → runtime/client}/visible.js +1 -1
- package/dist/runtime/server/index.js +356 -0
- package/dist/runtime/server/metadata.js +52 -0
- package/dist/types/@types/astro-core.d.ts +310 -0
- package/dist/types/@types/astro-runtime.d.ts +52 -0
- package/dist/types/{check.d.ts → cli/check.d.ts} +1 -1
- package/dist/types/{cli.d.ts → cli/index.d.ts} +0 -0
- package/dist/types/core/build/index.d.ts +8 -0
- package/dist/types/core/build/stats.d.ts +31 -0
- package/dist/types/{config.d.ts → core/config.d.ts} +27 -22
- package/dist/types/core/create-vite.d.ts +18 -0
- package/dist/types/core/dev/index.d.ts +43 -0
- package/dist/types/core/dev/messages.d.ts +26 -0
- package/dist/types/core/dev/template/error.d.ts +9 -0
- package/dist/types/core/dev/util.d.ts +2 -0
- package/dist/types/{logger.d.ts → core/logger.d.ts} +3 -0
- package/dist/types/core/preview/index.d.ts +16 -0
- package/dist/types/core/ssr/css.d.ts +5 -0
- package/dist/types/core/ssr/html.d.ts +3 -0
- package/dist/types/core/ssr/index.d.ts +26 -0
- package/dist/types/{build → core/ssr}/paginate.d.ts +1 -1
- package/dist/types/core/ssr/routing.d.ts +19 -0
- package/dist/types/{build → core/ssr}/rss.d.ts +6 -5
- package/dist/types/core/ssr/sitemap.d.ts +2 -0
- package/dist/types/core/util.d.ts +13 -0
- package/dist/types/core/vite.d.ts +2 -0
- package/dist/types/{frontend/__astro_config.d.ts → runtime/client/hmr.d.ts} +0 -0
- package/dist/types/{frontend/hydrate → runtime/client}/idle.d.ts +1 -1
- package/dist/types/{frontend/hydrate → runtime/client}/load.d.ts +1 -1
- package/dist/types/{frontend/hydrate → runtime/client}/media.d.ts +1 -1
- package/dist/types/{frontend/hydrate → runtime/client}/only.d.ts +1 -1
- package/dist/types/{frontend/hydrate → runtime/client}/visible.d.ts +1 -1
- package/dist/types/runtime/server/index.d.ts +26 -0
- package/dist/types/runtime/server/metadata.d.ts +21 -0
- package/dist/types/vite-plugin-astro/index.d.ts +10 -0
- package/dist/types/vite-plugin-astro/styles.d.ts +14 -0
- package/dist/types/vite-plugin-astro-postprocess/index.d.ts +9 -0
- package/dist/types/vite-plugin-fetch/index.d.ts +2 -0
- package/dist/types/vite-plugin-jsx/index.d.ts +10 -0
- package/dist/types/vite-plugin-markdown/index.d.ts +10 -0
- package/dist/vite-plugin-astro/index.js +86 -0
- package/dist/vite-plugin-astro/styles.js +21 -0
- package/dist/vite-plugin-astro-postprocess/index.js +54 -0
- package/dist/vite-plugin-fetch/index.js +52 -0
- package/dist/vite-plugin-jsx/index.js +161 -0
- package/dist/vite-plugin-markdown/index.js +73 -0
- package/package.json +62 -68
- package/vendor/vite/LICENSE.md +2150 -0
- package/vendor/vite/client.d.ts +204 -0
- package/vendor/vite/dist/client/client.mjs +553 -0
- package/vendor/vite/dist/client/client.mjs.map +1 -0
- package/vendor/vite/dist/client/env.mjs +30 -0
- package/vendor/vite/dist/client/env.mjs.map +1 -0
- package/vendor/vite/dist/node/chunks/dep-34d2edc0.js +29182 -0
- package/vendor/vite/dist/node/chunks/dep-34d2edc0.js.map +1 -0
- package/vendor/vite/dist/node/chunks/dep-35df7f96.js +92083 -0
- package/vendor/vite/dist/node/chunks/dep-35df7f96.js.map +1 -0
- package/vendor/vite/dist/node/chunks/dep-a5b4350d.js +8734 -0
- package/vendor/vite/dist/node/chunks/dep-a5b4350d.js.map +1 -0
- package/vendor/vite/dist/node/chunks/dep-ac1b4bf9.js +531 -0
- package/vendor/vite/dist/node/chunks/dep-ac1b4bf9.js.map +1 -0
- package/vendor/vite/dist/node/chunks/dep-dab866a6.js +11404 -0
- package/vendor/vite/dist/node/chunks/dep-dab866a6.js.map +1 -0
- package/vendor/vite/dist/node/chunks/dep-e39b05d6.js +746 -0
- package/vendor/vite/dist/node/chunks/dep-e39b05d6.js.map +1 -0
- package/vendor/vite/dist/node/cli.js +803 -0
- package/vendor/vite/dist/node/cli.js.map +1 -0
- package/vendor/vite/dist/node/index.d.ts +2580 -0
- package/vendor/vite/dist/node/index.js +52 -0
- package/vendor/vite/dist/node/index.js.map +1 -0
- package/vendor/vite/dist/node/terser.js +31356 -0
- package/vendor/vite/package.json +139 -0
- package/vendor/vite/types/alias.d.ts +59 -0
- package/vendor/vite/types/anymatch.d.ts +5 -0
- package/vendor/vite/types/chokidar.d.ts +218 -0
- package/vendor/vite/types/commonjs.d.ts +162 -0
- package/vendor/vite/types/connect.d.ts +111 -0
- package/vendor/vite/types/customEvent.d.ts +5 -0
- package/vendor/vite/types/dynamicImportVars.d.ts +17 -0
- package/vendor/vite/types/hmrPayload.d.ts +57 -0
- package/vendor/vite/types/http-proxy.d.ts +242 -0
- package/vendor/vite/types/importMeta.d.ts +69 -0
- package/vendor/vite/types/package.json +3 -0
- package/vendor/vite/types/shims.d.ts +110 -0
- package/vendor/vite/types/terser.d.ts +209 -0
- package/vendor/vite/types/ws.d.ts +532 -0
- package/dist/@types/config.js +0 -1
- package/dist/@types/estree-walker.d.js +0 -1
- package/dist/@types/hydrate.js +0 -1
- package/dist/@types/micromark-extension-gfm.d.js +0 -1
- package/dist/@types/micromark.js +0 -1
- package/dist/@types/postcss-icss-keyframes.d.js +0 -1
- package/dist/@types/public.js +0 -6
- package/dist/@types/resolve.d.js +0 -1
- package/dist/@types/tailwind.d.js +0 -1
- package/dist/@types/transformer.js +0 -1
- package/dist/ast.js +0 -26
- package/dist/build/bundle/css.js +0 -108
- package/dist/build/bundle/js.js +0 -198
- package/dist/build/page.js +0 -61
- package/dist/build/sitemap.js +0 -24
- package/dist/build/stats.js +0 -72
- package/dist/build/util.js +0 -64
- package/dist/build.js +0 -283
- package/dist/cli.js +0 -146
- package/dist/compiler/codegen/index.js +0 -796
- package/dist/compiler/codegen/interfaces.js +0 -1
- package/dist/compiler/codegen/utils.js +0 -28
- package/dist/compiler/index.js +0 -226
- package/dist/compiler/transform/doctype.js +0 -34
- package/dist/compiler/transform/head.js +0 -264
- package/dist/compiler/transform/index.js +0 -74
- package/dist/compiler/transform/module-scripts.js +0 -44
- package/dist/compiler/transform/postcss-scoped-styles/index.js +0 -106
- package/dist/compiler/transform/prism.js +0 -132
- package/dist/compiler/transform/styles.js +0 -235
- package/dist/compiler/transform/util/end-of-head.js +0 -84
- package/dist/compiler/utils.js +0 -66
- package/dist/config.js +0 -64
- package/dist/config_manager.js +0 -129
- package/dist/dev.js +0 -99
- package/dist/external.js +0 -20
- package/dist/frontend/500.astro +0 -128
- package/dist/frontend/__astro_config.js +0 -2
- package/dist/internal/__astro_component.js +0 -205
- package/dist/internal/__astro_hoisted_scripts.js +0 -19
- package/dist/internal/__astro_slot.js +0 -19
- package/dist/internal/element-registry.js +0 -55
- package/dist/internal/fetch-content.js +0 -35
- package/dist/internal/h.js +0 -57
- package/dist/internal/renderer-html.js +0 -11
- package/dist/logger.js +0 -121
- package/dist/manifest/create.js +0 -202
- package/dist/node_builtins.js +0 -8
- package/dist/preview.js +0 -33
- package/dist/reload.js +0 -19
- package/dist/runtime.js +0 -337
- package/dist/snowpack-logger.js +0 -12
- package/dist/types/@types/astro.d.ts +0 -169
- package/dist/types/@types/compiler.d.ts +0 -9
- package/dist/types/@types/config.d.ts +0 -84
- package/dist/types/@types/hydrate.d.ts +0 -4
- package/dist/types/@types/micromark.d.ts +0 -12
- package/dist/types/@types/public.d.ts +0 -1
- package/dist/types/@types/transformer.d.ts +0 -23
- package/dist/types/ast.d.ts +0 -7
- package/dist/types/build/bundle/css.d.ts +0 -22
- package/dist/types/build/bundle/js.d.ts +0 -21
- package/dist/types/build/page.d.ts +0 -25
- package/dist/types/build/sitemap.d.ts +0 -3
- package/dist/types/build/stats.d.ts +0 -23
- package/dist/types/build/util.d.ts +0 -21
- package/dist/types/build.d.ts +0 -10
- package/dist/types/compiler/codegen/index.d.ts +0 -18
- package/dist/types/compiler/codegen/interfaces.d.ts +0 -9
- package/dist/types/compiler/codegen/utils.d.ts +0 -9
- package/dist/types/compiler/index.d.ts +0 -32
- package/dist/types/compiler/transform/doctype.d.ts +0 -6
- package/dist/types/compiler/transform/head.d.ts +0 -3
- package/dist/types/compiler/transform/index.d.ts +0 -9
- package/dist/types/compiler/transform/module-scripts.d.ts +0 -8
- package/dist/types/compiler/transform/postcss-scoped-styles/index.d.ts +0 -16
- package/dist/types/compiler/transform/prism.d.ts +0 -5
- package/dist/types/compiler/transform/styles.d.ts +0 -24
- package/dist/types/compiler/transform/util/end-of-head.d.ts +0 -19
- package/dist/types/compiler/utils.d.ts +0 -22
- package/dist/types/config_manager.d.ts +0 -43
- package/dist/types/dev.d.ts +0 -3
- package/dist/types/external.d.ts +0 -2
- package/dist/types/internal/__astro_component.d.ts +0 -11
- package/dist/types/internal/__astro_hoisted_scripts.d.ts +0 -12
- package/dist/types/internal/__astro_slot.d.ts +0 -10
- package/dist/types/internal/element-registry.d.ts +0 -14
- package/dist/types/internal/fetch-content.d.ts +0 -6
- package/dist/types/internal/h.d.ts +0 -8
- package/dist/types/internal/renderer-html.d.ts +0 -4
- package/dist/types/manifest/create.d.ts +0 -5
- package/dist/types/node_builtins.d.ts +0 -2
- package/dist/types/preview.d.ts +0 -5
- package/dist/types/reload.d.ts +0 -1
- package/dist/types/runtime.d.ts +0 -64
- package/dist/types/snowpack-logger.d.ts +0 -2
- package/dist/types/util.d.ts +0 -15
- package/dist/util.js +0 -49
- package/snowpack-plugin-jsx.cjs +0 -190
- package/snowpack-plugin.cjs +0 -69
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# astro
|
|
2
2
|
|
|
3
|
+
## 0.21.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d84bfe71: Astro 0.21 Beta release! This introduces the new version of Astro that includes:
|
|
8
|
+
|
|
9
|
+
- A new, faster, Go-based compiler
|
|
10
|
+
- A runtime backed by Vite, with faster dev experience
|
|
11
|
+
- New features
|
|
12
|
+
|
|
13
|
+
See more at https://astro.build/blog/astro-021-preview/
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [d84bfe71]
|
|
18
|
+
- Updated dependencies [d84bfe71]
|
|
19
|
+
- Updated dependencies [d84bfe71]
|
|
20
|
+
- @astrojs/prism@0.3.0-next.0
|
|
21
|
+
- @astrojs/markdown-remark@0.4.0-next.0
|
|
22
|
+
- @astrojs/renderer-preact@0.3.0-next.0
|
|
23
|
+
- @astrojs/renderer-react@0.3.0-next.0
|
|
24
|
+
- @astrojs/renderer-svelte@0.2.0-next.0
|
|
25
|
+
- @astrojs/renderer-vue@0.2.0-next.0
|
|
26
|
+
|
|
3
27
|
## 0.20.12
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/astro.js
CHANGED
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
// Assume ESM to start, and then call `require()` below once CJS is confirmed.
|
|
8
8
|
// Needed for Stackblitz: https://github.com/stackblitz/webcontainer-core/issues/281
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const CI_INSTRUCTIONS = {
|
|
11
11
|
NETLIFY: 'https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript',
|
|
12
12
|
GITHUB_ACTIONS: 'https://docs.github.com/en/actions/guides/building-and-testing-nodejs#specifying-the-nodejs-version',
|
|
13
13
|
VERCEL: 'https://vercel.com/docs/runtimes#official-runtimes/node-js/node-js-version',
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
/** `astro *` */
|
|
16
17
|
async function main() {
|
|
17
18
|
// Check for ESM support.
|
|
18
19
|
// Load the "supports-esm" package in an way that works in both ESM & CJS.
|
|
@@ -29,7 +30,7 @@ async function main() {
|
|
|
29
30
|
|
|
30
31
|
// Preflight check complete. Enjoy! ✨
|
|
31
32
|
if (supportsESM) {
|
|
32
|
-
return import('./dist/cli.js')
|
|
33
|
+
return import('./dist/cli/index.js')
|
|
33
34
|
.then(({ cli }) => cli(process.argv))
|
|
34
35
|
.catch((error) => {
|
|
35
36
|
console.error(error);
|
|
@@ -80,8 +81,8 @@ Please upgrade Node.js to a supported version: "${engines}"\n`);
|
|
|
80
81
|
}
|
|
81
82
|
console.log(`${ci.name} CI Environment Detected!\nAdditional steps may be needed to set your Node.js version:`);
|
|
82
83
|
console.log(`Documentation: https://docs.astro.build/guides/deploy`);
|
|
83
|
-
if (
|
|
84
|
-
console.log(`${ci.name} Documentation: ${
|
|
84
|
+
if (CI_INSTRUCTIONS[platform]) {
|
|
85
|
+
console.log(`${ci.name} Documentation: ${CI_INSTRUCTIONS[platform]}`);
|
|
85
86
|
}
|
|
86
87
|
console.log(``);
|
|
87
88
|
}
|
package/components/Code.astro
CHANGED
|
@@ -4,14 +4,14 @@ import shiki from 'shiki';
|
|
|
4
4
|
export interface Props {
|
|
5
5
|
/** The code to highlight. Required. */
|
|
6
6
|
code: string;
|
|
7
|
-
/**
|
|
8
|
-
* The language of your code. Defaults to "plaintext".
|
|
9
|
-
* Supports all languages listed here: https://github.com/shikijs/shiki/blob/main/docs/themes.md
|
|
7
|
+
/**
|
|
8
|
+
* The language of your code. Defaults to "plaintext".
|
|
9
|
+
* Supports all languages listed here: https://github.com/shikijs/shiki/blob/main/docs/themes.md
|
|
10
10
|
*/
|
|
11
11
|
lang?: string;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
13
|
* The styling theme. Defaults to "github-dark".
|
|
14
|
-
* Supports all themes listed here: https://github.com/shikijs/shiki/blob/main/docs/themes.md
|
|
14
|
+
* Supports all themes listed here: https://github.com/shikijs/shiki/blob/main/docs/themes.md
|
|
15
15
|
* Instructions for loading a custom theme: https://github.com/shikijs/shiki/blob/main/docs/themes.md#loading-theme
|
|
16
16
|
*/
|
|
17
17
|
theme?: string;
|
|
@@ -45,6 +45,6 @@ function repairShikiTheme(html: string): string {
|
|
|
45
45
|
|
|
46
46
|
const highlighter = await shiki.getHighlighter({theme});
|
|
47
47
|
const _html = highlighter.codeToHtml(code, lang);
|
|
48
|
-
html = repairShikiTheme(_html);
|
|
48
|
+
const html = repairShikiTheme(_html);
|
|
49
49
|
---
|
|
50
50
|
{html}
|
package/components/Debug.astro
CHANGED
|
@@ -1,144 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
const key = Object.keys(Astro.props)[0];
|
|
3
3
|
const value = Astro.props[key];
|
|
4
|
-
|
|
5
|
-
const getType = (node: unknown) => {
|
|
6
|
-
if (Array.isArray(node)) return 'array';
|
|
7
|
-
if (node === null) return 'null';
|
|
8
|
-
if (typeof node === 'object') {
|
|
9
|
-
if ((node as any).then) return 'promise';
|
|
10
|
-
}
|
|
11
|
-
return typeof node;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const getSummary = (node: any, key: string, className: string) => {
|
|
15
|
-
const type = getType(node);
|
|
16
|
-
let value;
|
|
17
|
-
let open;
|
|
18
|
-
let close;
|
|
19
|
-
|
|
20
|
-
if (type === 'function') {
|
|
21
|
-
return <>
|
|
22
|
-
{(key || !key && key === 0) && <><span class={`${className} key`}>{key}</span><span class={`${className} sep`}>:</span></>}
|
|
23
|
-
<span class={`${className} value value-function`}>{node.name}<span class={`${className} punc`}>()</span></span>
|
|
24
|
-
</>
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (type === 'promise') {
|
|
28
|
-
return <>
|
|
29
|
-
{(key || !key && key === 0) && <><span class={`${className} key`}>{key}</span><span class={`${className} sep`}>:</span></>}
|
|
30
|
-
<span class={`${className} value value-promise`}>Promise</span>
|
|
31
|
-
</>
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (type === 'array') {
|
|
35
|
-
value = node.length;
|
|
36
|
-
open = <><span class={`${className} none`}>Array</span>{'['}</>;
|
|
37
|
-
close = ']';
|
|
38
|
-
} else if (type === 'object') {
|
|
39
|
-
const keys = Object.keys(node);
|
|
40
|
-
if (keys.length === 0) {
|
|
41
|
-
value = 'Empty';
|
|
42
|
-
} else if (keys.length > 3) {
|
|
43
|
-
value = '…';
|
|
44
|
-
} else {
|
|
45
|
-
value = keys.slice(0, 3).join(',');
|
|
46
|
-
}
|
|
47
|
-
open = '{';
|
|
48
|
-
close = '}';
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return <>
|
|
52
|
-
{key && <><span class={`${className} key`}>{key}</span>: </>}
|
|
53
|
-
{open && <span class={`${className} punc`}>{open}</span>}
|
|
54
|
-
<span class={`${className} hide`}>
|
|
55
|
-
<span class={`${className} len`}>{value}</span>
|
|
56
|
-
{close && <span class={`${className} punc`}>{close}</span>}
|
|
57
|
-
</span>
|
|
58
|
-
</>;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const Details = ({ node, key, children, class: className }) => {
|
|
62
|
-
const type = getType(node);
|
|
63
|
-
const props = {};
|
|
64
|
-
|
|
65
|
-
if (type === 'array' || type === 'object') {
|
|
66
|
-
props['data-char'] = type === 'array' ? ']' : '}'
|
|
67
|
-
props.open = !key && type === 'object' ? '' : undefined;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<details {...props} class={className}>
|
|
72
|
-
<Summary node={node} key={key} class={className} />
|
|
73
|
-
{children}
|
|
74
|
-
</details>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const Summary = ({ node, key, class: className }) => {
|
|
79
|
-
return (
|
|
80
|
-
<summary class={className}>{getSummary(node, key, className)}</summary>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const Empty = Symbol('Empty');
|
|
85
|
-
|
|
86
|
-
const KeyValue = ({ key, value, dim, class: className }) => {
|
|
87
|
-
let type = key === '__proto__' ? 'prototype' : getType(value);
|
|
88
|
-
if (type === 'null') {
|
|
89
|
-
value = 'null';
|
|
90
|
-
} else if (type === 'undefined') {
|
|
91
|
-
value = 'undefined';
|
|
92
|
-
} else if (value === Empty) {
|
|
93
|
-
type = 'empty';
|
|
94
|
-
value = 'Empty';
|
|
95
|
-
} else {
|
|
96
|
-
value = JSON.stringify(value);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return (
|
|
100
|
-
<div class={`${className} line`}>
|
|
101
|
-
{(key || !key && key === 0) && <><span class={`${className} key ${dim ? 'key-dim' : ''}`.trim()}>{key}</span><span class={`${className} sep`}>:</span></>}
|
|
102
|
-
<span class={`${className} value value-${type}`}>
|
|
103
|
-
{value}
|
|
104
|
-
</span>
|
|
105
|
-
</div>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const Node = ({ node, key, class: className, ...props }) => {
|
|
110
|
-
const type = getType(node);
|
|
111
|
-
className = className.replace(/debug-value/g, '');
|
|
112
|
-
|
|
113
|
-
if (type === 'array' || type === 'object') {
|
|
114
|
-
let children = [];
|
|
115
|
-
if (type === 'array' && node.length > 0 && Object.entries(node).length === 0) {
|
|
116
|
-
children = Array.from({ length: node.length }, (_, key) => <Node node={Empty} key={key} class={className} />);
|
|
117
|
-
} else {
|
|
118
|
-
children = Object.entries(node).map(([key, value]) => <Node node={value} key={key} class={className} />);
|
|
119
|
-
}
|
|
120
|
-
return (
|
|
121
|
-
<Details node={node} key={key} children={children} class={className} />
|
|
122
|
-
);
|
|
123
|
-
} else if (type === 'function') {
|
|
124
|
-
return (
|
|
125
|
-
<Details node={node} key={key} class={className} children={
|
|
126
|
-
<>
|
|
127
|
-
<KeyValue key="name" value={node.name} dim={true} class={className} />
|
|
128
|
-
<KeyValue key="__proto__" value="Function" dim={true} class={className} />
|
|
129
|
-
</>
|
|
130
|
-
}/>
|
|
131
|
-
);
|
|
132
|
-
} else if (type === 'promise') {
|
|
133
|
-
return (
|
|
134
|
-
<Details node={node} key={key} class={className} children={
|
|
135
|
-
<KeyValue key="__proto__" value="Promise" dim={true} />
|
|
136
|
-
} />
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return <KeyValue key={key} value={node} class={className} />;
|
|
141
|
-
}
|
|
142
4
|
---
|
|
143
5
|
|
|
144
6
|
<div class="debug">
|
|
@@ -146,21 +8,32 @@ const Node = ({ node, key, class: className, ...props }) => {
|
|
|
146
8
|
<h2 class="debug-title"><span class="debug-label">Debug</span> <span class="debug-name">"{key}"</span></h2>
|
|
147
9
|
</div>
|
|
148
10
|
|
|
149
|
-
<
|
|
150
|
-
<Node node={value} class="debug-value" />
|
|
151
|
-
</main>
|
|
11
|
+
<pre>{JSON.stringify(value, null, 2)}</pre>
|
|
152
12
|
</div>
|
|
153
13
|
|
|
154
|
-
<style
|
|
155
|
-
.debug
|
|
156
|
-
|
|
14
|
+
<style>
|
|
15
|
+
.debug {
|
|
16
|
+
font-size: 14px;
|
|
17
|
+
padding: 1rem 1.5rem;
|
|
18
|
+
background: white;
|
|
19
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.debug-header, pre {
|
|
157
23
|
margin: -1rem -1.5rem 1rem;
|
|
158
24
|
padding: 0.25rem 0.75rem;
|
|
159
25
|
}
|
|
160
26
|
|
|
27
|
+
.debug-header {
|
|
28
|
+
background: #FF1639;
|
|
29
|
+
border-radius: 4px;
|
|
30
|
+
border-bottom-left-radius: 0;
|
|
31
|
+
border-bottom-right-radius: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
161
34
|
.debug-title {
|
|
162
35
|
font-size: 1em;
|
|
163
|
-
color:
|
|
36
|
+
color: white;
|
|
164
37
|
margin: 0.5em 0;
|
|
165
38
|
}
|
|
166
39
|
|
|
@@ -170,137 +43,12 @@ const Node = ({ node, key, class: className, ...props }) => {
|
|
|
170
43
|
margin-right: 0.75em;
|
|
171
44
|
}
|
|
172
45
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
border: 1px solid #FFCFD6;
|
|
181
|
-
|
|
182
|
-
background: #FFF;
|
|
183
|
-
font-family: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace;
|
|
184
|
-
font-size: 0.8rem;
|
|
185
|
-
line-height: 1.44;
|
|
186
|
-
color: #6b7280;
|
|
187
|
-
white-space: pre;
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
details[open] > summary span.hide {
|
|
192
|
-
visibility: hidden;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
details[open] > summary span.none {
|
|
196
|
-
display: none;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
details > details {
|
|
200
|
-
padding-left: 1em;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.line {
|
|
204
|
-
padding-left: 1.125em;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
details[open]::after {
|
|
208
|
-
content: attr(data-char);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.sep {
|
|
212
|
-
margin-right: 0.25em;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
details > summary {
|
|
217
|
-
cursor: pointer;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
details:hover > summary::before,
|
|
221
|
-
details:focus > summary::before {
|
|
222
|
-
transform: translate(0.25em, -0.25em);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
details > summary::before {
|
|
226
|
-
content: '';
|
|
227
|
-
background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 8L2.60769 14L2.6077 2L13 8Z' fill='%236B7280' /%3E%3C/svg%3E%0A");
|
|
228
|
-
background-size: 1em;
|
|
229
|
-
|
|
230
|
-
display: inline-flex;
|
|
231
|
-
font-size: 0.5em;
|
|
232
|
-
width: 1em;
|
|
233
|
-
height: 1em;
|
|
234
|
-
margin-right: 1.25em;
|
|
235
|
-
margin-left: -2em;
|
|
236
|
-
transform: translate(0, -0.25em);
|
|
237
|
-
line-height: 1em;
|
|
238
|
-
transition: transform 120ms ease-in;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
details[open] > summary::before {
|
|
242
|
-
transform: translate(0.25em, -0.25em) rotate(90deg);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.debug :global(::marker) {
|
|
246
|
-
content: '';
|
|
247
|
-
width: 0;
|
|
248
|
-
visibility: hidden;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.key {
|
|
252
|
-
color: #882de7;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.key-dim {
|
|
256
|
-
color: #B881F1;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.len {
|
|
260
|
-
color: #B881F1;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
details:hover > summary,
|
|
264
|
-
details:focus > summary,
|
|
265
|
-
details:hover > summary .punc,
|
|
266
|
-
details:focus > summary .punc,
|
|
267
|
-
details:hover[open]::after,
|
|
268
|
-
details:focus[open]::after {
|
|
269
|
-
color: #000012;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
details:hover > summary .len,
|
|
273
|
-
details:focus > summary .len {
|
|
274
|
-
color: #882DE7;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.punc {
|
|
278
|
-
color: #6b7280;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.value-string {
|
|
282
|
-
color: #17c083;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
.value-function::before {
|
|
286
|
-
content: 'ƒ ';
|
|
287
|
-
color: #3894ff;
|
|
288
|
-
}
|
|
289
|
-
.value-function {
|
|
290
|
-
color: #5076f9;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.value-number {
|
|
294
|
-
color: #ff5d01;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
.value-null,
|
|
298
|
-
.value-undefined {
|
|
299
|
-
color: #9ca3af;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
main > .line {
|
|
303
|
-
margin-left: -0.75em;
|
|
304
|
-
padding-left: 0;
|
|
46
|
+
pre {
|
|
47
|
+
border: 1px solid #eee;
|
|
48
|
+
padding: 1rem 0.75rem;
|
|
49
|
+
border-radius: 4px;
|
|
50
|
+
border-top-left-radius: 0;
|
|
51
|
+
border-top-right-radius: 0;
|
|
52
|
+
font-size: 14px;
|
|
305
53
|
}
|
|
306
54
|
</style>
|
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { renderMarkdown } from '@astrojs/markdown-support';
|
|
3
|
-
|
|
4
2
|
export interface Props {
|
|
5
3
|
content?: string;
|
|
6
4
|
}
|
|
7
5
|
|
|
6
|
+
const dedent = (str: string) => str.split('\n').map(ln => ln.trimStart()).join('\n');
|
|
7
|
+
|
|
8
8
|
// Internal props that should not be part of the external interface.
|
|
9
9
|
interface InternalProps extends Props {
|
|
10
10
|
$scope: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
let { content, class: className } = Astro.props as InternalProps;
|
|
14
14
|
let html = null;
|
|
15
|
+
let htmlContent = '';
|
|
16
|
+
|
|
17
|
+
const { privateRenderMarkdownDoNotUse: renderMarkdown } = (Astro as any);
|
|
18
|
+
|
|
19
|
+
// If no content prop provided, use the slot.
|
|
20
|
+
if (!content) {
|
|
21
|
+
const { privateRenderSlotDoNotUse: renderSlot } = (Astro as any);
|
|
22
|
+
content = await renderSlot('default');
|
|
23
|
+
if (content.trim().length > 0) {
|
|
24
|
+
content = dedent(content);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
15
27
|
|
|
16
|
-
// This flow is only triggered if a user passes `<Markdown content={content} />`
|
|
17
28
|
if (content) {
|
|
18
|
-
|
|
29
|
+
htmlContent = await renderMarkdown(content, {
|
|
19
30
|
mode: 'md',
|
|
20
31
|
$: {
|
|
21
|
-
scopedClassName:
|
|
32
|
+
scopedClassName: className
|
|
22
33
|
}
|
|
23
34
|
});
|
|
24
|
-
html = htmlContent;
|
|
25
35
|
}
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
If we have rendered `html` for `content`, render that
|
|
29
|
-
Otherwise, just render the slotted content
|
|
30
|
-
*/
|
|
37
|
+
html = htmlContent;
|
|
31
38
|
---
|
|
32
39
|
{html ? html : <slot />}
|
|
File without changes
|
|
File without changes
|
|
@@ -91,4 +91,4 @@ export {
|
|
|
91
91
|
check,
|
|
92
92
|
run
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
94
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2NsaS9jaGVjay50cyJdLAogICJtYXBwaW5ncyI6ICJBQUNBO0FBR0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBLGdDQUFnQyxjQUFtQixtQkFBNkIsU0FBcUI7QUFDbkcsUUFBTSxRQUFRLE1BQU0sS0FBSyxjQUFjO0FBQUEsSUFDckMsS0FBSyxhQUFhO0FBQUEsSUFDbEIsUUFBUSxDQUFDLG1CQUFtQixPQUFPLGtCQUFrQixJQUFJLENBQUMsV0FBVyxHQUFHO0FBQUE7QUFFMUUsUUFBTSxlQUFlLE1BQU0sSUFBSSxDQUFDLE1BQU0sS0FBSyxRQUFRLGFBQWEsVUFBVTtBQUUxRSxhQUFXLGVBQWUsY0FBYztBQUN0QyxVQUFNLE9BQU8sR0FBRyxhQUFhLGFBQWE7QUFDMUMsWUFBUSxlQUFlO0FBQUEsTUFDckIsS0FBSyxjQUFjLGFBQWE7QUFBQSxNQUNoQztBQUFBO0FBQUE7QUFBQTtBQVVOLGtCQUFrQixDQUFFLE1BQU0sWUFBa0QsTUFBYztBQUN4RixNQUFJLElBQUk7QUFDUixNQUFJLElBQUk7QUFDUixNQUFJLElBQUk7QUFDUixTQUFPLElBQUksS0FBSyxRQUFRO0FBQ3RCLFFBQUksTUFBTSxRQUFRLE1BQU0sV0FBVztBQUNqQztBQUFBO0FBR0YsUUFBSSxPQUFPLEtBQUs7QUFDaEIsWUFBUTtBQUFBLFdBQ0QsTUFBTTtBQUNUO0FBQ0EsWUFBSTtBQUNKO0FBQUE7QUFBQSxlQUVPO0FBQ1A7QUFDQTtBQUFBO0FBQUE7QUFJSjtBQUFBO0FB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FBQ2hELGNBQUksU0FBUyxJQUFJLEtBQUssRUFBRSxNQUFNLElBQUksWUFBWSxFQUFFLE1BQU0sTUFBTTtBQUM1RCxjQUFJLFNBQVMsSUFBSSxLQUFLLEVBQUUsTUFBTSxNQUFNLFlBQVksYUFBYTtBQUM3RCxrQkFBUSxNQUFNLE1BQU0sU0FBUyxLQUFLLElBQUk7QUFBQTtBQUN0QyxpQkFBTztBQUNQO0FBQUE7QUFBQSxhQUVHLG1CQUFtQixTQUFTO0FBQy9CLGlCQUFPO0FBQ1A7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQU1SLE1BQUksT0FBTyxRQUFRO0FBQ2pCLFlBQVEsTUFBTSxTQUFTLE9BQU87QUFBQTtBQUdoQyxRQUFNLFdBQVcsT0FBTyxTQUFTLElBQUk7QUFDckMsU0FBTztBQUFBOyIsCiAgIm5hbWVzIjogW10KfQo=
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import * as colors from "kleur/colors";
|
|
18
|
+
import fs from "fs";
|
|
19
|
+
import yargs from "yargs-parser";
|
|
20
|
+
import {z} from "zod";
|
|
21
|
+
import {defaultLogDestination} from "../core/logger.js";
|
|
22
|
+
import build from "../core/build/index.js";
|
|
23
|
+
import devServer from "../core/dev/index.js";
|
|
24
|
+
import preview from "../core/preview/index.js";
|
|
25
|
+
import {check} from "./check.js";
|
|
26
|
+
import {formatConfigError, loadConfig} from "../core/config.js";
|
|
27
|
+
function resolveArgs(flags) {
|
|
28
|
+
const options = {
|
|
29
|
+
projectRoot: typeof flags.projectRoot === "string" ? flags.projectRoot : void 0,
|
|
30
|
+
site: typeof flags.site === "string" ? flags.site : void 0,
|
|
31
|
+
sitemap: typeof flags.sitemap === "boolean" ? flags.sitemap : void 0,
|
|
32
|
+
port: typeof flags.port === "number" ? flags.port : void 0,
|
|
33
|
+
config: typeof flags.config === "string" ? flags.config : void 0
|
|
34
|
+
};
|
|
35
|
+
if (flags.version) {
|
|
36
|
+
return {cmd: "version", options};
|
|
37
|
+
} else if (flags.help) {
|
|
38
|
+
return {cmd: "help", options};
|
|
39
|
+
}
|
|
40
|
+
const cmd = flags._[2];
|
|
41
|
+
switch (cmd) {
|
|
42
|
+
case "dev":
|
|
43
|
+
return {cmd: "dev", options};
|
|
44
|
+
case "build":
|
|
45
|
+
return {cmd: "build", options};
|
|
46
|
+
case "preview":
|
|
47
|
+
return {cmd: "preview", options};
|
|
48
|
+
case "check":
|
|
49
|
+
return {cmd: "check", options};
|
|
50
|
+
default:
|
|
51
|
+
return {cmd: "help", options};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function printHelp() {
|
|
55
|
+
console.error(` ${colors.bold("astro")} - Futuristic web development tool.
|
|
56
|
+
${colors.bold("Commands:")}
|
|
57
|
+
astro dev Run Astro in development mode.
|
|
58
|
+
astro build Build a pre-compiled production version of your site.
|
|
59
|
+
astro preview Preview your build locally before deploying.
|
|
60
|
+
astro check Check your project for errors.
|
|
61
|
+
|
|
62
|
+
${colors.bold("Flags:")}
|
|
63
|
+
--config <path> Specify the path to the Astro config file.
|
|
64
|
+
--project-root <path> Specify the path to the project root folder.
|
|
65
|
+
--no-sitemap Disable sitemap generation (build only).
|
|
66
|
+
--verbose Enable verbose logging
|
|
67
|
+
--silent Disable logging
|
|
68
|
+
--version Show the version number and exit.
|
|
69
|
+
--help Show this help message.
|
|
70
|
+
`);
|
|
71
|
+
}
|
|
72
|
+
async function printVersion() {
|
|
73
|
+
const pkg = JSON.parse(await fs.promises.readFile(new URL("../package.json", import.meta.url), "utf8"));
|
|
74
|
+
console.error(pkg.version);
|
|
75
|
+
}
|
|
76
|
+
function mergeCLIFlags(astroConfig, flags) {
|
|
77
|
+
if (typeof flags.sitemap === "boolean")
|
|
78
|
+
astroConfig.buildOptions.sitemap = flags.sitemap;
|
|
79
|
+
if (typeof flags.site === "string")
|
|
80
|
+
astroConfig.buildOptions.site = flags.site;
|
|
81
|
+
if (typeof flags.port === "number")
|
|
82
|
+
astroConfig.devOptions.port = flags.port;
|
|
83
|
+
if (typeof flags.hostname === "string")
|
|
84
|
+
astroConfig.devOptions.hostname = flags.hostname;
|
|
85
|
+
}
|
|
86
|
+
async function cli(args) {
|
|
87
|
+
const flags = yargs(args);
|
|
88
|
+
const state = resolveArgs(flags);
|
|
89
|
+
const options = __spreadValues({}, state.options);
|
|
90
|
+
const projectRoot = options.projectRoot || flags._[3];
|
|
91
|
+
let logging = {
|
|
92
|
+
dest: defaultLogDestination,
|
|
93
|
+
level: "info"
|
|
94
|
+
};
|
|
95
|
+
if (flags.verbose)
|
|
96
|
+
logging.level = "debug";
|
|
97
|
+
if (flags.silent)
|
|
98
|
+
logging.level = "silent";
|
|
99
|
+
let config;
|
|
100
|
+
try {
|
|
101
|
+
config = await loadConfig({cwd: projectRoot, filename: options.config});
|
|
102
|
+
mergeCLIFlags(config, options);
|
|
103
|
+
} catch (err) {
|
|
104
|
+
if (err instanceof z.ZodError) {
|
|
105
|
+
console.log(formatConfigError(err));
|
|
106
|
+
} else {
|
|
107
|
+
console.error(colors.red(err.toString() || err));
|
|
108
|
+
}
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
switch (state.cmd) {
|
|
112
|
+
case "help": {
|
|
113
|
+
printHelp();
|
|
114
|
+
process.exit(1);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
case "version": {
|
|
118
|
+
await printVersion();
|
|
119
|
+
process.exit(0);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
case "dev": {
|
|
123
|
+
try {
|
|
124
|
+
const server = await devServer(config, {logging});
|
|
125
|
+
await new Promise(() => {
|
|
126
|
+
});
|
|
127
|
+
} catch (err) {
|
|
128
|
+
throwAndExit(err);
|
|
129
|
+
}
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
case "build": {
|
|
133
|
+
try {
|
|
134
|
+
await build(config, {logging});
|
|
135
|
+
process.exit(0);
|
|
136
|
+
} catch (err) {
|
|
137
|
+
throwAndExit(err);
|
|
138
|
+
}
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
case "check": {
|
|
142
|
+
const ret = await check(config);
|
|
143
|
+
process.exit(ret);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
case "preview": {
|
|
147
|
+
try {
|
|
148
|
+
await preview(config, {logging});
|
|
149
|
+
} catch (err) {
|
|
150
|
+
throwAndExit(err);
|
|
151
|
+
}
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
default: {
|
|
155
|
+
throw new Error(`Error running ${state.cmd}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function throwAndExit(err) {
|
|
160
|
+
console.error(colors.red(err.toString() || err));
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
export {
|
|
164
|
+
cli
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2NsaS9pbmRleC50cyJ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