@astrojs/compiler 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/astro.wasm +0 -0
- package/browser/index.d.ts +1 -0
- package/browser/index.js +5 -0
- package/node/index.d.ts +1 -0
- package/node/index.js +4 -0
- package/package.json +1 -1
- package/shared/types.d.ts +13 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @astrojs/compiler
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b2cfd00: Add teardown API to remove WASM instance after using the compiler
|
|
8
|
+
|
|
9
|
+
## 1.1.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 2de6128: Preserve namespaced attributes when using expressions
|
|
14
|
+
- af13f2d: Fix incorrect `convertToTSX` types. The function accepts `filename`, not `sourcefile`.
|
|
15
|
+
- 5eb4fff: Compile `set:html` and `set:text` quoted and template literal attributes as strings
|
|
16
|
+
|
|
3
17
|
## 1.1.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/astro.wasm
CHANGED
|
Binary file
|
package/browser/index.d.ts
CHANGED
package/browser/index.js
CHANGED
|
@@ -7,6 +7,11 @@ export const parse = (input, options) => {
|
|
|
7
7
|
};
|
|
8
8
|
let initializePromise;
|
|
9
9
|
let longLivedService;
|
|
10
|
+
export const teardown = () => {
|
|
11
|
+
initializePromise = undefined;
|
|
12
|
+
longLivedService = undefined;
|
|
13
|
+
globalThis['@astrojs/compiler'] = undefined;
|
|
14
|
+
};
|
|
10
15
|
export const initialize = async (options) => {
|
|
11
16
|
let wasmURL = options.wasmURL;
|
|
12
17
|
if (!wasmURL)
|
package/node/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export declare const transform: typeof types.transform;
|
|
|
4
4
|
export declare const parse: typeof types.parse;
|
|
5
5
|
export declare const convertToTSX: typeof types.convertToTSX;
|
|
6
6
|
export declare const compile: (template: string) => Promise<string>;
|
|
7
|
+
export declare const teardown: typeof types.teardown;
|
package/node/index.js
CHANGED
|
@@ -15,6 +15,10 @@ export const compile = async (template) => {
|
|
|
15
15
|
return mod;
|
|
16
16
|
};
|
|
17
17
|
let longLivedService;
|
|
18
|
+
export const teardown = () => {
|
|
19
|
+
longLivedService = undefined;
|
|
20
|
+
globalThis['@astrojs/compiler'] = undefined;
|
|
21
|
+
};
|
|
18
22
|
let getService = () => {
|
|
19
23
|
if (!longLivedService) {
|
|
20
24
|
longLivedService = startRunningService().catch((err) => {
|
package/package.json
CHANGED
package/shared/types.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export interface TransformOptions {
|
|
|
46
46
|
resolvePath?: (specifier: string) => Promise<string>;
|
|
47
47
|
preprocessStyle?: (content: string, attrs: Record<string, string>) => null | Promise<PreprocessorResult | PreprocessorError>;
|
|
48
48
|
}
|
|
49
|
+
export declare type ConvertToTSXOptions = Pick<TransformOptions, 'filename' | 'normalizedFilename'>;
|
|
49
50
|
export declare type HoistedScript = {
|
|
50
51
|
type: string;
|
|
51
52
|
} & ({
|
|
@@ -91,10 +92,19 @@ export interface ParseResult {
|
|
|
91
92
|
}
|
|
92
93
|
export declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
|
|
93
94
|
export declare function parse(input: string, options?: ParseOptions): Promise<ParseResult>;
|
|
94
|
-
export declare function convertToTSX(input: string, options?:
|
|
95
|
-
sourcefile?: string;
|
|
96
|
-
}): Promise<TSXResult>;
|
|
95
|
+
export declare function convertToTSX(input: string, options?: ConvertToTSXOptions): Promise<TSXResult>;
|
|
97
96
|
export declare function initialize(options: InitializeOptions): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* When calling the core compiler APIs, e.g. `transform`, `parse`, etc, they
|
|
99
|
+
* would automatically instantiate a WASM instance to process the input. When
|
|
100
|
+
* done, you can call this to manually teardown the WASM instance.
|
|
101
|
+
*
|
|
102
|
+
* If the APIs are called again, they will automatically instantiate a new WASM
|
|
103
|
+
* instance. In browsers, you have to call `initialize()` again before using the APIs.
|
|
104
|
+
*
|
|
105
|
+
* Note: Calling teardown is optional and exists mostly as an optimization only.
|
|
106
|
+
*/
|
|
107
|
+
export declare function teardown(): void;
|
|
98
108
|
export interface InitializeOptions {
|
|
99
109
|
wasmURL?: string;
|
|
100
110
|
}
|