astro 2.0.17 → 2.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/README.md +3 -3
- package/client-base.d.ts +27 -0
- package/client-image.d.ts +48 -0
- package/components/Image.astro +28 -0
- package/dist/@types/astro.d.ts +101 -1
- package/dist/assets/consts.d.ts +4 -0
- package/dist/assets/consts.js +20 -0
- package/dist/assets/image-endpoint.d.ts +5 -0
- package/dist/assets/image-endpoint.js +50 -0
- package/dist/assets/index.d.ts +4 -0
- package/dist/assets/index.js +10 -0
- package/dist/assets/internal.d.ts +36 -0
- package/dist/assets/internal.js +70 -0
- package/dist/assets/services/service.d.ts +71 -0
- package/dist/assets/services/service.js +88 -0
- package/dist/assets/services/sharp.d.ts +3 -0
- package/dist/assets/services/sharp.js +57 -0
- package/dist/assets/services/squoosh.d.ts +3 -0
- package/dist/assets/services/squoosh.js +56 -0
- package/dist/assets/services/vendor/squoosh/avif/avif_enc.d.js +11 -0
- package/dist/assets/services/vendor/squoosh/avif/avif_node_dec.d.ts +2 -0
- package/dist/assets/services/vendor/squoosh/avif/avif_node_dec.js +1628 -0
- package/dist/assets/services/vendor/squoosh/avif/avif_node_dec.wasm +0 -0
- package/dist/assets/services/vendor/squoosh/avif/avif_node_enc.d.ts +2 -0
- package/dist/assets/services/vendor/squoosh/avif/avif_node_enc.js +1850 -0
- package/dist/assets/services/vendor/squoosh/avif/avif_node_enc.wasm +0 -0
- package/dist/assets/services/vendor/squoosh/codecs.d.ts +158 -0
- package/dist/assets/services/vendor/squoosh/codecs.js +284 -0
- package/dist/assets/services/vendor/squoosh/copy-wasm.d.ts +1 -0
- package/dist/assets/services/vendor/squoosh/copy-wasm.js +24 -0
- package/dist/assets/services/vendor/squoosh/emscripten-types.d.js +0 -0
- package/dist/assets/services/vendor/squoosh/emscripten-utils.d.ts +9 -0
- package/dist/assets/services/vendor/squoosh/emscripten-utils.js +33 -0
- package/dist/assets/services/vendor/squoosh/image-pool.d.ts +4 -0
- package/dist/assets/services/vendor/squoosh/image-pool.js +94 -0
- package/dist/assets/services/vendor/squoosh/image.d.ts +14 -0
- package/dist/assets/services/vendor/squoosh/image.js +27 -0
- package/dist/assets/services/vendor/squoosh/image_data.d.ts +9 -0
- package/dist/assets/services/vendor/squoosh/image_data.js +22 -0
- package/dist/assets/services/vendor/squoosh/impl.d.ts +22 -0
- package/dist/assets/services/vendor/squoosh/impl.js +110 -0
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_enc.d.js +11 -0
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_dec.d.ts +2 -0
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_dec.js +1631 -0
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_dec.wasm +0 -0
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_enc.d.ts +2 -0
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_enc.js +1737 -0
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_enc.wasm +0 -0
- package/dist/assets/services/vendor/squoosh/png/squoosh_oxipng.d.ts +10 -0
- package/dist/assets/services/vendor/squoosh/png/squoosh_oxipng.js +89 -0
- package/dist/assets/services/vendor/squoosh/png/squoosh_oxipng_bg.wasm +0 -0
- package/dist/assets/services/vendor/squoosh/png/squoosh_png.d.ts +15 -0
- package/dist/assets/services/vendor/squoosh/png/squoosh_png.js +138 -0
- package/dist/assets/services/vendor/squoosh/png/squoosh_png_bg.wasm +0 -0
- package/dist/assets/services/vendor/squoosh/resize/squoosh_resize.d.ts +15 -0
- package/dist/assets/services/vendor/squoosh/resize/squoosh_resize.js +95 -0
- package/dist/assets/services/vendor/squoosh/resize/squoosh_resize_bg.wasm +0 -0
- package/dist/assets/services/vendor/squoosh/rotate/rotate.wasm +0 -0
- package/dist/assets/services/vendor/squoosh/utils/execOnce.d.ts +1 -0
- package/dist/assets/services/vendor/squoosh/utils/execOnce.js +14 -0
- package/dist/assets/services/vendor/squoosh/utils/workerPool.d.ts +22 -0
- package/dist/assets/services/vendor/squoosh/utils/workerPool.js +95 -0
- package/dist/assets/services/vendor/squoosh/webp/webp_enc.d.js +4 -0
- package/dist/assets/services/vendor/squoosh/webp/webp_node_dec.d.ts +2 -0
- package/dist/assets/services/vendor/squoosh/webp/webp_node_dec.js +1473 -0
- package/dist/assets/services/vendor/squoosh/webp/webp_node_dec.wasm +0 -0
- package/dist/assets/services/vendor/squoosh/webp/webp_node_enc.d.ts +2 -0
- package/dist/assets/services/vendor/squoosh/webp/webp_node_enc.js +1640 -0
- package/dist/assets/services/vendor/squoosh/webp/webp_node_enc.wasm +0 -0
- package/dist/assets/types.d.ts +119 -0
- package/dist/assets/types.js +0 -0
- package/dist/assets/utils/etag.d.ts +12 -0
- package/dist/assets/utils/etag.js +28 -0
- package/dist/assets/utils/metadata.d.ts +6 -0
- package/dist/assets/utils/metadata.js +30 -0
- package/dist/assets/utils/queryParams.d.ts +2 -0
- package/dist/assets/utils/queryParams.js +16 -0
- package/dist/assets/utils/transformToPath.d.ts +2 -0
- package/dist/assets/utils/transformToPath.js +17 -0
- package/dist/assets/vite-plugin-assets.d.ts +5 -0
- package/dist/assets/vite-plugin-assets.js +187 -0
- package/dist/cli/check/index.d.ts +81 -2
- package/dist/cli/check/index.js +190 -44
- package/dist/cli/index.js +39 -16
- package/dist/cli/telemetry.js +1 -1
- package/dist/content/consts.d.ts +0 -1
- package/dist/content/consts.js +1 -3
- package/dist/content/internal.d.ts +7 -0
- package/dist/content/internal.js +27 -5
- package/dist/content/template/virtual-mod.d.mts +1 -0
- package/dist/content/types-generator.js +25 -10
- package/dist/content/utils.d.ts +16 -13
- package/dist/content/utils.js +29 -6
- package/dist/content/vite-plugin-content-assets.d.ts +3 -1
- package/dist/content/vite-plugin-content-assets.js +10 -6
- package/dist/content/vite-plugin-content-imports.js +54 -27
- package/dist/content/vite-plugin-content-virtual-mod.js +7 -4
- package/dist/core/add/index.js +2 -1
- package/dist/core/app/index.js +104 -134
- package/dist/core/build/generate.js +30 -5
- package/dist/core/build/index.d.ts +2 -0
- package/dist/core/build/index.js +16 -0
- package/dist/core/build/plugins/plugin-ssr.js +3 -5
- package/dist/core/config/config.js +2 -1
- package/dist/core/config/schema.d.ts +64 -8
- package/dist/core/config/schema.js +17 -3
- package/dist/core/config/settings.js +4 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/cookies/cookies.js +36 -68
- package/dist/core/create-vite.js +5 -1
- package/dist/core/dev/dev.d.ts +2 -2
- package/dist/core/dev/dev.js +24 -4
- package/dist/core/errors/dev/vite.js +6 -1
- package/dist/core/errors/errors-data.d.ts +17 -1
- package/dist/core/errors/errors-data.js +16 -0
- package/dist/core/messages.js +2 -2
- package/dist/core/path.d.ts +1 -0
- package/dist/core/path.js +4 -0
- package/dist/core/preview/index.d.ts +3 -1
- package/dist/core/preview/index.js +16 -1
- package/dist/core/render/dev/css.js +2 -2
- package/dist/core/render/dev/environment.js +1 -5
- package/dist/core/render/environment.js +1 -2
- package/dist/core/render/result.js +13 -35
- package/dist/core/sync/index.d.ts +18 -5
- package/dist/core/sync/index.js +13 -1
- package/dist/integrations/index.js +12 -1
- package/dist/runtime/server/render/component.js +1 -1
- package/dist/runtime/server/response.js +11 -30
- package/dist/vite-plugin-astro-postprocess/index.js +1 -1
- package/dist/vite-plugin-astro-server/plugin.js +1 -1
- package/dist/vite-plugin-env/index.js +4 -4
- package/dist/vite-plugin-inject-env-ts/index.js +17 -2
- package/dist/vite-plugin-markdown/content-entry-type.d.ts +7 -0
- package/dist/vite-plugin-markdown/content-entry-type.js +39 -0
- package/dist/vite-plugin-markdown/index.js +70 -4
- package/dist/vite-plugin-ssr-manifest/index.d.ts +2 -0
- package/dist/vite-plugin-ssr-manifest/index.js +25 -0
- package/package.json +26 -9
- package/src/content/template/types.d.ts +18 -9
- package/src/content/template/virtual-mod.mjs +6 -0
- package/tsconfigs/base.json +6 -1
|
@@ -5,9 +5,11 @@ import {
|
|
|
5
5
|
} from "@astrojs/markdown-remark/dist/internal.js";
|
|
6
6
|
import fs from "fs";
|
|
7
7
|
import matter from "gray-matter";
|
|
8
|
+
import npath from "node:path";
|
|
8
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
+
import { pathToFileURL } from "url";
|
|
9
11
|
import { normalizePath } from "vite";
|
|
10
|
-
import {
|
|
12
|
+
import { imageMetadata } from "../assets/index.js";
|
|
11
13
|
import { AstroError, AstroErrorData, MarkdownError } from "../core/errors/index.js";
|
|
12
14
|
import { warn } from "../core/logger/core.js";
|
|
13
15
|
import { isMarkdownFile } from "../core/util.js";
|
|
@@ -40,6 +42,24 @@ const astroJsxRuntimeModulePath = normalizePath(
|
|
|
40
42
|
fileURLToPath(new URL("../jsx-runtime/index.js", import.meta.url))
|
|
41
43
|
);
|
|
42
44
|
function markdown({ settings, logging }) {
|
|
45
|
+
const markdownAssetMap = /* @__PURE__ */ new Map();
|
|
46
|
+
async function resolveImage(fileId, path) {
|
|
47
|
+
const resolved = await this.resolve(path, fileId);
|
|
48
|
+
if (!resolved)
|
|
49
|
+
return path;
|
|
50
|
+
const rel = npath.relative(normalizePath(fileURLToPath(settings.config.root)), resolved.id);
|
|
51
|
+
const buffer = await fs.promises.readFile(resolved.id);
|
|
52
|
+
if (markdownAssetMap.has(resolved.id)) {
|
|
53
|
+
return `ASTRO_ASSET_MD_${markdownAssetMap.get(resolved.id)}`;
|
|
54
|
+
}
|
|
55
|
+
const file = this.emitFile({
|
|
56
|
+
type: "asset",
|
|
57
|
+
name: rel,
|
|
58
|
+
source: buffer
|
|
59
|
+
});
|
|
60
|
+
markdownAssetMap.set(resolved.id, file);
|
|
61
|
+
return `ASTRO_ASSET_MD_${file}`;
|
|
62
|
+
}
|
|
43
63
|
return {
|
|
44
64
|
enforce: "pre",
|
|
45
65
|
name: "astro:markdown",
|
|
@@ -48,14 +68,32 @@ function markdown({ settings, logging }) {
|
|
|
48
68
|
const { fileId, fileUrl } = getFileInfo(id, settings.config);
|
|
49
69
|
const rawFile = await fs.promises.readFile(fileId, "utf-8");
|
|
50
70
|
const raw = safeMatter(rawFile, id);
|
|
71
|
+
let imageService = void 0;
|
|
72
|
+
if (settings.config.experimental.assets) {
|
|
73
|
+
imageService = (await import(settings.config.image.service)).default;
|
|
74
|
+
}
|
|
51
75
|
const renderResult = await renderMarkdown(raw.content, {
|
|
52
76
|
...settings.config.markdown,
|
|
53
77
|
fileURL: new URL(`file://${fileId}`),
|
|
54
|
-
|
|
55
|
-
|
|
78
|
+
frontmatter: raw.data,
|
|
79
|
+
experimentalAssets: settings.config.experimental.assets,
|
|
80
|
+
imageService,
|
|
81
|
+
assetsDir: new URL("./assets/", settings.config.srcDir),
|
|
82
|
+
resolveImage: this.meta.watchMode ? void 0 : resolveImage.bind(this, fileId)
|
|
56
83
|
});
|
|
57
|
-
|
|
84
|
+
this;
|
|
85
|
+
let html = renderResult.code;
|
|
58
86
|
const { headings } = renderResult.metadata;
|
|
87
|
+
let imagePaths = [];
|
|
88
|
+
if (settings.config.experimental.assets) {
|
|
89
|
+
let paths = renderResult.vfile.data.imagePaths ?? [];
|
|
90
|
+
imagePaths = await Promise.all(
|
|
91
|
+
paths.map(async (imagePath) => {
|
|
92
|
+
var _a;
|
|
93
|
+
return ((_a = await this.resolve(imagePath)) == null ? void 0 : _a.id) ?? imagePath;
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
}
|
|
59
97
|
const astroData = safelyGetAstroData(renderResult.vfile.data);
|
|
60
98
|
if (astroData instanceof InvalidAstroDataError) {
|
|
61
99
|
throw new AstroError(AstroErrorData.InvalidFrontmatterInjectionError);
|
|
@@ -72,6 +110,11 @@ function markdown({ settings, logging }) {
|
|
|
72
110
|
const code = escapeViteEnvReferences(`
|
|
73
111
|
import { Fragment, jsx as h } from ${JSON.stringify(astroJsxRuntimeModulePath)};
|
|
74
112
|
${layout ? `import Layout from ${JSON.stringify(layout)};` : ""}
|
|
113
|
+
${settings.config.experimental.assets ? 'import { getConfiguredImageService } from "astro:assets";\ngetConfiguredImageService();' : ""}
|
|
114
|
+
|
|
115
|
+
const images = {
|
|
116
|
+
${imagePaths.map((entry) => `'${entry}': await import('${entry}')`)}
|
|
117
|
+
}
|
|
75
118
|
|
|
76
119
|
const html = ${JSON.stringify(html)};
|
|
77
120
|
|
|
@@ -123,6 +166,29 @@ function markdown({ settings, logging }) {
|
|
|
123
166
|
}
|
|
124
167
|
};
|
|
125
168
|
}
|
|
169
|
+
},
|
|
170
|
+
async generateBundle(_opts, bundle) {
|
|
171
|
+
for (const [, output] of Object.entries(bundle)) {
|
|
172
|
+
if (output.type === "asset")
|
|
173
|
+
continue;
|
|
174
|
+
if (markdownAssetMap.size) {
|
|
175
|
+
const optimizedPaths = /* @__PURE__ */ new Map();
|
|
176
|
+
for (const [filename, hash] of markdownAssetMap) {
|
|
177
|
+
const image = await imageMetadata(pathToFileURL(filename));
|
|
178
|
+
if (!image) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
const fileName = this.getFileName(hash);
|
|
182
|
+
image.src = npath.join(settings.config.base, fileName);
|
|
183
|
+
const optimized = globalThis.astroAsset.addStaticImage({ src: image });
|
|
184
|
+
optimizedPaths.set(hash, optimized);
|
|
185
|
+
}
|
|
186
|
+
output.code = output.code.replace(/ASTRO_ASSET_MD_([0-9a-z]{8})/, (_str, hash) => {
|
|
187
|
+
const optimizedName = optimizedPaths.get(hash);
|
|
188
|
+
return optimizedName || this.getFileName(hash);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
126
192
|
}
|
|
127
193
|
};
|
|
128
194
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const manifestVirtualModuleId = "astro:ssr-manifest";
|
|
2
|
+
const resolvedManifestVirtualModuleId = "\0" + manifestVirtualModuleId;
|
|
3
|
+
function vitePluginSSRManifest() {
|
|
4
|
+
return {
|
|
5
|
+
name: "@astrojs/vite-plugin-astro-ssr-manifest",
|
|
6
|
+
enforce: "post",
|
|
7
|
+
resolveId(id, parent) {
|
|
8
|
+
if (id === manifestVirtualModuleId) {
|
|
9
|
+
return resolvedManifestVirtualModuleId;
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
load(id) {
|
|
13
|
+
if (id === resolvedManifestVirtualModuleId) {
|
|
14
|
+
return `export let manifest = {};
|
|
15
|
+
export function _privateSetManifestDontUseThis(ssrManifest) {
|
|
16
|
+
manifest = ssrManifest;
|
|
17
|
+
}`;
|
|
18
|
+
}
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
vitePluginSSRManifest
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"./types": "./types.d.ts",
|
|
33
33
|
"./client": "./client.d.ts",
|
|
34
34
|
"./client-base": "./client-base.d.ts",
|
|
35
|
+
"./client-image": "./client-image.d.ts",
|
|
35
36
|
"./import-meta": "./import-meta.d.ts",
|
|
36
37
|
"./astro-jsx": "./astro-jsx.d.ts",
|
|
37
38
|
"./tsconfigs/*.json": "./tsconfigs/*",
|
|
@@ -47,6 +48,10 @@
|
|
|
47
48
|
"./client/*": "./dist/runtime/client/*",
|
|
48
49
|
"./components": "./components/index.ts",
|
|
49
50
|
"./components/*": "./components/*",
|
|
51
|
+
"./assets": "./dist/assets/index.js",
|
|
52
|
+
"./assets/image-endpoint": "./dist/assets/image-endpoint.js",
|
|
53
|
+
"./assets/services/sharp": "./dist/assets/services/sharp.js",
|
|
54
|
+
"./assets/services/squoosh": "./dist/assets/services/squoosh.js",
|
|
50
55
|
"./content/internal": "./dist/content/internal.js",
|
|
51
56
|
"./debug": "./components/Debug.astro",
|
|
52
57
|
"./internal/*": "./dist/runtime/server/*",
|
|
@@ -77,6 +82,7 @@
|
|
|
77
82
|
"env.d.ts",
|
|
78
83
|
"client.d.ts",
|
|
79
84
|
"client-base.d.ts",
|
|
85
|
+
"client-image.d.ts",
|
|
80
86
|
"import-meta.d.ts",
|
|
81
87
|
"astro-jsx.d.ts",
|
|
82
88
|
"types.d.ts",
|
|
@@ -87,9 +93,9 @@
|
|
|
87
93
|
"dependencies": {
|
|
88
94
|
"@astrojs/compiler": "^1.2.0",
|
|
89
95
|
"@astrojs/language-server": "^0.28.3",
|
|
90
|
-
"@astrojs/markdown-remark": "^2.0
|
|
91
|
-
"@astrojs/telemetry": "^2.0
|
|
92
|
-
"@astrojs/webapi": "^2.0
|
|
96
|
+
"@astrojs/markdown-remark": "^2.1.0",
|
|
97
|
+
"@astrojs/telemetry": "^2.1.0",
|
|
98
|
+
"@astrojs/webapi": "^2.1.0",
|
|
93
99
|
"@babel/core": "^7.18.2",
|
|
94
100
|
"@babel/generator": "^7.18.2",
|
|
95
101
|
"@babel/parser": "^7.18.4",
|
|
@@ -100,6 +106,7 @@
|
|
|
100
106
|
"@types/yargs-parser": "^21.0.0",
|
|
101
107
|
"acorn": "^8.8.1",
|
|
102
108
|
"boxen": "^6.2.1",
|
|
109
|
+
"chokidar": "^3.5.3",
|
|
103
110
|
"ci-info": "^3.3.1",
|
|
104
111
|
"common-ancestor-path": "^1.0.1",
|
|
105
112
|
"cookie": "^0.5.0",
|
|
@@ -114,6 +121,7 @@
|
|
|
114
121
|
"github-slugger": "^2.0.0",
|
|
115
122
|
"gray-matter": "^4.0.3",
|
|
116
123
|
"html-escaper": "^3.0.3",
|
|
124
|
+
"image-size": "^1.0.2",
|
|
117
125
|
"kleur": "^4.1.4",
|
|
118
126
|
"magic-string": "^0.27.0",
|
|
119
127
|
"mime": "^3.0.0",
|
|
@@ -159,8 +167,9 @@
|
|
|
159
167
|
"@types/rimraf": "^3.0.2",
|
|
160
168
|
"@types/send": "^0.17.1",
|
|
161
169
|
"@types/server-destroy": "^1.0.1",
|
|
170
|
+
"@types/sharp": "^0.31.1",
|
|
162
171
|
"@types/unist": "^2.0.6",
|
|
163
|
-
"astro-scripts": "0.0.
|
|
172
|
+
"astro-scripts": "0.0.14",
|
|
164
173
|
"chai": "^4.3.6",
|
|
165
174
|
"cheerio": "^1.0.0-rc.11",
|
|
166
175
|
"eol": "^0.9.1",
|
|
@@ -173,21 +182,29 @@
|
|
|
173
182
|
"remark-code-titles": "^0.1.2",
|
|
174
183
|
"rollup": "^3.9.0",
|
|
175
184
|
"sass": "^1.52.2",
|
|
185
|
+
"sharp": "^0.31.3",
|
|
176
186
|
"srcset-parse": "^1.1.0",
|
|
177
187
|
"undici": "^5.20.0",
|
|
178
188
|
"unified": "^10.1.2"
|
|
179
189
|
},
|
|
190
|
+
"peerDependencies": {
|
|
191
|
+
"sharp": "^0.31.3"
|
|
192
|
+
},
|
|
193
|
+
"peerDependenciesMeta": {
|
|
194
|
+
"sharp": {
|
|
195
|
+
"optional": true
|
|
196
|
+
}
|
|
197
|
+
},
|
|
180
198
|
"engines": {
|
|
181
199
|
"node": ">=16.12.0",
|
|
182
200
|
"npm": ">=6.14.0"
|
|
183
201
|
},
|
|
184
202
|
"scripts": {
|
|
185
203
|
"prebuild": "astro-scripts prebuild --to-string \"src/runtime/server/astro-island.ts\" \"src/runtime/client/{idle,load,media,only,visible}.ts\"",
|
|
186
|
-
"build": "pnpm run prebuild && astro-scripts build \"src/**/*.ts\" && tsc",
|
|
204
|
+
"build": "pnpm run prebuild && astro-scripts build \"src/**/*.ts\" && tsc && pnpm run postbuild",
|
|
187
205
|
"build:ci": "pnpm run prebuild && astro-scripts build \"src/**/*.ts\"",
|
|
188
|
-
"dev": "astro-scripts dev --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.ts\"",
|
|
189
|
-
"postbuild": "astro-scripts copy \"src/**/*.astro\"",
|
|
190
|
-
"benchmark": "node test/benchmark/dev.bench.js && node test/benchmark/build.bench.js",
|
|
206
|
+
"dev": "astro-scripts dev --copy-wasm --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.ts\"",
|
|
207
|
+
"postbuild": "astro-scripts copy \"src/**/*.astro\" && astro-scripts copy \"src/**/*.wasm\"",
|
|
191
208
|
"test:unit": "mocha --exit --timeout 30000 ./test/units/**/*.test.js",
|
|
192
209
|
"test:unit:match": "mocha --exit --timeout 30000 ./test/units/**/*.test.js -g",
|
|
193
210
|
"test": "pnpm run test:unit && mocha --exit --timeout 20000 --ignore **/lit-element.test.js && mocha --timeout 20000 **/lit-element.test.js",
|
|
@@ -1,7 +1,24 @@
|
|
|
1
|
+
declare module 'astro:content' {
|
|
2
|
+
interface Render {
|
|
3
|
+
'.md': Promise<{
|
|
4
|
+
Content: import('astro').MarkdownInstance<{}>['Content'];
|
|
5
|
+
headings: import('astro').MarkdownHeading[];
|
|
6
|
+
remarkPluginFrontmatter: Record<string, any>;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
1
11
|
declare module 'astro:content' {
|
|
2
12
|
export { z } from 'astro/zod';
|
|
3
13
|
export type CollectionEntry<C extends keyof typeof entryMap> =
|
|
4
|
-
(typeof entryMap)[C][keyof (typeof entryMap)[C]]
|
|
14
|
+
(typeof entryMap)[C][keyof (typeof entryMap)[C]];
|
|
15
|
+
|
|
16
|
+
export const image: () => import('astro/zod').ZodObject<{
|
|
17
|
+
src: import('astro/zod').ZodString;
|
|
18
|
+
width: import('astro/zod').ZodNumber;
|
|
19
|
+
height: import('astro/zod').ZodNumber;
|
|
20
|
+
format: import('astro/zod').ZodString;
|
|
21
|
+
}>;
|
|
5
22
|
|
|
6
23
|
type BaseSchemaWithoutEffects =
|
|
7
24
|
| import('astro/zod').AnyZodObject
|
|
@@ -57,14 +74,6 @@ declare module 'astro:content' {
|
|
|
57
74
|
Required<ContentConfig['collections'][C]>['schema']
|
|
58
75
|
>;
|
|
59
76
|
|
|
60
|
-
type Render = {
|
|
61
|
-
render(): Promise<{
|
|
62
|
-
Content: import('astro').MarkdownInstance<{}>['Content'];
|
|
63
|
-
headings: import('astro').MarkdownHeading[];
|
|
64
|
-
remarkPluginFrontmatter: Record<string, any>;
|
|
65
|
-
}>;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
77
|
const entryMap: {
|
|
69
78
|
// @@ENTRY_MAP@@
|
|
70
79
|
};
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
createCollectionToGlobResultMap,
|
|
4
4
|
createGetCollection,
|
|
5
5
|
createGetEntryBySlug,
|
|
6
|
+
createImage,
|
|
6
7
|
} from 'astro/content/internal';
|
|
7
8
|
|
|
8
9
|
export { z } from 'astro/zod';
|
|
@@ -12,6 +13,7 @@ export function defineCollection(config) {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
const contentDir = '@@CONTENT_DIR@@';
|
|
16
|
+
const assetsDir = '@@ASSETS_DIR@@';
|
|
15
17
|
|
|
16
18
|
const entryGlob = import.meta.glob('@@ENTRY_GLOB_PATH@@', {
|
|
17
19
|
query: { astroContent: true },
|
|
@@ -38,3 +40,7 @@ export const getEntryBySlug = createGetEntryBySlug({
|
|
|
38
40
|
getCollection,
|
|
39
41
|
collectionToRenderEntryMap,
|
|
40
42
|
});
|
|
43
|
+
|
|
44
|
+
export const image = createImage({
|
|
45
|
+
assetsDir,
|
|
46
|
+
});
|
package/tsconfigs/base.json
CHANGED
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
// Properly support importing CJS modules in ESM
|
|
18
18
|
"esModuleInterop": true,
|
|
19
19
|
// Skip typechecking libraries and .d.ts files
|
|
20
|
-
"skipLibCheck": true
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
// Add alias for assets folder for easy reference to assets
|
|
22
|
+
"baseUrl": ".",
|
|
23
|
+
"paths": {
|
|
24
|
+
"~/assets/*": ["src/assets/*"]
|
|
25
|
+
}
|
|
21
26
|
}
|
|
22
27
|
}
|