Upgrade to @astrojs/compiler 0.2.0 (#1584)

This commit is contained in:
Matthew Phillips 2021-10-18 14:20:40 -04:00 committed by Drew Powers
parent cd76229ed7
commit 34a257376e
5 changed files with 16 additions and 10 deletions

View file

@ -36,7 +36,7 @@
"packages/astro/test/fixtures/custom-elements/my-component-lib"
],
"volta": {
"node": "14.16.1",
"node": "14.17.0",
"npm": "7.11.2",
"yarn": "1.22.10"
},

View file

@ -52,7 +52,7 @@
"test": "mocha --parallel --timeout 15000"
},
"dependencies": {
"@astrojs/compiler": "^0.1.15",
"@astrojs/compiler": "^0.2.0",
"@astrojs/language-server": "^0.7.16",
"@astrojs/markdown-remark": "^0.3.1",
"@astrojs/markdown-support": "0.3.1",

View file

@ -6,7 +6,7 @@ import { pathToFileURL } from 'url';
import { valueToEstree } from 'estree-util-value-to-estree';
import * as astring from 'astring';
import shorthash from 'shorthash';
export { createHydrationMap } from './hydration-map.js';
export { createMetadata } from './metadata.js';
const { generate, GENERATOR } = astring;

View file

@ -10,7 +10,7 @@ interface ComponentMetadata {
componentUrl: string;
}
class HydrationMap {
class Metadata {
public fileURL: URL;
private metadataCache: Map<any, ComponentMetadata | null>;
constructor(fileURL: string, public modules: ModuleInfo[], components: any[]) {
@ -61,6 +61,12 @@ class HydrationMap {
}
}
export function createHydrationMap(fileURL: string, modules: ModuleInfo[], components: any[]) {
return new HydrationMap(fileURL, modules, components);
interface CreateMetadataOptions {
modules: ModuleInfo[];
hydratedComponents: any[];
hoisted: any[];
}
export function createMetadata(fileURL: string, options: CreateMetadataOptions) {
return new Metadata(fileURL, options.modules, options.hydratedComponents);
}

View file

@ -106,10 +106,10 @@
"@algolia/logger-common" "4.10.5"
"@algolia/requester-common" "4.10.5"
"@astrojs/compiler@^0.1.15":
version "0.1.15"
resolved "https://registry.yarnpkg.com/@astrojs/compiler/-/compiler-0.1.15.tgz#3d67c1a6591834c76471bd99c3fe49c6173de7fc"
integrity sha512-o8vxpbM4k9oROUN4ylOzjvCX3+g7U9P9Uoemji8VkVP7W/USDhJy56cdDI+ADvb1RxiOlzAnoowoScCPXuHtYQ==
"@astrojs/compiler@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@astrojs/compiler/-/compiler-0.2.0.tgz#79a8ec89d9a2d8089fbdb5515010e1bcdc949035"
integrity sha512-i3bxVI+gSql9Yb1YAMAJODdZ40vvDNtfxJWcidZ243R04BQXVG5X5URzmQz69AuKZTJb6ZGoFZlEle3sw1DK6w==
dependencies:
typescript "^4.3.5"