astro 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astro-jsx.d.ts +2 -2
- package/dist/core/add/index.js +10 -7
- package/dist/core/build/generate.js +3 -6
- package/dist/core/build/graph.js +7 -6
- package/dist/core/build/index.js +5 -4
- package/dist/core/build/internal.js +13 -0
- package/dist/core/build/page-data.js +2 -2
- package/dist/core/build/static-build.js +4 -2
- package/dist/core/build/vite-plugin-analyzer.js +2 -2
- package/dist/core/build/vite-plugin-css.js +16 -7
- package/dist/core/build/vite-plugin-ssr.js +3 -3
- package/dist/core/create-vite.js +1 -1
- package/dist/core/dev/index.js +6 -6
- package/dist/core/messages.js +2 -2
- package/dist/core/util.js +1 -1
- package/dist/integrations/index.js +99 -35
- package/dist/jsx/babel.js +14 -0
- package/dist/runtime/server/astro-global.js +1 -1
- package/dist/types/@types/astro.d.ts +1 -1
- package/dist/types/core/build/graph.d.ts +2 -2
- package/dist/types/core/build/internal.d.ts +7 -0
- package/dist/types/core/build/types.d.ts +3 -1
- package/dist/types/integrations/index.d.ts +19 -9
- package/dist/types/vite-plugin-integrations-container/index.d.ts +3 -1
- package/dist/vite-plugin-integrations-container/index.js +3 -2
- package/dist/vite-plugin-jsx/tag.js +28 -16
- package/package.json +1 -1
package/astro-jsx.d.ts
CHANGED
|
@@ -548,7 +548,7 @@ declare namespace astroHTML.JSX {
|
|
|
548
548
|
| 'strict-origin-when-cross-origin'
|
|
549
549
|
| 'unsafe-url';
|
|
550
550
|
|
|
551
|
-
type HTMLAttributeAnchorTarget = '_self' | '_blank' | '_parent' | '_top';
|
|
551
|
+
type HTMLAttributeAnchorTarget = '_self' | '_blank' | '_parent' | '_top' | (string & {});
|
|
552
552
|
|
|
553
553
|
interface AnchorHTMLAttributes extends HTMLAttributes {
|
|
554
554
|
download?: string | boolean | undefined | null;
|
|
@@ -756,7 +756,7 @@ declare namespace astroHTML.JSX {
|
|
|
756
756
|
size?: number | string | undefined | null;
|
|
757
757
|
src?: string | undefined | null;
|
|
758
758
|
step?: number | string | undefined | null;
|
|
759
|
-
type?: HTMLInputTypeAttribute |
|
|
759
|
+
type?: HTMLInputTypeAttribute | undefined | null;
|
|
760
760
|
value?: string | string[] | number | undefined | null;
|
|
761
761
|
width?: number | string | undefined | null;
|
|
762
762
|
}
|
package/dist/core/add/index.js
CHANGED
|
@@ -517,7 +517,7 @@ ${message}`
|
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
async function fetchPackageJson(scope, name, tag) {
|
|
520
|
-
const packageName = `${scope ?
|
|
520
|
+
const packageName = `${scope ? `${scope}/` : ""}${name}`;
|
|
521
521
|
const res = await fetch(`https://registry.npmjs.org/${packageName}/${tag}`);
|
|
522
522
|
if (res.status === 404) {
|
|
523
523
|
return new Error();
|
|
@@ -535,10 +535,12 @@ async function validateIntegrations(integrations) {
|
|
|
535
535
|
throw new Error(`${bold(integration)} does not appear to be a valid package name!`);
|
|
536
536
|
}
|
|
537
537
|
let { scope, name, tag } = parsed;
|
|
538
|
-
let pkgJson
|
|
539
|
-
let pkgType
|
|
540
|
-
if (
|
|
541
|
-
|
|
538
|
+
let pkgJson;
|
|
539
|
+
let pkgType;
|
|
540
|
+
if (scope && scope !== "@astrojs") {
|
|
541
|
+
pkgType = "third-party";
|
|
542
|
+
} else {
|
|
543
|
+
const firstPartyPkgCheck = await fetchPackageJson("@astrojs", name, tag);
|
|
542
544
|
if (firstPartyPkgCheck instanceof Error) {
|
|
543
545
|
spinner.warn(
|
|
544
546
|
yellow(`${bold(integration)} is not an official Astro package. Use at your own risk!`)
|
|
@@ -559,6 +561,7 @@ async function validateIntegrations(integrations) {
|
|
|
559
561
|
spinner.start("Resolving with third party packages...");
|
|
560
562
|
pkgType = "third-party";
|
|
561
563
|
} else {
|
|
564
|
+
pkgType = "first-party";
|
|
562
565
|
pkgJson = firstPartyPkgCheck;
|
|
563
566
|
}
|
|
564
567
|
}
|
|
@@ -570,8 +573,8 @@ async function validateIntegrations(integrations) {
|
|
|
570
573
|
pkgJson = thirdPartyPkgCheck;
|
|
571
574
|
}
|
|
572
575
|
}
|
|
573
|
-
const resolvedScope = pkgType === "first-party" ? "astrojs" : scope;
|
|
574
|
-
const packageName = `${resolvedScope ?
|
|
576
|
+
const resolvedScope = pkgType === "first-party" ? "@astrojs" : scope;
|
|
577
|
+
const packageName = `${resolvedScope ? `${resolvedScope}/` : ""}${name}`;
|
|
575
578
|
let dependencies = [
|
|
576
579
|
[pkgJson["name"], `^${pkgJson["version"]}`]
|
|
577
580
|
];
|
|
@@ -19,7 +19,7 @@ import { createRequest } from "../request.js";
|
|
|
19
19
|
import { matchRoute } from "../routing/match.js";
|
|
20
20
|
import { getOutputFilename } from "../util.js";
|
|
21
21
|
import { getOutFile, getOutFolder } from "./common.js";
|
|
22
|
-
import { eachPageData, getPageDataByComponent } from "./internal.js";
|
|
22
|
+
import { eachPageData, getPageDataByComponent, sortedCSS } from "./internal.js";
|
|
23
23
|
import { getTimeStat } from "./util.js";
|
|
24
24
|
const MAX_CONCURRENT_RENDERS = 1;
|
|
25
25
|
function* throttle(max, inPaths) {
|
|
@@ -79,7 +79,7 @@ async function generatePage(opts, internals, pageData, ssrEntry, builtPaths) {
|
|
|
79
79
|
let timeStart = performance.now();
|
|
80
80
|
const renderers = ssrEntry.renderers;
|
|
81
81
|
const pageInfo = getPageDataByComponent(internals, pageData.route.component);
|
|
82
|
-
const linkIds =
|
|
82
|
+
const linkIds = sortedCSS(pageData);
|
|
83
83
|
const scripts = (pageInfo == null ? void 0 : pageInfo.hoistedScript) ?? null;
|
|
84
84
|
const pageModule = ssrEntry.pageMap.get(pageData.component);
|
|
85
85
|
if (!pageModule) {
|
|
@@ -141,9 +141,6 @@ async function getPathsForRoute(pageData, mod, opts, builtPaths) {
|
|
|
141
141
|
});
|
|
142
142
|
opts.routeCache.set(route, result);
|
|
143
143
|
paths = result.staticPaths.map((staticPath) => staticPath.params && route.generate(staticPath.params)).filter((staticPath) => {
|
|
144
|
-
if (!staticPath) {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
144
|
if (!builtPaths.has(removeTrailingForwardSlash(staticPath))) {
|
|
148
145
|
return true;
|
|
149
146
|
}
|
|
@@ -168,7 +165,7 @@ async function generatePath(pathname, opts, gopts) {
|
|
|
168
165
|
}
|
|
169
166
|
debug("build", `Generating: ${pathname}`);
|
|
170
167
|
const site = astroConfig.base !== "/" ? joinPaths(((_a = astroConfig.site) == null ? void 0 : _a.toString()) || "http://localhost/", astroConfig.base) : astroConfig.site;
|
|
171
|
-
const links = createLinkStylesheetElementSet(linkIds
|
|
168
|
+
const links = createLinkStylesheetElementSet(linkIds, site);
|
|
172
169
|
const scripts = createModuleScriptsSet(hoistedScripts ? [hoistedScripts] : [], site);
|
|
173
170
|
if (astroConfig._ctx.scripts.some((script) => script.stage === "page")) {
|
|
174
171
|
const hashedFilePath = internals.entrySpecifierToBundleMap.get(PAGE_SCRIPT_ID);
|
package/dist/core/build/graph.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { resolvedPagesVirtualModuleId } from "../app/index.js";
|
|
2
|
-
function* walkParentInfos(id, ctx, seen = /* @__PURE__ */ new Set()) {
|
|
2
|
+
function* walkParentInfos(id, ctx, depth = 0, seen = /* @__PURE__ */ new Set()) {
|
|
3
3
|
seen.add(id);
|
|
4
4
|
const info = ctx.getModuleInfo(id);
|
|
5
5
|
if (info) {
|
|
6
|
-
yield info;
|
|
6
|
+
yield [info, depth];
|
|
7
7
|
}
|
|
8
8
|
const importers = ((info == null ? void 0 : info.importers) || []).concat((info == null ? void 0 : info.dynamicImporters) || []);
|
|
9
9
|
for (const imp of importers) {
|
|
10
10
|
if (seen.has(imp)) {
|
|
11
11
|
continue;
|
|
12
12
|
}
|
|
13
|
-
yield* walkParentInfos(imp, ctx, seen);
|
|
13
|
+
yield* walkParentInfos(imp, ctx, ++depth, seen);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
function* getTopLevelPages(id, ctx) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
var _a;
|
|
18
|
+
for (const res of walkParentInfos(id, ctx)) {
|
|
19
|
+
if (((_a = res[0]) == null ? void 0 : _a.importers[0]) === resolvedPagesVirtualModuleId) {
|
|
20
|
+
yield res;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
}
|
package/dist/core/build/index.js
CHANGED
|
@@ -38,7 +38,7 @@ class AstroBuilder {
|
|
|
38
38
|
debug("build", "Initial setup...");
|
|
39
39
|
const { logging } = this;
|
|
40
40
|
this.timer.init = performance.now();
|
|
41
|
-
this.config = await runHookConfigSetup({ config: this.config, command: "build" });
|
|
41
|
+
this.config = await runHookConfigSetup({ config: this.config, command: "build", logging });
|
|
42
42
|
this.manifest = createRouteManifest({ config: this.config }, this.logging);
|
|
43
43
|
const viteConfig = await createVite(
|
|
44
44
|
{
|
|
@@ -51,7 +51,7 @@ class AstroBuilder {
|
|
|
51
51
|
},
|
|
52
52
|
{ astroConfig: this.config, logging, mode: "build" }
|
|
53
53
|
);
|
|
54
|
-
await runHookConfigDone({ config: this.config });
|
|
54
|
+
await runHookConfigDone({ config: this.config, logging });
|
|
55
55
|
return { viteConfig };
|
|
56
56
|
}
|
|
57
57
|
async build({ viteConfig }) {
|
|
@@ -60,7 +60,7 @@ class AstroBuilder {
|
|
|
60
60
|
server: new URL("./server/", this.config.outDir),
|
|
61
61
|
serverEntry: "entry.mjs"
|
|
62
62
|
};
|
|
63
|
-
await runHookBuildStart({ config: this.config, buildConfig });
|
|
63
|
+
await runHookBuildStart({ config: this.config, buildConfig, logging: this.logging });
|
|
64
64
|
info(this.logging, "build", `output target: ${colors.green(this.config.output)}`);
|
|
65
65
|
if (this.config._ctx.adapter) {
|
|
66
66
|
info(this.logging, "build", `deploy adapter: ${colors.green(this.config._ctx.adapter.name)}`);
|
|
@@ -106,7 +106,8 @@ class AstroBuilder {
|
|
|
106
106
|
config: this.config,
|
|
107
107
|
buildConfig,
|
|
108
108
|
pages: pageNames,
|
|
109
|
-
routes: Object.values(allPages).map((pd) => pd.route)
|
|
109
|
+
routes: Object.values(allPages).map((pd) => pd.route),
|
|
110
|
+
logging: this.logging
|
|
110
111
|
});
|
|
111
112
|
if (this.logging.level && levels[this.logging.level] <= levels["info"]) {
|
|
112
113
|
await this.printStats({
|
|
@@ -76,6 +76,18 @@ function hasPageDataByViteID(internals, viteid) {
|
|
|
76
76
|
function* eachPageData(internals) {
|
|
77
77
|
yield* internals.pagesByComponent.values();
|
|
78
78
|
}
|
|
79
|
+
function sortedCSS(pageData) {
|
|
80
|
+
return Array.from(pageData.css).sort((a, b) => {
|
|
81
|
+
let depthA = a[1].depth, depthB = b[1].depth;
|
|
82
|
+
if (depthA === -1) {
|
|
83
|
+
return -1;
|
|
84
|
+
} else if (depthB === -1) {
|
|
85
|
+
return 1;
|
|
86
|
+
} else {
|
|
87
|
+
return depthA > depthB ? -1 : 1;
|
|
88
|
+
}
|
|
89
|
+
}).map(([id]) => id);
|
|
90
|
+
}
|
|
79
91
|
export {
|
|
80
92
|
createBuildInternals,
|
|
81
93
|
eachPageData,
|
|
@@ -84,6 +96,7 @@ export {
|
|
|
84
96
|
getPageDatasByChunk,
|
|
85
97
|
getPageDatasByClientOnlyID,
|
|
86
98
|
hasPageDataByViteID,
|
|
99
|
+
sortedCSS,
|
|
87
100
|
trackClientOnlyPageDatas,
|
|
88
101
|
trackPageData
|
|
89
102
|
};
|
|
@@ -27,7 +27,7 @@ async function collectPagesData(opts) {
|
|
|
27
27
|
component: route.component,
|
|
28
28
|
route,
|
|
29
29
|
moduleSpecifier: "",
|
|
30
|
-
css: /* @__PURE__ */ new
|
|
30
|
+
css: /* @__PURE__ */ new Map(),
|
|
31
31
|
hoistedScript: void 0
|
|
32
32
|
};
|
|
33
33
|
clearInterval(routeCollectionLogTimeout);
|
|
@@ -46,7 +46,7 @@ async function collectPagesData(opts) {
|
|
|
46
46
|
component: route.component,
|
|
47
47
|
route,
|
|
48
48
|
moduleSpecifier: "",
|
|
49
|
-
css: /* @__PURE__ */ new
|
|
49
|
+
css: /* @__PURE__ */ new Map(),
|
|
50
50
|
hoistedScript: void 0
|
|
51
51
|
};
|
|
52
52
|
}
|
|
@@ -128,7 +128,8 @@ async function ssrBuild(opts, internals, input) {
|
|
|
128
128
|
config: astroConfig,
|
|
129
129
|
pages: internals.pagesByComponent,
|
|
130
130
|
vite: viteBuildConfig,
|
|
131
|
-
target: "server"
|
|
131
|
+
target: "server",
|
|
132
|
+
logging: opts.logging
|
|
132
133
|
});
|
|
133
134
|
return await vite.build(viteBuildConfig);
|
|
134
135
|
}
|
|
@@ -186,7 +187,8 @@ ${bgGreen(black(" building client "))}`);
|
|
|
186
187
|
config: astroConfig,
|
|
187
188
|
pages: internals.pagesByComponent,
|
|
188
189
|
vite: viteBuildConfig,
|
|
189
|
-
target: "client"
|
|
190
|
+
target: "client",
|
|
191
|
+
logging: opts.logging
|
|
190
192
|
});
|
|
191
193
|
const buildResult = await vite.build(viteBuildConfig);
|
|
192
194
|
info(opts.logging, null, dim(`Completed in ${getTimeStat(timer, performance.now())}.
|
|
@@ -15,7 +15,7 @@ function vitePluginAnalyzer(internals) {
|
|
|
15
15
|
hoistedScripts.add(hid);
|
|
16
16
|
}
|
|
17
17
|
if (hoistedScripts.size) {
|
|
18
|
-
for (const pageInfo of getTopLevelPages(from, this)) {
|
|
18
|
+
for (const [pageInfo] of getTopLevelPages(from, this)) {
|
|
19
19
|
const pageId = pageInfo.id;
|
|
20
20
|
for (const hid of hoistedScripts) {
|
|
21
21
|
if (pageScripts.has(pageId)) {
|
|
@@ -77,7 +77,7 @@ function vitePluginAnalyzer(internals) {
|
|
|
77
77
|
internals.discoveredClientOnlyComponents.add(cid);
|
|
78
78
|
clientOnlys.push(cid);
|
|
79
79
|
}
|
|
80
|
-
for (const pageInfo of getTopLevelPages(id, this)) {
|
|
80
|
+
for (const [pageInfo] of getTopLevelPages(id, this)) {
|
|
81
81
|
const pageData = getPageDataByViteID(internals, pageInfo.id);
|
|
82
82
|
if (!pageData)
|
|
83
83
|
continue;
|
|
@@ -20,19 +20,19 @@ function rollupPluginAstroBuildCSS(options) {
|
|
|
20
20
|
return named;
|
|
21
21
|
}
|
|
22
22
|
function createNameForParentPages(id, ctx) {
|
|
23
|
-
const parents = Array.from(getTopLevelPages(id, ctx))
|
|
24
|
-
const proposedName = parents.map((page) => nameifyPage(page.id)).join("-");
|
|
23
|
+
const parents = Array.from(getTopLevelPages(id, ctx));
|
|
24
|
+
const proposedName = parents.map(([page]) => nameifyPage(page.id)).sort().join("-");
|
|
25
25
|
if (proposedName.length <= MAX_NAME_LENGTH) {
|
|
26
26
|
return proposedName;
|
|
27
27
|
}
|
|
28
28
|
const hash = crypto.createHash("sha256");
|
|
29
|
-
for (const page of parents) {
|
|
29
|
+
for (const [page] of parents) {
|
|
30
30
|
hash.update(page.id, "utf-8");
|
|
31
31
|
}
|
|
32
32
|
return hash.digest("hex").slice(0, 8);
|
|
33
33
|
}
|
|
34
34
|
function* getParentClientOnlys(id, ctx) {
|
|
35
|
-
for (const info of walkParentInfos(id, ctx)) {
|
|
35
|
+
for (const [info] of walkParentInfos(id, ctx)) {
|
|
36
36
|
yield* getPageDatasByClientOnlyID(internals, info.id);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -64,21 +64,30 @@ function rollupPluginAstroBuildCSS(options) {
|
|
|
64
64
|
if ("viteMetadata" in chunk) {
|
|
65
65
|
const meta = chunk["viteMetadata"];
|
|
66
66
|
if (meta.importedCss.size) {
|
|
67
|
+
debugger;
|
|
67
68
|
if (options.target === "client") {
|
|
68
69
|
for (const [id] of Object.entries(c.modules)) {
|
|
69
70
|
for (const pageData of getParentClientOnlys(id, this)) {
|
|
70
71
|
for (const importedCssImport of meta.importedCss) {
|
|
71
|
-
pageData.css.
|
|
72
|
+
pageData.css.set(importedCssImport, { depth: -1 });
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
for (const [id] of Object.entries(c.modules)) {
|
|
77
|
-
|
|
78
|
+
debugger;
|
|
79
|
+
for (const [pageInfo, depth] of getTopLevelPages(id, this)) {
|
|
78
80
|
const pageViteID = pageInfo.id;
|
|
79
81
|
const pageData = getPageDataByViteID(internals, pageViteID);
|
|
80
82
|
for (const importedCssImport of meta.importedCss) {
|
|
81
|
-
pageData == null ? void 0 : pageData.css.
|
|
83
|
+
if (pageData == null ? void 0 : pageData.css.has(importedCssImport)) {
|
|
84
|
+
const cssInfo = pageData == null ? void 0 : pageData.css.get(importedCssImport);
|
|
85
|
+
if (depth < cssInfo.depth) {
|
|
86
|
+
cssInfo.depth = depth;
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
pageData == null ? void 0 : pageData.css.set(importedCssImport, { depth });
|
|
90
|
+
}
|
|
82
91
|
}
|
|
83
92
|
}
|
|
84
93
|
}
|
|
@@ -6,7 +6,7 @@ import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from "../../vite-plugin-sc
|
|
|
6
6
|
import { pagesVirtualModuleId } from "../app/index.js";
|
|
7
7
|
import { serializeRouteData } from "../routing/index.js";
|
|
8
8
|
import { addRollupInput } from "./add-rollup-input.js";
|
|
9
|
-
import { eachPageData } from "./internal.js";
|
|
9
|
+
import { eachPageData, sortedCSS } from "./internal.js";
|
|
10
10
|
const virtualModuleId = "@astrojs-ssr-virtual-entry";
|
|
11
11
|
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
12
12
|
const manifestReplace = "@@ASTRO_MANIFEST_REPLACE@@";
|
|
@@ -83,7 +83,7 @@ async function injectManifest(buildOpts, internals) {
|
|
|
83
83
|
}
|
|
84
84
|
const staticFiles = internals.staticFiles;
|
|
85
85
|
const manifest = buildManifest(buildOpts, internals, Array.from(staticFiles));
|
|
86
|
-
await runHookBuildSsr({ config: buildOpts.astroConfig, manifest });
|
|
86
|
+
await runHookBuildSsr({ config: buildOpts.astroConfig, manifest, logging: buildOpts.logging });
|
|
87
87
|
const chunk = internals.ssrEntryChunk;
|
|
88
88
|
const code = chunk.code;
|
|
89
89
|
chunk.code = code.replace(replaceExp, () => {
|
|
@@ -110,7 +110,7 @@ function buildManifest(opts, internals, staticFiles) {
|
|
|
110
110
|
}
|
|
111
111
|
routes.push({
|
|
112
112
|
file: "",
|
|
113
|
-
links:
|
|
113
|
+
links: sortedCSS(pageData),
|
|
114
114
|
scripts: [
|
|
115
115
|
...scripts,
|
|
116
116
|
...astroConfig._ctx.scripts.filter((script) => script.stage === "head-inline").map(({ stage, content }) => ({ stage, children: content }))
|
package/dist/core/create-vite.js
CHANGED
|
@@ -52,7 +52,7 @@ async function createVite(commandConfig, { astroConfig, logging, mode }) {
|
|
|
52
52
|
htmlVitePlugin(),
|
|
53
53
|
jsxVitePlugin({ config: astroConfig, logging }),
|
|
54
54
|
astroPostprocessVitePlugin({ config: astroConfig }),
|
|
55
|
-
astroIntegrationsContainerPlugin({ config: astroConfig }),
|
|
55
|
+
astroIntegrationsContainerPlugin({ config: astroConfig, logging }),
|
|
56
56
|
astroScriptsPageSSRPlugin({ config: astroConfig })
|
|
57
57
|
],
|
|
58
58
|
publicDir: fileURLToPath(astroConfig.publicDir),
|
package/dist/core/dev/index.js
CHANGED
|
@@ -16,7 +16,7 @@ async function dev(config, options) {
|
|
|
16
16
|
const devStart = performance.now();
|
|
17
17
|
applyPolyfill();
|
|
18
18
|
await options.telemetry.record([]);
|
|
19
|
-
config = await runHookConfigSetup({ config, command: "dev" });
|
|
19
|
+
config = await runHookConfigSetup({ config, command: "dev", logging: options.logging });
|
|
20
20
|
const { host, port } = config.server;
|
|
21
21
|
const rendererClientEntries = config._ctx.renderers.map((r) => r.clientEntrypoint).filter(Boolean);
|
|
22
22
|
const viteConfig = await createVite(
|
|
@@ -29,9 +29,9 @@ async function dev(config, options) {
|
|
|
29
29
|
},
|
|
30
30
|
{ astroConfig: config, logging: options.logging, mode: "dev" }
|
|
31
31
|
);
|
|
32
|
-
await runHookConfigDone({ config });
|
|
32
|
+
await runHookConfigDone({ config, logging: options.logging });
|
|
33
33
|
const viteServer = await vite.createServer(viteConfig);
|
|
34
|
-
runHookServerSetup({ config, server: viteServer });
|
|
34
|
+
runHookServerSetup({ config, server: viteServer, logging: options.logging });
|
|
35
35
|
await viteServer.listen(port);
|
|
36
36
|
const devServerAddressInfo = viteServer.httpServer.address();
|
|
37
37
|
const site = config.site ? new URL(config.base, config.site) : void 0;
|
|
@@ -46,14 +46,14 @@ async function dev(config, options) {
|
|
|
46
46
|
https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
|
|
47
47
|
})
|
|
48
48
|
);
|
|
49
|
-
const currentVersion = "1.0.
|
|
49
|
+
const currentVersion = "1.0.8";
|
|
50
50
|
if (currentVersion.includes("-")) {
|
|
51
51
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
52
52
|
}
|
|
53
53
|
if (((_c = (_b = viteConfig.server) == null ? void 0 : _b.fs) == null ? void 0 : _c.strict) === false) {
|
|
54
54
|
warn(options.logging, null, msg.fsStrictWarning());
|
|
55
55
|
}
|
|
56
|
-
await runHookServerStart({ config, address: devServerAddressInfo });
|
|
56
|
+
await runHookServerStart({ config, address: devServerAddressInfo, logging: options.logging });
|
|
57
57
|
return {
|
|
58
58
|
address: devServerAddressInfo,
|
|
59
59
|
get watcher() {
|
|
@@ -61,7 +61,7 @@ async function dev(config, options) {
|
|
|
61
61
|
},
|
|
62
62
|
stop: async () => {
|
|
63
63
|
await viteServer.close();
|
|
64
|
-
await runHookServerDone({ config });
|
|
64
|
+
await runHookServerDone({ config, logging: options.logging });
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -46,7 +46,7 @@ function devStart({
|
|
|
46
46
|
https,
|
|
47
47
|
site
|
|
48
48
|
}) {
|
|
49
|
-
const version = "1.0.
|
|
49
|
+
const version = "1.0.8";
|
|
50
50
|
const rootPath = site ? site.pathname : "/";
|
|
51
51
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
52
52
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
@@ -225,7 +225,7 @@ function printHelp({
|
|
|
225
225
|
message.push(
|
|
226
226
|
linebreak(),
|
|
227
227
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
228
|
-
`v${"1.0.
|
|
228
|
+
`v${"1.0.8"}`
|
|
229
229
|
)} ${headline}`
|
|
230
230
|
);
|
|
231
231
|
}
|
package/dist/core/util.js
CHANGED
|
@@ -5,7 +5,7 @@ import resolve from "resolve";
|
|
|
5
5
|
import slash from "slash";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
7
7
|
import { prependForwardSlash, removeTrailingForwardSlash } from "./path.js";
|
|
8
|
-
const ASTRO_VERSION = "1.0.
|
|
8
|
+
const ASTRO_VERSION = "1.0.8";
|
|
9
9
|
function isObject(value) {
|
|
10
10
|
return typeof value === "object" && value != null;
|
|
11
11
|
}
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
import { bold } from "kleur/colors";
|
|
1
2
|
import { mergeConfig } from "../core/config.js";
|
|
3
|
+
import { info } from "../core/logger/core.js";
|
|
4
|
+
async function withTakingALongTimeMsg({
|
|
5
|
+
name,
|
|
6
|
+
hookResult,
|
|
7
|
+
timeoutMs = 3e3,
|
|
8
|
+
logging
|
|
9
|
+
}) {
|
|
10
|
+
const timeout = setTimeout(() => {
|
|
11
|
+
info(logging, "build", `Waiting for the ${bold(name)} integration...`);
|
|
12
|
+
}, timeoutMs);
|
|
13
|
+
const result = await hookResult;
|
|
14
|
+
clearTimeout(timeout);
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
2
17
|
async function runHookConfigSetup({
|
|
3
18
|
config: _config,
|
|
4
|
-
command
|
|
19
|
+
command,
|
|
20
|
+
logging
|
|
5
21
|
}) {
|
|
6
22
|
var _a;
|
|
7
23
|
if (_config.adapter) {
|
|
@@ -36,67 +52,100 @@ async function runHookConfigSetup({
|
|
|
36
52
|
writable: false,
|
|
37
53
|
enumerable: false
|
|
38
54
|
});
|
|
39
|
-
await
|
|
55
|
+
await withTakingALongTimeMsg({
|
|
56
|
+
name: integration.name,
|
|
57
|
+
hookResult: integration.hooks["astro:config:setup"](hooks),
|
|
58
|
+
logging
|
|
59
|
+
});
|
|
40
60
|
}
|
|
41
61
|
}
|
|
42
62
|
return updatedConfig;
|
|
43
63
|
}
|
|
44
|
-
async function runHookConfigDone({
|
|
64
|
+
async function runHookConfigDone({
|
|
65
|
+
config,
|
|
66
|
+
logging
|
|
67
|
+
}) {
|
|
45
68
|
var _a;
|
|
46
69
|
for (const integration of config.integrations) {
|
|
47
70
|
if ((_a = integration == null ? void 0 : integration.hooks) == null ? void 0 : _a["astro:config:done"]) {
|
|
48
|
-
await
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
71
|
+
await withTakingALongTimeMsg({
|
|
72
|
+
name: integration.name,
|
|
73
|
+
hookResult: integration.hooks["astro:config:done"]({
|
|
74
|
+
config,
|
|
75
|
+
setAdapter(adapter) {
|
|
76
|
+
if (config._ctx.adapter && config._ctx.adapter.name !== adapter.name) {
|
|
77
|
+
throw new Error(
|
|
78
|
+
`Integration "${integration.name}" conflicts with "${config._ctx.adapter.name}". You can only configure one deployment integration.`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
config._ctx.adapter = adapter;
|
|
55
82
|
}
|
|
56
|
-
|
|
57
|
-
|
|
83
|
+
}),
|
|
84
|
+
logging
|
|
58
85
|
});
|
|
59
86
|
}
|
|
60
87
|
}
|
|
61
88
|
}
|
|
62
89
|
async function runHookServerSetup({
|
|
63
90
|
config,
|
|
64
|
-
server
|
|
91
|
+
server,
|
|
92
|
+
logging
|
|
65
93
|
}) {
|
|
66
94
|
var _a;
|
|
67
95
|
for (const integration of config.integrations) {
|
|
68
96
|
if ((_a = integration == null ? void 0 : integration.hooks) == null ? void 0 : _a["astro:server:setup"]) {
|
|
69
|
-
await
|
|
97
|
+
await withTakingALongTimeMsg({
|
|
98
|
+
name: integration.name,
|
|
99
|
+
hookResult: integration.hooks["astro:server:setup"]({ server }),
|
|
100
|
+
logging
|
|
101
|
+
});
|
|
70
102
|
}
|
|
71
103
|
}
|
|
72
104
|
}
|
|
73
105
|
async function runHookServerStart({
|
|
74
106
|
config,
|
|
75
|
-
address
|
|
107
|
+
address,
|
|
108
|
+
logging
|
|
76
109
|
}) {
|
|
77
110
|
var _a;
|
|
78
111
|
for (const integration of config.integrations) {
|
|
79
112
|
if ((_a = integration == null ? void 0 : integration.hooks) == null ? void 0 : _a["astro:server:start"]) {
|
|
80
|
-
await
|
|
113
|
+
await withTakingALongTimeMsg({
|
|
114
|
+
name: integration.name,
|
|
115
|
+
hookResult: integration.hooks["astro:server:start"]({ address }),
|
|
116
|
+
logging
|
|
117
|
+
});
|
|
81
118
|
}
|
|
82
119
|
}
|
|
83
120
|
}
|
|
84
|
-
async function runHookServerDone({
|
|
121
|
+
async function runHookServerDone({
|
|
122
|
+
config,
|
|
123
|
+
logging
|
|
124
|
+
}) {
|
|
85
125
|
var _a;
|
|
86
126
|
for (const integration of config.integrations) {
|
|
87
127
|
if ((_a = integration == null ? void 0 : integration.hooks) == null ? void 0 : _a["astro:server:done"]) {
|
|
88
|
-
await
|
|
128
|
+
await withTakingALongTimeMsg({
|
|
129
|
+
name: integration.name,
|
|
130
|
+
hookResult: integration.hooks["astro:server:done"](),
|
|
131
|
+
logging
|
|
132
|
+
});
|
|
89
133
|
}
|
|
90
134
|
}
|
|
91
135
|
}
|
|
92
136
|
async function runHookBuildStart({
|
|
93
137
|
config,
|
|
94
|
-
buildConfig
|
|
138
|
+
buildConfig,
|
|
139
|
+
logging
|
|
95
140
|
}) {
|
|
96
141
|
var _a;
|
|
97
142
|
for (const integration of config.integrations) {
|
|
98
143
|
if ((_a = integration == null ? void 0 : integration.hooks) == null ? void 0 : _a["astro:build:start"]) {
|
|
99
|
-
await
|
|
144
|
+
await withTakingALongTimeMsg({
|
|
145
|
+
name: integration.name,
|
|
146
|
+
hookResult: integration.hooks["astro:build:start"]({ buildConfig }),
|
|
147
|
+
logging
|
|
148
|
+
});
|
|
100
149
|
}
|
|
101
150
|
}
|
|
102
151
|
}
|
|
@@ -104,30 +153,40 @@ async function runHookBuildSetup({
|
|
|
104
153
|
config,
|
|
105
154
|
vite,
|
|
106
155
|
pages,
|
|
107
|
-
target
|
|
156
|
+
target,
|
|
157
|
+
logging
|
|
108
158
|
}) {
|
|
109
159
|
var _a;
|
|
110
160
|
for (const integration of config.integrations) {
|
|
111
161
|
if ((_a = integration == null ? void 0 : integration.hooks) == null ? void 0 : _a["astro:build:setup"]) {
|
|
112
|
-
await
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
162
|
+
await withTakingALongTimeMsg({
|
|
163
|
+
name: integration.name,
|
|
164
|
+
hookResult: integration.hooks["astro:build:setup"]({
|
|
165
|
+
vite,
|
|
166
|
+
pages,
|
|
167
|
+
target,
|
|
168
|
+
updateConfig: (newConfig) => {
|
|
169
|
+
mergeConfig(vite, newConfig);
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
172
|
+
logging
|
|
119
173
|
});
|
|
120
174
|
}
|
|
121
175
|
}
|
|
122
176
|
}
|
|
123
177
|
async function runHookBuildSsr({
|
|
124
178
|
config,
|
|
125
|
-
manifest
|
|
179
|
+
manifest,
|
|
180
|
+
logging
|
|
126
181
|
}) {
|
|
127
182
|
var _a;
|
|
128
183
|
for (const integration of config.integrations) {
|
|
129
184
|
if ((_a = integration == null ? void 0 : integration.hooks) == null ? void 0 : _a["astro:build:ssr"]) {
|
|
130
|
-
await
|
|
185
|
+
await withTakingALongTimeMsg({
|
|
186
|
+
name: integration.name,
|
|
187
|
+
hookResult: integration.hooks["astro:build:ssr"]({ manifest }),
|
|
188
|
+
logging
|
|
189
|
+
});
|
|
131
190
|
}
|
|
132
191
|
}
|
|
133
192
|
}
|
|
@@ -135,16 +194,21 @@ async function runHookBuildDone({
|
|
|
135
194
|
config,
|
|
136
195
|
buildConfig,
|
|
137
196
|
pages,
|
|
138
|
-
routes
|
|
197
|
+
routes,
|
|
198
|
+
logging
|
|
139
199
|
}) {
|
|
140
200
|
var _a;
|
|
141
201
|
const dir = config.output === "server" ? buildConfig.client : config.outDir;
|
|
142
202
|
for (const integration of config.integrations) {
|
|
143
203
|
if ((_a = integration == null ? void 0 : integration.hooks) == null ? void 0 : _a["astro:build:done"]) {
|
|
144
|
-
await
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
204
|
+
await withTakingALongTimeMsg({
|
|
205
|
+
name: integration.name,
|
|
206
|
+
hookResult: integration.hooks["astro:build:done"]({
|
|
207
|
+
pages: pages.map((p) => ({ pathname: p })),
|
|
208
|
+
dir,
|
|
209
|
+
routes
|
|
210
|
+
}),
|
|
211
|
+
logging
|
|
148
212
|
});
|
|
149
213
|
}
|
|
150
214
|
}
|
package/dist/jsx/babel.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as t from "@babel/types";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { HydrationDirectiveProps } from "../runtime/server/hydration.js";
|
|
3
4
|
const ClientOnlyPlaceholder = "astro-client-only";
|
|
4
5
|
function isComponent(tagName) {
|
|
5
6
|
return tagName[0] && tagName[0].toLowerCase() !== tagName[0] || tagName.includes(".") || /[^a-zA-Z]/.test(tagName[0]);
|
|
@@ -256,6 +257,19 @@ function astroJSX() {
|
|
|
256
257
|
}
|
|
257
258
|
const meta = path.getData("import");
|
|
258
259
|
if (meta) {
|
|
260
|
+
if (meta.path.endsWith(".astro")) {
|
|
261
|
+
const displayName = getTagName(parentNode);
|
|
262
|
+
for (const attr of parentNode.openingElement.attributes) {
|
|
263
|
+
if (t.isJSXAttribute(attr)) {
|
|
264
|
+
const name = jsxAttributeToString(attr);
|
|
265
|
+
if (HydrationDirectiveProps.has(name)) {
|
|
266
|
+
console.warn(
|
|
267
|
+
`You are attempting to render <${displayName} ${name} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
259
273
|
let resolvedPath;
|
|
260
274
|
if (meta.path.startsWith(".")) {
|
|
261
275
|
const fileURL = pathToFileURL(state.filename);
|
|
@@ -633,7 +633,7 @@ export interface AstroUserConfig {
|
|
|
633
633
|
* }
|
|
634
634
|
* ```
|
|
635
635
|
*/
|
|
636
|
-
integrations?: Array<AstroIntegration | AstroIntegration[]>;
|
|
636
|
+
integrations?: Array<AstroIntegration | (AstroIntegration | false | undefined | null)[] | false | undefined | null>;
|
|
637
637
|
/**
|
|
638
638
|
* @docs
|
|
639
639
|
* @kind heading
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GetModuleInfo, ModuleInfo } from 'rollup';
|
|
2
2
|
export declare function walkParentInfos(id: string, ctx: {
|
|
3
3
|
getModuleInfo: GetModuleInfo;
|
|
4
|
-
}, seen?: Set<string>): Generator<ModuleInfo, void, unknown>;
|
|
4
|
+
}, depth?: number, seen?: Set<string>): Generator<[ModuleInfo, number], void, unknown>;
|
|
5
5
|
export declare function getTopLevelPages(id: string, ctx: {
|
|
6
6
|
getModuleInfo: GetModuleInfo;
|
|
7
|
-
}): Generator<ModuleInfo, void, unknown>;
|
|
7
|
+
}): Generator<[ModuleInfo, number], void, unknown>;
|
|
@@ -51,3 +51,10 @@ export declare function getPageDataByComponent(internals: BuildInternals, compon
|
|
|
51
51
|
export declare function getPageDataByViteID(internals: BuildInternals, viteid: ViteID): PageBuildData | undefined;
|
|
52
52
|
export declare function hasPageDataByViteID(internals: BuildInternals, viteid: ViteID): boolean;
|
|
53
53
|
export declare function eachPageData(internals: BuildInternals): Generator<PageBuildData, void, undefined>;
|
|
54
|
+
/**
|
|
55
|
+
* Sort a page's CSS by depth. A higher depth means that the CSS comes from shared subcomponents.
|
|
56
|
+
* A lower depth means it comes directly from the top-level page.
|
|
57
|
+
* The return of this function is an array of CSS paths, with shared CSS on top
|
|
58
|
+
* and page-level CSS on bottom.
|
|
59
|
+
*/
|
|
60
|
+
export declare function sortedCSS(pageData: PageBuildData): string[];
|
|
@@ -5,41 +5,51 @@ import { AstroConfig, BuildConfig, RouteData } from '../@types/astro.js';
|
|
|
5
5
|
import type { SerializedSSRManifest } from '../core/app/types';
|
|
6
6
|
import type { PageBuildData } from '../core/build/types';
|
|
7
7
|
import type { ViteConfigWithSSR } from '../core/create-vite.js';
|
|
8
|
-
|
|
8
|
+
import { LogOptions } from '../core/logger/core.js';
|
|
9
|
+
export declare function runHookConfigSetup({ config: _config, command, logging, }: {
|
|
9
10
|
config: AstroConfig;
|
|
10
11
|
command: 'dev' | 'build';
|
|
12
|
+
logging: LogOptions;
|
|
11
13
|
}): Promise<AstroConfig>;
|
|
12
|
-
export declare function runHookConfigDone({ config }: {
|
|
14
|
+
export declare function runHookConfigDone({ config, logging, }: {
|
|
13
15
|
config: AstroConfig;
|
|
16
|
+
logging: LogOptions;
|
|
14
17
|
}): Promise<void>;
|
|
15
|
-
export declare function runHookServerSetup({ config, server, }: {
|
|
18
|
+
export declare function runHookServerSetup({ config, server, logging, }: {
|
|
16
19
|
config: AstroConfig;
|
|
17
20
|
server: ViteDevServer;
|
|
21
|
+
logging: LogOptions;
|
|
18
22
|
}): Promise<void>;
|
|
19
|
-
export declare function runHookServerStart({ config, address, }: {
|
|
23
|
+
export declare function runHookServerStart({ config, address, logging, }: {
|
|
20
24
|
config: AstroConfig;
|
|
21
25
|
address: AddressInfo;
|
|
26
|
+
logging: LogOptions;
|
|
22
27
|
}): Promise<void>;
|
|
23
|
-
export declare function runHookServerDone({ config }: {
|
|
28
|
+
export declare function runHookServerDone({ config, logging, }: {
|
|
24
29
|
config: AstroConfig;
|
|
30
|
+
logging: LogOptions;
|
|
25
31
|
}): Promise<void>;
|
|
26
|
-
export declare function runHookBuildStart({ config, buildConfig, }: {
|
|
32
|
+
export declare function runHookBuildStart({ config, buildConfig, logging, }: {
|
|
27
33
|
config: AstroConfig;
|
|
28
34
|
buildConfig: BuildConfig;
|
|
35
|
+
logging: LogOptions;
|
|
29
36
|
}): Promise<void>;
|
|
30
|
-
export declare function runHookBuildSetup({ config, vite, pages, target, }: {
|
|
37
|
+
export declare function runHookBuildSetup({ config, vite, pages, target, logging, }: {
|
|
31
38
|
config: AstroConfig;
|
|
32
39
|
vite: ViteConfigWithSSR;
|
|
33
40
|
pages: Map<string, PageBuildData>;
|
|
34
41
|
target: 'server' | 'client';
|
|
42
|
+
logging: LogOptions;
|
|
35
43
|
}): Promise<void>;
|
|
36
|
-
export declare function runHookBuildSsr({ config, manifest, }: {
|
|
44
|
+
export declare function runHookBuildSsr({ config, manifest, logging, }: {
|
|
37
45
|
config: AstroConfig;
|
|
38
46
|
manifest: SerializedSSRManifest;
|
|
47
|
+
logging: LogOptions;
|
|
39
48
|
}): Promise<void>;
|
|
40
|
-
export declare function runHookBuildDone({ config, buildConfig, pages, routes, }: {
|
|
49
|
+
export declare function runHookBuildDone({ config, buildConfig, pages, routes, logging, }: {
|
|
41
50
|
config: AstroConfig;
|
|
42
51
|
buildConfig: BuildConfig;
|
|
43
52
|
pages: string[];
|
|
44
53
|
routes: RouteData[];
|
|
54
|
+
logging: LogOptions;
|
|
45
55
|
}): Promise<void>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Plugin as VitePlugin } from 'vite';
|
|
2
2
|
import { AstroConfig } from '../@types/astro.js';
|
|
3
|
+
import { LogOptions } from '../core/logger/core.js';
|
|
3
4
|
/** Connect Astro integrations into Vite, as needed. */
|
|
4
|
-
export default function astroIntegrationsContainerPlugin({ config, }: {
|
|
5
|
+
export default function astroIntegrationsContainerPlugin({ config, logging, }: {
|
|
5
6
|
config: AstroConfig;
|
|
7
|
+
logging: LogOptions;
|
|
6
8
|
}): VitePlugin;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { runHookServerSetup } from "../integrations/index.js";
|
|
2
2
|
function astroIntegrationsContainerPlugin({
|
|
3
|
-
config
|
|
3
|
+
config,
|
|
4
|
+
logging
|
|
4
5
|
}) {
|
|
5
6
|
return {
|
|
6
7
|
name: "astro:integration-container",
|
|
7
8
|
configureServer(server) {
|
|
8
|
-
runHookServerSetup({ config, server });
|
|
9
|
+
runHookServerSetup({ config, server, logging });
|
|
9
10
|
}
|
|
10
11
|
};
|
|
11
12
|
}
|
|
@@ -37,27 +37,39 @@ function tagExportsWithRenderer({
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
ExportDeclaration(path, state) {
|
|
40
|
-
var _a, _b;
|
|
40
|
+
var _a, _b, _c;
|
|
41
41
|
const node = path.node;
|
|
42
42
|
if (node.exportKind === "type")
|
|
43
43
|
return;
|
|
44
44
|
if (node.type === "ExportAllDeclaration")
|
|
45
45
|
return;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (t.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
46
|
+
const addTag = (id) => {
|
|
47
|
+
const tags = state.get("astro:tags") ?? [];
|
|
48
|
+
state.set("astro:tags", [...tags, id]);
|
|
49
|
+
};
|
|
50
|
+
if (node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") {
|
|
51
|
+
if (t.isIdentifier(node.declaration)) {
|
|
52
|
+
addTag(node.declaration.name);
|
|
53
|
+
} else if (t.isFunctionDeclaration(node.declaration) && ((_a = node.declaration.id) == null ? void 0 : _a.name)) {
|
|
54
|
+
addTag(node.declaration.id.name);
|
|
55
|
+
} else if (t.isVariableDeclaration(node.declaration)) {
|
|
56
|
+
(_b = node.declaration.declarations) == null ? void 0 : _b.forEach((declaration) => {
|
|
57
|
+
if (t.isArrowFunctionExpression(declaration.init) && t.isIdentifier(declaration.id)) {
|
|
58
|
+
addTag(declaration.id.name);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
} else if (t.isObjectExpression(node.declaration)) {
|
|
62
|
+
(_c = node.declaration.properties) == null ? void 0 : _c.forEach((property) => {
|
|
63
|
+
if (t.isProperty(property) && t.isIdentifier(property.key)) {
|
|
64
|
+
addTag(property.key.name);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
} else if (t.isExportNamedDeclaration(node)) {
|
|
68
|
+
node.specifiers.forEach((specifier) => {
|
|
69
|
+
if (t.isExportSpecifier(specifier) && t.isIdentifier(specifier.exported)) {
|
|
70
|
+
addTag(specifier.local.name);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
61
73
|
}
|
|
62
74
|
}
|
|
63
75
|
}
|