astro 1.0.0-beta.26 → 1.0.0-beta.29
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/dist/cli/index.js +17 -17
- package/dist/core/add/consts.js +1 -1
- package/dist/core/app/index.js +10 -1
- package/dist/core/build/index.js +0 -1
- package/dist/core/build/internal.js +8 -7
- package/dist/core/build/static-build.js +2 -2
- package/dist/core/build/{types.d.js → types.js} +0 -0
- package/dist/core/build/vite-plugin-hoisted-scripts.js +5 -1
- package/dist/core/build/vite-plugin-ssr.js +5 -2
- package/dist/core/config.js +37 -3
- package/dist/core/create-vite.js +2 -1
- package/dist/core/dev/index.js +4 -1
- package/dist/core/errors.js +8 -0
- package/dist/core/messages.js +6 -2
- package/dist/core/render/dev/index.js +3 -7
- package/dist/core/routing/manifest/create.js +2 -13
- package/dist/core/routing/manifest/generator.js +15 -0
- package/dist/core/routing/manifest/serialization.js +35 -18
- package/dist/runtime/server/hydration.js +2 -3
- package/dist/runtime/server/index.js +13 -23
- package/dist/types/@types/astro.d.ts +26 -23
- package/dist/types/core/add/consts.d.ts +1 -1
- package/dist/types/core/app/types.d.ts +4 -1
- package/dist/types/core/build/internal.d.ts +1 -2
- package/dist/types/core/build/types.d.ts +34 -0
- package/dist/types/core/config.d.ts +18 -7
- package/dist/types/core/dev/index.d.ts +2 -0
- package/dist/types/core/errors.d.ts +1 -0
- package/dist/types/core/routing/manifest/generator.d.ts +2 -0
- package/dist/types/core/routing/manifest/serialization.d.ts +2 -2
- package/dist/types/vite-plugin-astro/compile.d.ts +9 -3
- package/dist/vite-plugin-astro/compile.js +13 -6
- package/dist/vite-plugin-astro/hmr.js +8 -1
- package/dist/vite-plugin-astro/index.js +23 -10
- package/dist/vite-plugin-astro-server/index.js +2 -2
- package/dist/vite-plugin-env/index.js +5 -3
- package/dist/vite-plugin-markdown/index.js +3 -3
- package/package.json +20 -18
package/dist/cli/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import preview from "../core/preview/index.js";
|
|
|
11
11
|
import { check } from "./check.js";
|
|
12
12
|
import { openInBrowser } from "./open.js";
|
|
13
13
|
import * as telemetryHandler from "./telemetry.js";
|
|
14
|
-
import {
|
|
14
|
+
import { openConfig } from "../core/config.js";
|
|
15
15
|
import { printHelp, formatErrorMessage, formatConfigErrorMessage } from "../core/messages.js";
|
|
16
16
|
import { createSafeError } from "../core/util.js";
|
|
17
17
|
function printAstroHelp() {
|
|
@@ -40,7 +40,7 @@ function printAstroHelp() {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
async function printVersion() {
|
|
43
|
-
const version = "1.0.0-beta.
|
|
43
|
+
const version = "1.0.0-beta.29";
|
|
44
44
|
console.log();
|
|
45
45
|
console.log(` ${colors.bgGreen(colors.black(` astro `))} ${colors.green(`v${version}`)}`);
|
|
46
46
|
}
|
|
@@ -83,7 +83,7 @@ async function cli(args) {
|
|
|
83
83
|
} else if (flags.silent) {
|
|
84
84
|
logging.level = "silent";
|
|
85
85
|
}
|
|
86
|
-
const telemetry = new AstroTelemetry({ version: "1.0.0-beta.
|
|
86
|
+
const telemetry = new AstroTelemetry({ version: "1.0.0-beta.29" });
|
|
87
87
|
if (cmd === "telemetry") {
|
|
88
88
|
try {
|
|
89
89
|
const subcommand = (_a = flags._[3]) == null ? void 0 : _a.toString();
|
|
@@ -97,7 +97,7 @@ async function cli(args) {
|
|
|
97
97
|
try {
|
|
98
98
|
const packages = flags._.slice(3);
|
|
99
99
|
telemetry.record(event.eventCliSession({
|
|
100
|
-
astroVersion: "1.0.0-beta.
|
|
100
|
+
astroVersion: "1.0.0-beta.29",
|
|
101
101
|
cliCommand: "add"
|
|
102
102
|
}));
|
|
103
103
|
return await add(packages, { cwd: root, flags, logging, telemetry });
|
|
@@ -107,9 +107,9 @@ async function cli(args) {
|
|
|
107
107
|
}
|
|
108
108
|
case "dev": {
|
|
109
109
|
try {
|
|
110
|
-
const
|
|
111
|
-
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.
|
|
112
|
-
await devServer(
|
|
110
|
+
const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
|
|
111
|
+
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.29", cliCommand: "dev" }, userConfig, flags));
|
|
112
|
+
await devServer(astroConfig, { logging, telemetry });
|
|
113
113
|
return await new Promise(() => {
|
|
114
114
|
});
|
|
115
115
|
} catch (err) {
|
|
@@ -118,24 +118,24 @@ async function cli(args) {
|
|
|
118
118
|
}
|
|
119
119
|
case "build": {
|
|
120
120
|
try {
|
|
121
|
-
const
|
|
122
|
-
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.
|
|
123
|
-
return await build(
|
|
121
|
+
const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
|
|
122
|
+
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.29", cliCommand: "build" }, userConfig, flags));
|
|
123
|
+
return await build(astroConfig, { logging, telemetry });
|
|
124
124
|
} catch (err) {
|
|
125
125
|
return throwAndExit(err);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
case "check": {
|
|
129
|
-
const
|
|
130
|
-
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.
|
|
131
|
-
const ret = await check(
|
|
129
|
+
const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
|
|
130
|
+
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.29", cliCommand: "check" }, userConfig, flags));
|
|
131
|
+
const ret = await check(astroConfig);
|
|
132
132
|
return process.exit(ret);
|
|
133
133
|
}
|
|
134
134
|
case "preview": {
|
|
135
135
|
try {
|
|
136
|
-
const
|
|
137
|
-
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.
|
|
138
|
-
const server = await preview(
|
|
136
|
+
const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
|
|
137
|
+
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.29", cliCommand: "preview" }, userConfig, flags));
|
|
138
|
+
const server = await preview(astroConfig, { logging, telemetry });
|
|
139
139
|
return await server.closed();
|
|
140
140
|
} catch (err) {
|
|
141
141
|
return throwAndExit(err);
|
|
@@ -144,7 +144,7 @@ async function cli(args) {
|
|
|
144
144
|
case "docs": {
|
|
145
145
|
try {
|
|
146
146
|
await telemetry.record(event.eventCliSession({
|
|
147
|
-
astroVersion: "1.0.0-beta.
|
|
147
|
+
astroVersion: "1.0.0-beta.29",
|
|
148
148
|
cliCommand: "docs"
|
|
149
149
|
}));
|
|
150
150
|
return await openInBrowser("https://docs.astro.build/");
|
package/dist/core/add/consts.js
CHANGED
|
@@ -20,7 +20,7 @@ const CONFIG_STUB = `import { defineConfig } from 'astro/config';
|
|
|
20
20
|
|
|
21
21
|
export default defineConfig({});`;
|
|
22
22
|
const TAILWIND_CONFIG_STUB = `module.exports = {
|
|
23
|
-
content: ['./src/**/*.{astro,html,js,jsx,svelte,ts,tsx,vue}'],
|
|
23
|
+
content: ['./src/**/*.{astro,html,js,jsx,md,svelte,ts,tsx,vue}'],
|
|
24
24
|
theme: {
|
|
25
25
|
extend: {},
|
|
26
26
|
},
|
package/dist/core/app/index.js
CHANGED
|
@@ -92,7 +92,16 @@ renderPage_fn = async function(request, routeData, mod) {
|
|
|
92
92
|
const renderers = manifest.renderers;
|
|
93
93
|
const info = __privateGet(this, _routeDataToRouteInfo).get(routeData);
|
|
94
94
|
const links = createLinkStylesheetElementSet(info.links, manifest.site);
|
|
95
|
-
const
|
|
95
|
+
const filteredScripts = info.scripts.filter((script) => typeof script !== "string" && (script == null ? void 0 : script.stage) !== "head-inline");
|
|
96
|
+
const scripts = createModuleScriptElementWithSrcSet(filteredScripts, manifest.site);
|
|
97
|
+
for (const script of info.scripts) {
|
|
98
|
+
if (typeof script !== "string" && script.stage === "head-inline") {
|
|
99
|
+
scripts.add({
|
|
100
|
+
props: {},
|
|
101
|
+
children: script.children
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
96
105
|
const result = await render({
|
|
97
106
|
links,
|
|
98
107
|
logging: __privateGet(this, _logging),
|
package/dist/core/build/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { prependForwardSlash } from "../path.js";
|
|
1
2
|
import { viteID } from "../util.js";
|
|
2
3
|
function createBuildInternals() {
|
|
3
4
|
const pureCSSChunks = /* @__PURE__ */ new Set();
|
|
@@ -19,15 +20,14 @@ function trackPageData(internals, component, pageData, componentModuleId, compon
|
|
|
19
20
|
internals.pagesByComponent.set(component, pageData);
|
|
20
21
|
internals.pagesByViteID.set(viteID(componentURL), pageData);
|
|
21
22
|
}
|
|
22
|
-
function trackClientOnlyPageDatas(internals, pageData, clientOnlys
|
|
23
|
+
function trackClientOnlyPageDatas(internals, pageData, clientOnlys) {
|
|
23
24
|
for (const clientOnlyComponent of clientOnlys) {
|
|
24
|
-
const coPath = viteID(new URL("." + clientOnlyComponent, astroConfig.root));
|
|
25
25
|
let pageDataSet;
|
|
26
|
-
if (internals.pagesByClientOnly.has(
|
|
27
|
-
pageDataSet = internals.pagesByClientOnly.get(
|
|
26
|
+
if (internals.pagesByClientOnly.has(clientOnlyComponent)) {
|
|
27
|
+
pageDataSet = internals.pagesByClientOnly.get(clientOnlyComponent);
|
|
28
28
|
} else {
|
|
29
29
|
pageDataSet = /* @__PURE__ */ new Set();
|
|
30
|
-
internals.pagesByClientOnly.set(
|
|
30
|
+
internals.pagesByClientOnly.set(clientOnlyComponent, pageDataSet);
|
|
31
31
|
}
|
|
32
32
|
pageDataSet.add(pageData);
|
|
33
33
|
}
|
|
@@ -44,8 +44,9 @@ function* getPageDatasByClientOnlyChunk(internals, chunk) {
|
|
|
44
44
|
const pagesByClientOnly = internals.pagesByClientOnly;
|
|
45
45
|
if (pagesByClientOnly.size) {
|
|
46
46
|
for (const [modulePath] of Object.entries(chunk.modules)) {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const pathname = `/@fs${prependForwardSlash(modulePath)}`;
|
|
48
|
+
if (pagesByClientOnly.has(pathname)) {
|
|
49
|
+
for (const pageData of pagesByClientOnly.get(pathname)) {
|
|
49
50
|
yield pageData;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -54,7 +54,7 @@ async function staticBuild(opts) {
|
|
|
54
54
|
const [renderers, mod] = pageData.preload;
|
|
55
55
|
const metadata = mod.$$metadata;
|
|
56
56
|
const clientOnlys = Array.from(metadata.clientOnlyComponentPaths());
|
|
57
|
-
trackClientOnlyPageDatas(internals, pageData, clientOnlys
|
|
57
|
+
trackClientOnlyPageDatas(internals, pageData, clientOnlys);
|
|
58
58
|
const topLevelImports = /* @__PURE__ */ new Set([
|
|
59
59
|
...metadata.hydratedComponentPaths(),
|
|
60
60
|
...clientOnlys,
|
|
@@ -133,7 +133,7 @@ async function ssrBuild(opts, internals, input) {
|
|
|
133
133
|
root: viteConfig.root,
|
|
134
134
|
envPrefix: "PUBLIC_",
|
|
135
135
|
server: viteConfig.server,
|
|
136
|
-
base: astroConfig.
|
|
136
|
+
base: astroConfig.base,
|
|
137
137
|
ssr: viteConfig.ssr,
|
|
138
138
|
resolve: viteConfig.resolve
|
|
139
139
|
};
|
|
File without changes
|
|
@@ -15,7 +15,11 @@ function vitePluginHoistedScripts(astroConfig, internals) {
|
|
|
15
15
|
if (virtualHoistedEntry(id)) {
|
|
16
16
|
let code = "";
|
|
17
17
|
for (let path of internals.hoistedScriptIdToHoistedMap.get(id)) {
|
|
18
|
-
|
|
18
|
+
let importPath = path;
|
|
19
|
+
if (importPath.startsWith("/@fs")) {
|
|
20
|
+
importPath = importPath.slice("/@fs".length);
|
|
21
|
+
}
|
|
22
|
+
code += `import "${importPath}";`;
|
|
19
23
|
}
|
|
20
24
|
return {
|
|
21
25
|
code
|
|
@@ -81,8 +81,11 @@ function buildManifest(opts, internals, staticFiles) {
|
|
|
81
81
|
routes.push({
|
|
82
82
|
file: "",
|
|
83
83
|
links: Array.from(pageData.css),
|
|
84
|
-
scripts
|
|
85
|
-
|
|
84
|
+
scripts: [
|
|
85
|
+
...scripts,
|
|
86
|
+
...astroConfig._ctx.scripts.filter((script) => script.stage === "head-inline").map(({ stage, content }) => ({ stage, children: content }))
|
|
87
|
+
],
|
|
88
|
+
routeData: serializeRouteData(pageData.route, astroConfig.trailingSlash)
|
|
86
89
|
});
|
|
87
90
|
}
|
|
88
91
|
const entryModules = Object.fromEntries(internals.entrySpecifierToBundleMap.entries());
|
package/dist/core/config.js
CHANGED
|
@@ -27,7 +27,7 @@ import load, { resolve, ProloadError } from "@proload/core";
|
|
|
27
27
|
import loadTypeScript from "@proload/plugin-tsm";
|
|
28
28
|
import postcssrc from "postcss-load-config";
|
|
29
29
|
import { arraify, isObject } from "./util.js";
|
|
30
|
-
import { appendForwardSlash, trimSlashes } from "./path.js";
|
|
30
|
+
import { appendForwardSlash, prependForwardSlash, trimSlashes } from "./path.js";
|
|
31
31
|
load.use([loadTypeScript]);
|
|
32
32
|
async function resolvePostcssConfig(inlineOptions, root) {
|
|
33
33
|
if (isObject(inlineOptions)) {
|
|
@@ -72,7 +72,7 @@ const AstroConfigSchema = z.object({
|
|
|
72
72
|
site: z.string().url().optional().transform((val) => val ? appendForwardSlash(val) : val).refine((val) => !val || new URL(val).pathname.length <= 1, {
|
|
73
73
|
message: '"site" must be a valid URL origin (ex: "https://example.com") but cannot contain a URL path (ex: "https://example.com/blog"). Use "base" to configure your deployed URL path'
|
|
74
74
|
}),
|
|
75
|
-
base: z.string().optional().default("/").transform((val) => appendForwardSlash(trimSlashes(val))),
|
|
75
|
+
base: z.string().optional().default("/").transform((val) => prependForwardSlash(appendForwardSlash(trimSlashes(val)))),
|
|
76
76
|
trailingSlash: z.union([z.literal("always"), z.literal("never"), z.literal("ignore")]).optional().default("ignore"),
|
|
77
77
|
build: z.object({
|
|
78
78
|
format: z.union([z.literal("file"), z.literal("directory")]).optional().default("directory")
|
|
@@ -110,7 +110,7 @@ const AstroConfigSchema = z.object({
|
|
|
110
110
|
z.tuple([z.custom((data) => typeof data === "function"), z.any()])
|
|
111
111
|
]).array().default([])
|
|
112
112
|
}).default({}),
|
|
113
|
-
vite: z.
|
|
113
|
+
vite: z.custom((data) => data instanceof Object && !Array.isArray(data)).default({}),
|
|
114
114
|
experimental: z.object({
|
|
115
115
|
ssr: z.boolean().optional().default(false),
|
|
116
116
|
integrations: z.boolean().optional().default(false)
|
|
@@ -237,6 +237,39 @@ async function resolveConfigURL(configOptions) {
|
|
|
237
237
|
return pathToFileURL(configPath);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
+
async function openConfig(configOptions) {
|
|
241
|
+
const root = configOptions.cwd ? path.resolve(configOptions.cwd) : process.cwd();
|
|
242
|
+
const flags = resolveFlags(configOptions.flags || {});
|
|
243
|
+
let userConfig = {};
|
|
244
|
+
let userConfigPath;
|
|
245
|
+
if (flags == null ? void 0 : flags.config) {
|
|
246
|
+
userConfigPath = /^\.*\//.test(flags.config) ? flags.config : `./${flags.config}`;
|
|
247
|
+
userConfigPath = fileURLToPath(new URL(userConfigPath, appendForwardSlash(pathToFileURL(root).toString())));
|
|
248
|
+
}
|
|
249
|
+
let config;
|
|
250
|
+
try {
|
|
251
|
+
config = await load("astro", {
|
|
252
|
+
mustExist: !!userConfigPath,
|
|
253
|
+
cwd: root,
|
|
254
|
+
filePath: userConfigPath
|
|
255
|
+
});
|
|
256
|
+
} catch (err) {
|
|
257
|
+
if (err instanceof ProloadError && flags.config) {
|
|
258
|
+
throw new Error(`Unable to resolve --config "${flags.config}"! Does the file exist?`);
|
|
259
|
+
}
|
|
260
|
+
throw err;
|
|
261
|
+
}
|
|
262
|
+
if (config) {
|
|
263
|
+
userConfig = config.value;
|
|
264
|
+
}
|
|
265
|
+
const astroConfig = await resolveConfig(userConfig, root, flags, configOptions.cmd);
|
|
266
|
+
return {
|
|
267
|
+
astroConfig,
|
|
268
|
+
userConfig,
|
|
269
|
+
flags,
|
|
270
|
+
root
|
|
271
|
+
};
|
|
272
|
+
}
|
|
240
273
|
async function loadConfig(configOptions) {
|
|
241
274
|
const root = configOptions.cwd ? path.resolve(configOptions.cwd) : process.cwd();
|
|
242
275
|
const flags = resolveFlags(configOptions.flags || {});
|
|
@@ -305,6 +338,7 @@ export {
|
|
|
305
338
|
LEGACY_ASTRO_CONFIG_KEYS,
|
|
306
339
|
loadConfig,
|
|
307
340
|
mergeConfig,
|
|
341
|
+
openConfig,
|
|
308
342
|
resolveConfig,
|
|
309
343
|
resolveConfigURL,
|
|
310
344
|
validateConfig
|
package/dist/core/create-vite.js
CHANGED
|
@@ -32,7 +32,8 @@ async function createVite(commandConfig, { astroConfig, logging, mode }) {
|
|
|
32
32
|
clearScreen: false,
|
|
33
33
|
logLevel: "warn",
|
|
34
34
|
optimizeDeps: {
|
|
35
|
-
entries: ["src/**/*"]
|
|
35
|
+
entries: ["src/**/*"],
|
|
36
|
+
exclude: ["node-fetch"]
|
|
36
37
|
},
|
|
37
38
|
plugins: [
|
|
38
39
|
configAliasVitePlugin({ config: astroConfig }),
|
package/dist/core/dev/index.js
CHANGED
|
@@ -36,13 +36,16 @@ async function dev(config, options) {
|
|
|
36
36
|
site,
|
|
37
37
|
https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
|
|
38
38
|
}));
|
|
39
|
-
const currentVersion = "1.0.0-beta.
|
|
39
|
+
const currentVersion = "1.0.0-beta.29";
|
|
40
40
|
if (currentVersion.includes("-")) {
|
|
41
41
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
42
42
|
}
|
|
43
43
|
await runHookServerStart({ config, address: devServerAddressInfo });
|
|
44
44
|
return {
|
|
45
45
|
address: devServerAddressInfo,
|
|
46
|
+
get watcher() {
|
|
47
|
+
return viteServer.watcher;
|
|
48
|
+
},
|
|
46
49
|
stop: async () => {
|
|
47
50
|
await viteServer.close();
|
|
48
51
|
await runHookServerDone({ config });
|
package/dist/core/errors.js
CHANGED
|
@@ -12,6 +12,12 @@ function fixViteErrorMessage(_err, server) {
|
|
|
12
12
|
}
|
|
13
13
|
return err;
|
|
14
14
|
}
|
|
15
|
+
function generateHint(err) {
|
|
16
|
+
if (/Unknown file extension \"\.(jsx|vue|svelte|astro)\" for /.test(err.message)) {
|
|
17
|
+
return "You likely need to add this package to `vite.ssr.noExternal` in your astro config file.";
|
|
18
|
+
}
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
15
21
|
function collectErrorMetadata(e) {
|
|
16
22
|
if (e.stack) {
|
|
17
23
|
e.stack = eol.lf(e.stack);
|
|
@@ -34,8 +40,10 @@ function collectErrorMetadata(e) {
|
|
|
34
40
|
if (pluginName) {
|
|
35
41
|
err.plugin = pluginName;
|
|
36
42
|
}
|
|
43
|
+
err.hint = generateHint(err);
|
|
37
44
|
return err;
|
|
38
45
|
}
|
|
46
|
+
e.hint = generateHint(e);
|
|
39
47
|
return e;
|
|
40
48
|
}
|
|
41
49
|
export {
|
package/dist/core/messages.js
CHANGED
|
@@ -47,7 +47,7 @@ function devStart({
|
|
|
47
47
|
https,
|
|
48
48
|
site
|
|
49
49
|
}) {
|
|
50
|
-
const version = "1.0.0-beta.
|
|
50
|
+
const version = "1.0.0-beta.29";
|
|
51
51
|
const rootPath = site ? site.pathname : "/";
|
|
52
52
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
53
53
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
@@ -157,6 +157,10 @@ ${errorList.join("\n")}`;
|
|
|
157
157
|
function formatErrorMessage(_err, args = []) {
|
|
158
158
|
const err = collectErrorMetadata(_err);
|
|
159
159
|
args.push(`${bgRed(black(` error `))}${red(bold(padMultilineString(err.message)))}`);
|
|
160
|
+
if (err.hint) {
|
|
161
|
+
args.push(` ${bold("Hint:")}`);
|
|
162
|
+
args.push(yellow(padMultilineString(err.hint, 4)));
|
|
163
|
+
}
|
|
160
164
|
if (err.id) {
|
|
161
165
|
args.push(` ${bold("File:")}`);
|
|
162
166
|
args.push(red(` ${err.id}`));
|
|
@@ -199,7 +203,7 @@ function printHelp({
|
|
|
199
203
|
};
|
|
200
204
|
let message = [];
|
|
201
205
|
if (headline) {
|
|
202
|
-
message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"1.0.0-beta.
|
|
206
|
+
message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"1.0.0-beta.29"}`)} ${headline}`);
|
|
203
207
|
}
|
|
204
208
|
if (usage) {
|
|
205
209
|
message.push(linebreak(), ` ${green(commandName)} ${bold(usage)}`);
|
|
@@ -105,14 +105,10 @@ async function render(renderers, mod, ssrOpts) {
|
|
|
105
105
|
pathname,
|
|
106
106
|
scripts,
|
|
107
107
|
async resolve(s) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return resolvedPath.replace(/.*?node_modules\/\.vite/, "/node_modules/.vite");
|
|
108
|
+
if (s.startsWith("/@fs")) {
|
|
109
|
+
return s;
|
|
111
110
|
}
|
|
112
|
-
|
|
113
|
-
return "/@id" + prependForwardSlash(resolvedUrl);
|
|
114
|
-
}
|
|
115
|
-
return "/@fs" + prependForwardSlash(resolvedPath);
|
|
111
|
+
return "/@id" + prependForwardSlash(s);
|
|
116
112
|
},
|
|
117
113
|
renderers,
|
|
118
114
|
request,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { compile } from "path-to-regexp";
|
|
4
3
|
import slash from "slash";
|
|
5
4
|
import { fileURLToPath } from "url";
|
|
6
5
|
import { warn } from "../../logger/core.js";
|
|
7
6
|
import { resolvePages } from "../../util.js";
|
|
7
|
+
import { getRouteGenerator } from "./generator.js";
|
|
8
8
|
function countOccurrences(needle, haystack) {
|
|
9
9
|
let count = 0;
|
|
10
10
|
for (let i = 0; i < haystack.length; i += 1) {
|
|
@@ -50,17 +50,6 @@ function getTrailingSlashPattern(addTrailingSlash) {
|
|
|
50
50
|
}
|
|
51
51
|
return "\\/?$";
|
|
52
52
|
}
|
|
53
|
-
function getGenerator(segments, addTrailingSlash) {
|
|
54
|
-
const template = segments.map((segment) => {
|
|
55
|
-
return segment[0].spread ? `/:${segment[0].content.slice(3)}(.*)?` : "/" + segment.map((part) => {
|
|
56
|
-
if (part)
|
|
57
|
-
return part.dynamic ? `:${part.content}` : part.content.normalize().replace(/\?/g, "%3F").replace(/#/g, "%23").replace(/%5B/g, "[").replace(/%5D/g, "]").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
58
|
-
}).join("");
|
|
59
|
-
}).join("");
|
|
60
|
-
const trailing = addTrailingSlash !== "never" && segments.length ? "/" : "";
|
|
61
|
-
const toPath = compile(template + trailing);
|
|
62
|
-
return toPath;
|
|
63
|
-
}
|
|
64
53
|
function isSpread(str) {
|
|
65
54
|
const spreadPattern = /\[\.{3}/g;
|
|
66
55
|
return spreadPattern.test(str);
|
|
@@ -184,7 +173,7 @@ function createRouteManifest({ config, cwd }, logging) {
|
|
|
184
173
|
const component = item.file;
|
|
185
174
|
const trailingSlash = item.isPage ? config.trailingSlash : "never";
|
|
186
175
|
const pattern = getPattern(segments, trailingSlash);
|
|
187
|
-
const generate =
|
|
176
|
+
const generate = getRouteGenerator(segments, trailingSlash);
|
|
188
177
|
const pathname = segments.every((segment) => segment.length === 1 && !segment[0].dynamic) ? `/${segments.map((segment) => segment[0].content).join("/")}` : null;
|
|
189
178
|
routes.push({
|
|
190
179
|
type: item.isPage ? "page" : "endpoint",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { compile } from "path-to-regexp";
|
|
2
|
+
function getRouteGenerator(segments, addTrailingSlash) {
|
|
3
|
+
const template = segments.map((segment) => {
|
|
4
|
+
return segment[0].spread ? `/:${segment[0].content.slice(3)}(.*)?` : "/" + segment.map((part) => {
|
|
5
|
+
if (part)
|
|
6
|
+
return part.dynamic ? `:${part.content}` : part.content.normalize().replace(/\?/g, "%3F").replace(/#/g, "%23").replace(/%5B/g, "[").replace(/%5D/g, "]").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7
|
+
}).join("");
|
|
8
|
+
}).join("");
|
|
9
|
+
const trailing = addTrailingSlash !== "never" && segments.length ? "/" : "";
|
|
10
|
+
const toPath = compile(template + trailing);
|
|
11
|
+
return toPath;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
getRouteGenerator
|
|
15
|
+
};
|
|
@@ -1,23 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { getRouteGenerator } from "./generator.js";
|
|
21
|
+
function serializeRouteData(routeData, trailingSlash) {
|
|
22
|
+
return __spreadProps(__spreadValues({}, routeData), {
|
|
23
|
+
generate: void 0,
|
|
24
|
+
pattern: routeData.pattern.source,
|
|
25
|
+
_meta: { trailingSlash }
|
|
26
|
+
});
|
|
16
27
|
}
|
|
17
28
|
function deserializeRouteData(rawRouteData) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
29
|
+
return {
|
|
30
|
+
type: rawRouteData.type,
|
|
31
|
+
pattern: new RegExp(rawRouteData.pattern),
|
|
32
|
+
params: rawRouteData.params,
|
|
33
|
+
component: rawRouteData.component,
|
|
34
|
+
generate: getRouteGenerator(rawRouteData.segments, rawRouteData._meta.trailingSlash),
|
|
35
|
+
pathname: rawRouteData.pathname || void 0,
|
|
36
|
+
segments: rawRouteData.segments
|
|
37
|
+
};
|
|
21
38
|
}
|
|
22
39
|
export {
|
|
23
40
|
deserializeRouteData,
|
|
@@ -57,9 +57,8 @@ async function generateHydrateScript(scriptOptions, metadata) {
|
|
|
57
57
|
if (!componentExport) {
|
|
58
58
|
throw new Error(`Unable to resolve a componentExport for "${metadata.displayName}"! Please open an issue.`);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return (el, children) => hydrate(el)(Component, ${serializeProps(props)}, children);
|
|
60
|
+
const hydrationSource = renderer.clientEntrypoint ? `const [{ ${componentExport.value}: Component }, { default: hydrate }] = await Promise.all([import("${await result.resolve(componentUrl)}"), import("${await result.resolve(renderer.clientEntrypoint)}")]);
|
|
61
|
+
return (el, children) => hydrate(el)(Component, ${serializeProps(props)}, children, ${JSON.stringify({ client: hydrate })});
|
|
63
62
|
` : `await import("${await result.resolve(componentUrl)}");
|
|
64
63
|
return () => {};
|
|
65
64
|
`;
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
1
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
2
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
3
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
4
|
var __objRest = (source, exclude) => {
|
|
21
5
|
var target = {};
|
|
22
6
|
for (var prop in source)
|
|
@@ -150,12 +134,20 @@ Did you mean to add ${formatList(probableRendererNames.map((r) => "`" + r + "`")
|
|
|
150
134
|
const children = await renderSlot(result, slots == null ? void 0 : slots.default);
|
|
151
135
|
let renderer;
|
|
152
136
|
if (metadata.hydrate !== "only") {
|
|
137
|
+
let error;
|
|
153
138
|
for (const r of renderers) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
139
|
+
try {
|
|
140
|
+
if (await r.ssr.check(Component, props, children)) {
|
|
141
|
+
renderer = r;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
} catch (e) {
|
|
145
|
+
error ?? (error = e);
|
|
157
146
|
}
|
|
158
147
|
}
|
|
148
|
+
if (error) {
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
159
151
|
if (!renderer && typeof HTMLElement === "function" && componentIsHTMLElement(Component)) {
|
|
160
152
|
const output = renderHTMLElement(result, Component, _props, slots);
|
|
161
153
|
return output;
|
|
@@ -362,7 +354,7 @@ Update your code to remove this warning.`);
|
|
|
362
354
|
}
|
|
363
355
|
}
|
|
364
356
|
});
|
|
365
|
-
return
|
|
357
|
+
return handler.call(mod, proxy, request);
|
|
366
358
|
}
|
|
367
359
|
async function replaceHeadInjection(result, html) {
|
|
368
360
|
let template = html;
|
|
@@ -419,9 +411,7 @@ async function renderHead(result) {
|
|
|
419
411
|
if ("data-astro-component-hydration" in script.props) {
|
|
420
412
|
needsHydrationStyles = true;
|
|
421
413
|
}
|
|
422
|
-
return renderElement("script",
|
|
423
|
-
props: __spreadProps(__spreadValues({}, script.props), { "astro-script": result._metadata.pathname + "/script-" + i })
|
|
424
|
-
}));
|
|
414
|
+
return renderElement("script", script);
|
|
425
415
|
});
|
|
426
416
|
if (needsHydrationStyles) {
|
|
427
417
|
styles.push(renderElement("style", {
|
|
@@ -234,6 +234,9 @@ declare type ServerConfig = {
|
|
|
234
234
|
*/
|
|
235
235
|
port?: number;
|
|
236
236
|
};
|
|
237
|
+
export interface ViteUserConfig extends vite.UserConfig {
|
|
238
|
+
ssr?: vite.SSROptions;
|
|
239
|
+
}
|
|
237
240
|
/**
|
|
238
241
|
* Astro User Config
|
|
239
242
|
* Docs: https://docs.astro.build/reference/configuration-reference/
|
|
@@ -348,7 +351,7 @@ export interface AstroUserConfig {
|
|
|
348
351
|
* @docs
|
|
349
352
|
* @name trailingSlash
|
|
350
353
|
* @type {('always' | 'never' | 'ignore')}
|
|
351
|
-
* @default `'
|
|
354
|
+
* @default `'ignore'`
|
|
352
355
|
* @see buildOptions.pageUrlFormat
|
|
353
356
|
* @description
|
|
354
357
|
*
|
|
@@ -402,11 +405,11 @@ export interface AstroUserConfig {
|
|
|
402
405
|
* @name Server Options
|
|
403
406
|
* @description
|
|
404
407
|
*
|
|
405
|
-
* Customize the Astro dev server, used by both `astro dev` and `astro
|
|
408
|
+
* Customize the Astro dev server, used by both `astro dev` and `astro preview`.
|
|
406
409
|
*
|
|
407
410
|
* ```js
|
|
408
411
|
* {
|
|
409
|
-
* server: {port: 1234, host: true}
|
|
412
|
+
* server: { port: 1234, host: true}
|
|
410
413
|
* }
|
|
411
414
|
* ```
|
|
412
415
|
*
|
|
@@ -415,7 +418,7 @@ export interface AstroUserConfig {
|
|
|
415
418
|
* ```js
|
|
416
419
|
* {
|
|
417
420
|
* // Example: Use the function syntax to customize based on command
|
|
418
|
-
* server: (command) => ({port: command === 'dev' ? 3000 : 4000})
|
|
421
|
+
* server: (command) => ({ port: command === 'dev' ? 3000 : 4000 })
|
|
419
422
|
* }
|
|
420
423
|
* ```
|
|
421
424
|
*/
|
|
@@ -426,10 +429,10 @@ export interface AstroUserConfig {
|
|
|
426
429
|
* @default `false`
|
|
427
430
|
* @version 0.24.0
|
|
428
431
|
* @description
|
|
429
|
-
* Set which network IP addresses the
|
|
432
|
+
* Set which network IP addresses the server should listen on (i.e. non-localhost IPs).
|
|
430
433
|
* - `false` - do not expose on a network IP address
|
|
431
434
|
* - `true` - listen on all addresses, including LAN and public addresses
|
|
432
|
-
* - `[custom-address]` - expose on a network IP address at `[custom-address]`
|
|
435
|
+
* - `[custom-address]` - expose on a network IP address at `[custom-address]` (ex: `192.168.0.1`)
|
|
433
436
|
*/
|
|
434
437
|
/**
|
|
435
438
|
* @docs
|
|
@@ -437,9 +440,15 @@ export interface AstroUserConfig {
|
|
|
437
440
|
* @type {number}
|
|
438
441
|
* @default `3000`
|
|
439
442
|
* @description
|
|
440
|
-
* Set which port the
|
|
443
|
+
* Set which port the server should listen on.
|
|
441
444
|
*
|
|
442
445
|
* If the given port is already in use, Astro will automatically try the next available port.
|
|
446
|
+
*
|
|
447
|
+
* ```js
|
|
448
|
+
* {
|
|
449
|
+
* server: { port: 8080 }
|
|
450
|
+
* }
|
|
451
|
+
* ```
|
|
443
452
|
*/
|
|
444
453
|
server?: ServerConfig | ((options: {
|
|
445
454
|
command: 'dev' | 'preview';
|
|
@@ -521,7 +530,7 @@ export interface AstroUserConfig {
|
|
|
521
530
|
* {
|
|
522
531
|
* markdown: {
|
|
523
532
|
* // Example: The default set of remark plugins used by Astro
|
|
524
|
-
* remarkPlugins: ['remark-
|
|
533
|
+
* remarkPlugins: ['remark-gfm', 'remark-smartypants'],
|
|
525
534
|
* },
|
|
526
535
|
* };
|
|
527
536
|
* ```
|
|
@@ -540,7 +549,7 @@ export interface AstroUserConfig {
|
|
|
540
549
|
* {
|
|
541
550
|
* markdown: {
|
|
542
551
|
* // Example: The default set of rehype plugins used by Astro
|
|
543
|
-
* rehypePlugins: [
|
|
552
|
+
* rehypePlugins: [],
|
|
544
553
|
* },
|
|
545
554
|
* };
|
|
546
555
|
* ```
|
|
@@ -607,9 +616,7 @@ export interface AstroUserConfig {
|
|
|
607
616
|
* }
|
|
608
617
|
* ```
|
|
609
618
|
*/
|
|
610
|
-
vite?:
|
|
611
|
-
ssr?: vite.SSROptions;
|
|
612
|
-
};
|
|
619
|
+
vite?: ViteUserConfig;
|
|
613
620
|
experimental?: {
|
|
614
621
|
/**
|
|
615
622
|
* Enable support for 3rd-party integrations.
|
|
@@ -695,8 +702,8 @@ export declare type GetHydrateCallback = () => Promise<(element: Element, innerH
|
|
|
695
702
|
* getStaticPaths() options
|
|
696
703
|
* Docs: https://docs.astro.build/reference/api-reference/#getstaticpaths
|
|
697
704
|
*/ export interface GetStaticPathsOptions {
|
|
698
|
-
paginate
|
|
699
|
-
rss
|
|
705
|
+
paginate: PaginateFunction;
|
|
706
|
+
rss: (...args: any[]) => any;
|
|
700
707
|
}
|
|
701
708
|
export declare type GetStaticPathsItem = {
|
|
702
709
|
params: Params;
|
|
@@ -794,16 +801,9 @@ export interface APIContext {
|
|
|
794
801
|
export interface EndpointOutput<Output extends Body = Body> {
|
|
795
802
|
body: Output;
|
|
796
803
|
}
|
|
797
|
-
|
|
798
|
-
(context: APIContext): EndpointOutput | Response;
|
|
799
|
-
/**
|
|
800
|
-
* @deprecated
|
|
801
|
-
* Use { context: APIRouteContext } object instead.
|
|
802
|
-
*/
|
|
803
|
-
(params: Params, request: Request): EndpointOutput | Response;
|
|
804
|
-
}
|
|
804
|
+
export declare type APIRoute = (context: APIContext) => EndpointOutput | Response;
|
|
805
805
|
export interface EndpointHandler {
|
|
806
|
-
[method: string]: APIRoute;
|
|
806
|
+
[method: string]: APIRoute | ((params: Params, request: Request) => EndpointOutput | Response);
|
|
807
807
|
}
|
|
808
808
|
export interface AstroRenderer {
|
|
809
809
|
/** Name of the renderer. */
|
|
@@ -886,6 +886,9 @@ export interface RouteData {
|
|
|
886
886
|
export declare type SerializedRouteData = Omit<RouteData, 'generate' | 'pattern'> & {
|
|
887
887
|
generate: undefined;
|
|
888
888
|
pattern: string;
|
|
889
|
+
_meta: {
|
|
890
|
+
trailingSlash: AstroConfig['trailingSlash'];
|
|
891
|
+
};
|
|
889
892
|
};
|
|
890
893
|
export declare type RuntimeMode = 'development' | 'production';
|
|
891
894
|
/**
|
|
@@ -8,4 +8,4 @@ export declare const FIRST_PARTY_ADDONS: {
|
|
|
8
8
|
}[];
|
|
9
9
|
export declare const ALIASES: Map<string, string>;
|
|
10
10
|
export declare const CONFIG_STUB = "import { defineConfig } from 'astro/config';\n\nexport default defineConfig({});";
|
|
11
|
-
export declare const TAILWIND_CONFIG_STUB = "module.exports = {\n\tcontent: ['./src/**/*.{astro,html,js,jsx,svelte,ts,tsx,vue}'],\n\ttheme: {\n\t\textend: {},\n\t},\n\tplugins: [],\n}\n";
|
|
11
|
+
export declare const TAILWIND_CONFIG_STUB = "module.exports = {\n\tcontent: ['./src/**/*.{astro,html,js,jsx,md,svelte,ts,tsx,vue}'],\n\ttheme: {\n\t\textend: {},\n\t},\n\tplugins: [],\n}\n";
|
|
@@ -5,7 +5,10 @@ export interface RouteInfo {
|
|
|
5
5
|
routeData: RouteData;
|
|
6
6
|
file: string;
|
|
7
7
|
links: string[];
|
|
8
|
-
scripts: string
|
|
8
|
+
scripts: Array<string | {
|
|
9
|
+
children: string;
|
|
10
|
+
stage: string;
|
|
11
|
+
}>;
|
|
9
12
|
}
|
|
10
13
|
export declare type SerializedRouteInfo = Omit<RouteInfo, 'routeData'> & {
|
|
11
14
|
routeData: SerializedRouteData;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AstroConfig } from '../../@types/astro';
|
|
2
1
|
import type { RenderedChunk } from 'rollup';
|
|
3
2
|
import type { PageBuildData, ViteID } from './types';
|
|
4
3
|
export interface BuildInternals {
|
|
@@ -27,7 +26,7 @@ export declare function trackPageData(internals: BuildInternals, component: stri
|
|
|
27
26
|
/**
|
|
28
27
|
* Tracks client-only components to the pages they are associated with.
|
|
29
28
|
*/
|
|
30
|
-
export declare function trackClientOnlyPageDatas(internals: BuildInternals, pageData: PageBuildData, clientOnlys: string[]
|
|
29
|
+
export declare function trackClientOnlyPageDatas(internals: BuildInternals, pageData: PageBuildData, clientOnlys: string[]): void;
|
|
31
30
|
export declare function getPageDatasByChunk(internals: BuildInternals, chunk: RenderedChunk): Generator<PageBuildData, void, unknown>;
|
|
32
31
|
export declare function getPageDatasByClientOnlyChunk(internals: BuildInternals, chunk: RenderedChunk): Generator<PageBuildData, void, unknown>;
|
|
33
32
|
export declare function getPageDataByComponent(internals: BuildInternals, component: string): PageBuildData | undefined;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ComponentPreload } from '../render/dev/index';
|
|
2
|
+
import type { AstroConfig, BuildConfig, ManifestData, RouteData, ComponentInstance, SSRLoadedRenderer } from '../../@types/astro';
|
|
3
|
+
import type { LogOptions } from '../logger/core';
|
|
4
|
+
import type { RouteCache } from '../render/route-cache';
|
|
5
|
+
import type { ViteConfigWithSSR } from '../create-vite';
|
|
6
|
+
export declare type ComponentPath = string;
|
|
7
|
+
export declare type ViteID = string;
|
|
8
|
+
export interface PageBuildData {
|
|
9
|
+
component: ComponentPath;
|
|
10
|
+
paths: string[];
|
|
11
|
+
preload: ComponentPreload;
|
|
12
|
+
route: RouteData;
|
|
13
|
+
moduleSpecifier: string;
|
|
14
|
+
css: Set<string>;
|
|
15
|
+
hoistedScript: string | undefined;
|
|
16
|
+
scripts: Set<string>;
|
|
17
|
+
}
|
|
18
|
+
export declare type AllPagesData = Record<ComponentPath, PageBuildData>;
|
|
19
|
+
/** Options for the static build */
|
|
20
|
+
export interface StaticBuildOptions {
|
|
21
|
+
allPages: AllPagesData;
|
|
22
|
+
astroConfig: AstroConfig;
|
|
23
|
+
buildConfig: BuildConfig;
|
|
24
|
+
logging: LogOptions;
|
|
25
|
+
manifest: ManifestData;
|
|
26
|
+
origin: string;
|
|
27
|
+
pageNames: string[];
|
|
28
|
+
routeCache: RouteCache;
|
|
29
|
+
viteConfig: ViteConfigWithSSR;
|
|
30
|
+
}
|
|
31
|
+
export interface SingleFileBuiltModule {
|
|
32
|
+
pageMap: Map<ComponentPath, ComponentInstance>;
|
|
33
|
+
renderers: SSRLoadedRenderer[];
|
|
34
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AstroConfig, AstroUserConfig, CLIFlags } from '../@types/astro';
|
|
1
|
+
import type { AstroConfig, AstroUserConfig, CLIFlags, ViteUserConfig } from '../@types/astro';
|
|
2
2
|
import type { Arguments as Flags } from 'yargs-parser';
|
|
3
3
|
import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki';
|
|
4
4
|
import type { RemarkPlugin, RehypePlugin } from '@astrojs/markdown-remark';
|
|
@@ -125,7 +125,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
125
125
|
remarkPlugins?: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[] | undefined;
|
|
126
126
|
rehypePlugins?: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[] | undefined;
|
|
127
127
|
}>>;
|
|
128
|
-
vite: z.ZodDefault<z.
|
|
128
|
+
vite: z.ZodDefault<z.ZodType<ViteUserConfig, z.ZodTypeDef, ViteUserConfig>>;
|
|
129
129
|
experimental: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
130
130
|
ssr: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
131
131
|
integrations: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -142,13 +142,12 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
142
142
|
hooks: {};
|
|
143
143
|
} | undefined;
|
|
144
144
|
site?: string | undefined;
|
|
145
|
-
vite?: any;
|
|
146
145
|
root: URL;
|
|
147
146
|
srcDir: URL;
|
|
148
147
|
publicDir: URL;
|
|
149
148
|
outDir: URL;
|
|
150
149
|
base: string;
|
|
151
|
-
trailingSlash: "
|
|
150
|
+
trailingSlash: "never" | "always" | "ignore";
|
|
152
151
|
build: {
|
|
153
152
|
format: "file" | "directory";
|
|
154
153
|
};
|
|
@@ -178,6 +177,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
178
177
|
remarkPlugins: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[];
|
|
179
178
|
rehypePlugins: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[];
|
|
180
179
|
};
|
|
180
|
+
vite: ViteUserConfig;
|
|
181
181
|
experimental: {
|
|
182
182
|
integrations: boolean;
|
|
183
183
|
ssr: boolean;
|
|
@@ -193,7 +193,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
193
193
|
outDir?: string | undefined;
|
|
194
194
|
site?: string | undefined;
|
|
195
195
|
base?: string | undefined;
|
|
196
|
-
trailingSlash?: "
|
|
196
|
+
trailingSlash?: "never" | "always" | "ignore" | undefined;
|
|
197
197
|
build?: {
|
|
198
198
|
format?: "file" | "directory" | undefined;
|
|
199
199
|
} | undefined;
|
|
@@ -223,7 +223,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
223
223
|
remarkPlugins?: (string | [string, any] | RemarkPlugin<any[]> | [RemarkPlugin<any[]>, any])[] | undefined;
|
|
224
224
|
rehypePlugins?: (string | [string, any] | RehypePlugin<any[]> | [RehypePlugin<any[]>, any])[] | undefined;
|
|
225
225
|
} | undefined;
|
|
226
|
-
vite?:
|
|
226
|
+
vite?: ViteUserConfig | undefined;
|
|
227
227
|
experimental?: {
|
|
228
228
|
integrations?: boolean | undefined;
|
|
229
229
|
ssr?: boolean | undefined;
|
|
@@ -243,7 +243,18 @@ interface LoadConfigOptions {
|
|
|
243
243
|
* instead of the resolved config
|
|
244
244
|
*/
|
|
245
245
|
export declare function resolveConfigURL(configOptions: Pick<LoadConfigOptions, 'cwd' | 'flags'>): Promise<URL | undefined>;
|
|
246
|
-
|
|
246
|
+
interface OpenConfigResult {
|
|
247
|
+
userConfig: AstroUserConfig;
|
|
248
|
+
astroConfig: AstroConfig;
|
|
249
|
+
flags: CLIFlags;
|
|
250
|
+
root: string;
|
|
251
|
+
}
|
|
252
|
+
/** Load a configuration file, returning both the userConfig and astroConfig */
|
|
253
|
+
export declare function openConfig(configOptions: LoadConfigOptions): Promise<OpenConfigResult>;
|
|
254
|
+
/**
|
|
255
|
+
* Attempt to load an `astro.config.mjs` file
|
|
256
|
+
* @deprecated
|
|
257
|
+
*/
|
|
247
258
|
export declare function loadConfig(configOptions: LoadConfigOptions): Promise<AstroConfig>;
|
|
248
259
|
/** Attempt to resolve an Astro configuration object. Normalize, validate, and return. */
|
|
249
260
|
export declare function resolveConfig(userConfig: AstroUserConfig, root: string, flags: CLIFlags | undefined, cmd: string): Promise<AstroConfig>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { AddressInfo } from 'net';
|
|
3
3
|
import type { AstroTelemetry } from '@astrojs/telemetry';
|
|
4
|
+
import * as vite from 'vite';
|
|
4
5
|
import type { AstroConfig } from '../../@types/astro';
|
|
5
6
|
import { LogOptions } from '../logger/core.js';
|
|
6
7
|
export interface DevOptions {
|
|
@@ -9,6 +10,7 @@ export interface DevOptions {
|
|
|
9
10
|
}
|
|
10
11
|
export interface DevServer {
|
|
11
12
|
address: AddressInfo;
|
|
13
|
+
watcher: vite.FSWatcher;
|
|
12
14
|
stop(): Promise<void>;
|
|
13
15
|
}
|
|
14
16
|
/** `astro dev` */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { RouteData, SerializedRouteData } from '../../../@types/astro';
|
|
2
|
-
export declare function serializeRouteData(routeData: RouteData): SerializedRouteData;
|
|
1
|
+
import type { RouteData, SerializedRouteData, AstroConfig } from '../../../@types/astro';
|
|
2
|
+
export declare function serializeRouteData(routeData: RouteData, trailingSlash: AstroConfig['trailingSlash']): SerializedRouteData;
|
|
3
3
|
export declare function deserializeRouteData(rawRouteData: SerializedRouteData): RouteData;
|
|
@@ -4,9 +4,15 @@ import type { TransformHook } from './styles';
|
|
|
4
4
|
declare type CompileResult = TransformResult & {
|
|
5
5
|
rawCSSDeps: Set<string>;
|
|
6
6
|
};
|
|
7
|
+
interface CompileProps {
|
|
8
|
+
config: AstroConfig;
|
|
9
|
+
filename: string;
|
|
10
|
+
moduleId: string;
|
|
11
|
+
source: string;
|
|
12
|
+
ssr: boolean;
|
|
13
|
+
viteTransform: TransformHook;
|
|
14
|
+
}
|
|
7
15
|
export declare function isCached(config: AstroConfig, filename: string): boolean;
|
|
8
16
|
export declare function invalidateCompilation(config: AstroConfig, filename: string): void;
|
|
9
|
-
export declare function cachedCompilation(
|
|
10
|
-
ssr: boolean;
|
|
11
|
-
}): Promise<CompileResult>;
|
|
17
|
+
export declare function cachedCompilation(props: CompileProps): Promise<CompileResult>;
|
|
12
18
|
export {};
|
|
@@ -10,14 +10,20 @@ function safelyReplaceImportPlaceholder(code) {
|
|
|
10
10
|
return code.replace(/\/\*IMPORT\:(.*?)\*\//g, `@import '$1';`);
|
|
11
11
|
}
|
|
12
12
|
const configCache = /* @__PURE__ */ new WeakMap();
|
|
13
|
-
async function compile(
|
|
13
|
+
async function compile({
|
|
14
|
+
config,
|
|
15
|
+
filename,
|
|
16
|
+
moduleId,
|
|
17
|
+
source,
|
|
18
|
+
ssr,
|
|
19
|
+
viteTransform
|
|
20
|
+
}) {
|
|
14
21
|
const filenameURL = new URL(`file://${filename}`);
|
|
15
22
|
const normalizedID = fileURLToPath(filenameURL);
|
|
16
|
-
const pathname = filenameURL.pathname.slice(config.root.pathname.length - 1);
|
|
17
23
|
let rawCSSDeps = /* @__PURE__ */ new Set();
|
|
18
24
|
let cssTransformError;
|
|
19
25
|
const transformResult = await transform(source, {
|
|
20
|
-
pathname
|
|
26
|
+
pathname: `/@fs${prependForwardSlash(moduleId)}`,
|
|
21
27
|
projectRoot: config.root.toString(),
|
|
22
28
|
site: config.site ? new URL(config.base, config.site).toString() : void 0,
|
|
23
29
|
sourcefile: filename,
|
|
@@ -40,7 +46,7 @@ async function compile(config, filename, source, viteTransform, opts) {
|
|
|
40
46
|
lang,
|
|
41
47
|
id: normalizedID,
|
|
42
48
|
transformHook: viteTransform,
|
|
43
|
-
ssr
|
|
49
|
+
ssr
|
|
44
50
|
});
|
|
45
51
|
let map;
|
|
46
52
|
if (!result)
|
|
@@ -78,7 +84,8 @@ function invalidateCompilation(config, filename) {
|
|
|
78
84
|
cache.delete(filename);
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
|
-
async function cachedCompilation(
|
|
87
|
+
async function cachedCompilation(props) {
|
|
88
|
+
const { config, filename } = props;
|
|
82
89
|
let cache;
|
|
83
90
|
if (!configCache.has(config)) {
|
|
84
91
|
cache = /* @__PURE__ */ new Map();
|
|
@@ -89,7 +96,7 @@ async function cachedCompilation(config, filename, source, viteTransform, opts)
|
|
|
89
96
|
if (cache.has(filename)) {
|
|
90
97
|
return cache.get(filename);
|
|
91
98
|
}
|
|
92
|
-
const compileResult = await compile(
|
|
99
|
+
const compileResult = await compile(props);
|
|
93
100
|
cache.set(filename, compileResult);
|
|
94
101
|
return compileResult;
|
|
95
102
|
}
|
|
@@ -22,7 +22,7 @@ async function trackCSSDependencies(opts) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
async function handleHotUpdate(ctx, config, logging) {
|
|
25
|
-
var _a;
|
|
25
|
+
var _a, _b;
|
|
26
26
|
invalidateCompilation(config, ctx.file);
|
|
27
27
|
const filtered = new Set(ctx.modules);
|
|
28
28
|
const files = /* @__PURE__ */ new Set();
|
|
@@ -46,6 +46,13 @@ async function handleHotUpdate(ctx, config, logging) {
|
|
|
46
46
|
invalidateCompilation(config, file2);
|
|
47
47
|
}
|
|
48
48
|
const mods = ctx.modules.filter((m) => !m.url.endsWith("="));
|
|
49
|
+
for (const mod of mods) {
|
|
50
|
+
for (const imp of mod.importedModules) {
|
|
51
|
+
if ((_b = imp.id) == null ? void 0 : _b.includes("?astro&type=script")) {
|
|
52
|
+
mods.push(imp);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
49
56
|
const isSelfAccepting = mods.every((m) => m.isSelfAccepting || m.url.endsWith(".svelte"));
|
|
50
57
|
const file = ctx.file.replace(config.root.pathname, "/");
|
|
51
58
|
if (isSelfAccepting) {
|
|
@@ -75,14 +75,20 @@ function astro({ config, logging }) {
|
|
|
75
75
|
source += `
|
|
76
76
|
<script src="${PAGE_SCRIPT_ID}" />`;
|
|
77
77
|
}
|
|
78
|
+
const compileProps = {
|
|
79
|
+
config,
|
|
80
|
+
filename,
|
|
81
|
+
moduleId: id,
|
|
82
|
+
source,
|
|
83
|
+
ssr: Boolean(opts == null ? void 0 : opts.ssr),
|
|
84
|
+
viteTransform
|
|
85
|
+
};
|
|
78
86
|
if (query.astro) {
|
|
79
87
|
if (query.type === "style") {
|
|
80
88
|
if (typeof query.index === "undefined") {
|
|
81
89
|
throw new Error(`Requests for Astro CSS must include an index.`);
|
|
82
90
|
}
|
|
83
|
-
const transformResult = await cachedCompilation(
|
|
84
|
-
ssr: Boolean(opts == null ? void 0 : opts.ssr)
|
|
85
|
-
});
|
|
91
|
+
const transformResult = await cachedCompilation(compileProps);
|
|
86
92
|
await trackCSSDependencies.call(this, {
|
|
87
93
|
viteDevServer,
|
|
88
94
|
id,
|
|
@@ -98,9 +104,12 @@ function astro({ config, logging }) {
|
|
|
98
104
|
if (typeof query.index === "undefined") {
|
|
99
105
|
throw new Error(`Requests for hoisted scripts must include an index`);
|
|
100
106
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
if (opts == null ? void 0 : opts.ssr) {
|
|
108
|
+
return {
|
|
109
|
+
code: `/* client hoisted script, empty in SSR: ${id} */`
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const transformResult = await cachedCompilation(compileProps);
|
|
104
113
|
const scripts = transformResult.scripts;
|
|
105
114
|
const hoistedScript = scripts[query.index];
|
|
106
115
|
if (!hoistedScript) {
|
|
@@ -123,9 +132,7 @@ File: ${filename}`);
|
|
|
123
132
|
}
|
|
124
133
|
}
|
|
125
134
|
try {
|
|
126
|
-
const transformResult = await cachedCompilation(
|
|
127
|
-
ssr: Boolean(opts == null ? void 0 : opts.ssr)
|
|
128
|
-
});
|
|
135
|
+
const transformResult = await cachedCompilation(compileProps);
|
|
129
136
|
const { code, map } = await esbuild.transform(transformResult.code, {
|
|
130
137
|
loader: "ts",
|
|
131
138
|
sourcemap: "external",
|
|
@@ -141,6 +148,12 @@ File: ${filename}`);
|
|
|
141
148
|
while (match = (_b = pattern.exec(metadata)) == null ? void 0 : _b[1]) {
|
|
142
149
|
deps.add(match);
|
|
143
150
|
}
|
|
151
|
+
let i = 0;
|
|
152
|
+
while (i < transformResult.scripts.length) {
|
|
153
|
+
deps.add(`${id}?astro&type=script&index=${i}`);
|
|
154
|
+
SUFFIX += `import "${id}?astro&type=script&index=${i}";`;
|
|
155
|
+
i++;
|
|
156
|
+
}
|
|
144
157
|
SUFFIX += `
|
|
145
158
|
if (import.meta.hot) {
|
|
146
159
|
import.meta.hot.accept(mod => mod);
|
|
@@ -200,7 +213,7 @@ import "${PAGE_SSR_SCRIPT_ID}";`;
|
|
|
200
213
|
async handleHotUpdate(context) {
|
|
201
214
|
if (context.server.config.isProduction)
|
|
202
215
|
return;
|
|
203
|
-
return handleHotUpdate(context, config, logging);
|
|
216
|
+
return handleHotUpdate.call(this, context, config, logging);
|
|
204
217
|
}
|
|
205
218
|
};
|
|
206
219
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { info, warn, error } from "../core/logger/core.js";
|
|
2
|
+
import { appendForwardSlash } from "../core/path.js";
|
|
2
3
|
import { getParamsAndProps, GetParamsAndPropsError } from "../core/render/core.js";
|
|
3
4
|
import { createRouteManifest, matchRoute } from "../core/routing/index.js";
|
|
4
5
|
import stripAnsi from "strip-ansi";
|
|
@@ -116,7 +117,7 @@ async function handle500Response(viteServer, origin, req, res, err) {
|
|
|
116
117
|
}
|
|
117
118
|
function getCustom404Route(config, manifest) {
|
|
118
119
|
const relPages = resolvePages(config).href.replace(config.root.href, "");
|
|
119
|
-
return manifest.routes.find((r) => r.component === relPages + "404.astro");
|
|
120
|
+
return manifest.routes.find((r) => r.component === appendForwardSlash(relPages) + "404.astro");
|
|
120
121
|
}
|
|
121
122
|
function log404(logging, pathname) {
|
|
122
123
|
info(logging, "serve", msg.req({ url: pathname, statusCode: 404 }));
|
|
@@ -234,7 +235,6 @@ async function handleRequest(routeCache, viteServer, logging, manifest, config,
|
|
|
234
235
|
return await writeSSRResult(result, res, statusCode);
|
|
235
236
|
}
|
|
236
237
|
} catch (_err) {
|
|
237
|
-
debugger;
|
|
238
238
|
const err = fixViteErrorMessage(createSafeError(_err), viteServer);
|
|
239
239
|
error(logging, null, msg.formatErrorMessage(err));
|
|
240
240
|
handle500Response(viteServer, origin, req, res, err);
|
|
@@ -8,8 +8,6 @@ function getPrivateEnv(viteConfig, astroConfig) {
|
|
|
8
8
|
}
|
|
9
9
|
const fullEnv = loadEnv(viteConfig.mode, viteConfig.envDir ?? fileURLToPath(astroConfig.root), "");
|
|
10
10
|
const privateKeys = Object.keys(fullEnv).filter((key) => {
|
|
11
|
-
if (typeof process.env[key] !== "undefined")
|
|
12
|
-
return false;
|
|
13
11
|
for (const envPrefix of envPrefixes) {
|
|
14
12
|
if (key.startsWith(envPrefix))
|
|
15
13
|
return false;
|
|
@@ -19,7 +17,11 @@ function getPrivateEnv(viteConfig, astroConfig) {
|
|
|
19
17
|
if (privateKeys.length === 0) {
|
|
20
18
|
return null;
|
|
21
19
|
}
|
|
22
|
-
return Object.fromEntries(privateKeys.map((key) =>
|
|
20
|
+
return Object.fromEntries(privateKeys.map((key) => {
|
|
21
|
+
if (typeof process.env[key] !== "undefined")
|
|
22
|
+
return [key, `process.env.${key}`];
|
|
23
|
+
return [key, JSON.stringify(fullEnv[key])];
|
|
24
|
+
}));
|
|
23
25
|
}
|
|
24
26
|
function getReferencedPrivateKeys(source, privateEnv) {
|
|
25
27
|
const references = /* @__PURE__ */ new Set();
|
|
@@ -35,8 +35,8 @@ import matter from "gray-matter";
|
|
|
35
35
|
import { fileURLToPath } from "url";
|
|
36
36
|
import { PAGE_SSR_SCRIPT_ID } from "../vite-plugin-scripts/index.js";
|
|
37
37
|
import { pagesVirtualModuleId } from "../core/app/index.js";
|
|
38
|
-
import { appendForwardSlash } from "../core/path.js";
|
|
39
|
-
import { resolvePages } from "../core/util.js";
|
|
38
|
+
import { appendForwardSlash, prependForwardSlash } from "../core/path.js";
|
|
39
|
+
import { resolvePages, viteID } from "../core/util.js";
|
|
40
40
|
const MARKDOWN_IMPORT_FLAG = "?mdImport";
|
|
41
41
|
const MARKDOWN_CONTENT_FLAG = "?content";
|
|
42
42
|
function markdown({ config }) {
|
|
@@ -147,7 +147,7 @@ ${astroResult}`;
|
|
|
147
147
|
site: config.site ? new URL(config.base, config.site).toString() : void 0,
|
|
148
148
|
sourcefile: id,
|
|
149
149
|
sourcemap: "inline",
|
|
150
|
-
internalURL: `/@fs${new URL("../runtime/server/index.js", import.meta.url)
|
|
150
|
+
internalURL: `/@fs${prependForwardSlash(viteID(new URL("../runtime/server/index.js", import.meta.url)))}`
|
|
151
151
|
});
|
|
152
152
|
tsResult = `
|
|
153
153
|
export const metadata = ${JSON.stringify(metadata)};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.29",
|
|
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",
|
|
@@ -70,23 +70,23 @@
|
|
|
70
70
|
"@astrojs/language-server": "^0.13.4",
|
|
71
71
|
"@astrojs/markdown-remark": "^0.9.4",
|
|
72
72
|
"@astrojs/prism": "0.4.1",
|
|
73
|
-
"@astrojs/telemetry": "^0.1.
|
|
73
|
+
"@astrojs/telemetry": "^0.1.2",
|
|
74
74
|
"@astrojs/webapi": "^0.11.1",
|
|
75
|
-
"@babel/core": "^7.17.
|
|
76
|
-
"@babel/generator": "^7.17.
|
|
77
|
-
"@babel/parser": "^7.17.
|
|
78
|
-
"@babel/traverse": "^7.17.
|
|
75
|
+
"@babel/core": "^7.17.12",
|
|
76
|
+
"@babel/generator": "^7.17.12",
|
|
77
|
+
"@babel/parser": "^7.17.12",
|
|
78
|
+
"@babel/traverse": "^7.17.12",
|
|
79
79
|
"@proload/core": "^0.3.2",
|
|
80
80
|
"@proload/plugin-tsm": "^0.2.1",
|
|
81
81
|
"ast-types": "^0.14.2",
|
|
82
82
|
"boxen": "^6.2.1",
|
|
83
|
-
"ci-info": "^3.3.
|
|
83
|
+
"ci-info": "^3.3.1",
|
|
84
84
|
"common-ancestor-path": "^1.0.1",
|
|
85
85
|
"debug": "^4.3.4",
|
|
86
86
|
"diff": "^5.0.0",
|
|
87
87
|
"eol": "^0.9.1",
|
|
88
88
|
"es-module-lexer": "^0.10.5",
|
|
89
|
-
"esbuild": "^0.14.
|
|
89
|
+
"esbuild": "^0.14.39",
|
|
90
90
|
"estree-walker": "^3.0.1",
|
|
91
91
|
"execa": "^6.1.0",
|
|
92
92
|
"fast-glob": "^3.2.11",
|
|
@@ -101,15 +101,15 @@
|
|
|
101
101
|
"mime": "^3.0.0",
|
|
102
102
|
"ora": "^6.1.0",
|
|
103
103
|
"path-browserify": "^1.0.1",
|
|
104
|
-
"path-to-regexp": "^6.2.
|
|
105
|
-
"postcss": "^8.4.
|
|
104
|
+
"path-to-regexp": "^6.2.1",
|
|
105
|
+
"postcss": "^8.4.13",
|
|
106
106
|
"postcss-load-config": "^3.1.4",
|
|
107
107
|
"preferred-pm": "^3.0.3",
|
|
108
108
|
"prismjs": "^1.28.0",
|
|
109
109
|
"prompts": "^2.4.2",
|
|
110
110
|
"recast": "^0.20.5",
|
|
111
111
|
"resolve": "^1.22.0",
|
|
112
|
-
"rollup": "^2.
|
|
112
|
+
"rollup": "^2.73.0",
|
|
113
113
|
"semver": "^7.3.7",
|
|
114
114
|
"serialize-javascript": "^6.0.0",
|
|
115
115
|
"shiki": "^0.10.1",
|
|
@@ -120,15 +120,16 @@
|
|
|
120
120
|
"strip-ansi": "^7.0.1",
|
|
121
121
|
"supports-esm": "^1.0.0",
|
|
122
122
|
"tsconfig-resolver": "^3.0.1",
|
|
123
|
-
"vite": "^2.9.
|
|
123
|
+
"vite": "^2.9.9",
|
|
124
124
|
"yargs-parser": "^21.0.1",
|
|
125
|
-
"zod": "^3.
|
|
125
|
+
"zod": "^3.16.0"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
|
-
"@babel/types": "^7.17.
|
|
128
|
+
"@babel/types": "^7.17.12",
|
|
129
|
+
"@playwright/test": "^1.22.1",
|
|
129
130
|
"@types/babel__core": "^7.1.19",
|
|
130
131
|
"@types/babel__generator": "^7.6.4",
|
|
131
|
-
"@types/babel__traverse": "^7.17.
|
|
132
|
+
"@types/babel__traverse": "^7.17.1",
|
|
132
133
|
"@types/chai": "^4.3.1",
|
|
133
134
|
"@types/common-ancestor-path": "^1.0.0",
|
|
134
135
|
"@types/connect": "^3.4.35",
|
|
@@ -140,7 +141,7 @@
|
|
|
140
141
|
"@types/mocha": "^9.1.1",
|
|
141
142
|
"@types/parse5": "^6.0.3",
|
|
142
143
|
"@types/path-browserify": "^1.0.0",
|
|
143
|
-
"@types/prettier": "^2.6.
|
|
144
|
+
"@types/prettier": "^2.6.1",
|
|
144
145
|
"@types/resolve": "^1.20.2",
|
|
145
146
|
"@types/rimraf": "^3.0.2",
|
|
146
147
|
"@types/send": "^0.17.1",
|
|
@@ -150,7 +151,7 @@
|
|
|
150
151
|
"chai": "^4.3.6",
|
|
151
152
|
"cheerio": "^1.0.0-rc.10",
|
|
152
153
|
"mocha": "^9.2.2",
|
|
153
|
-
"sass": "^1.
|
|
154
|
+
"sass": "^1.51.0",
|
|
154
155
|
"srcset-parse": "^1.1.0"
|
|
155
156
|
},
|
|
156
157
|
"engines": {
|
|
@@ -164,6 +165,7 @@
|
|
|
164
165
|
"postbuild": "astro-scripts copy \"src/**/*.astro\"",
|
|
165
166
|
"benchmark": "node test/benchmark/dev.bench.js && node test/benchmark/build.bench.js",
|
|
166
167
|
"test": "mocha --exit --timeout 20000 --ignore **/lit-element.test.js && mocha --timeout 20000 **/lit-element.test.js",
|
|
167
|
-
"test:match": "mocha --timeout 20000 -g"
|
|
168
|
+
"test:match": "mocha --timeout 20000 -g",
|
|
169
|
+
"test:e2e": "playwright test e2e"
|
|
168
170
|
}
|
|
169
171
|
}
|