@astrojs/compiler 0.0.0-join-base-20221208164627
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 +1141 -0
- package/LICENSE +53 -0
- package/README.md +67 -0
- package/astro.wasm +0 -0
- package/browser/index.d.ts +4 -0
- package/browser/index.js +55 -0
- package/browser/utils.d.ts +25 -0
- package/browser/utils.js +116 -0
- package/browser/wasm_exec.d.ts +35 -0
- package/browser/wasm_exec.js +559 -0
- package/node/index.d.ts +6 -0
- package/node/index.js +61 -0
- package/node/utils.d.ts +25 -0
- package/node/utils.js +116 -0
- package/node/wasm_exec.d.ts +35 -0
- package/node/wasm_exec.js +451 -0
- package/package.json +39 -0
- package/shared/ast.d.ts +71 -0
- package/shared/ast.js +1 -0
- package/shared/diagnostics.d.ts +16 -0
- package/shared/diagnostics.js +1 -0
- package/shared/types.d.ts +102 -0
- package/shared/types.js +10 -0
- package/sourcemap.astro.js +6 -0
- package/types.d.ts +1 -0
- package/utils.d.ts +1 -0
package/shared/ast.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export declare type ParentNode = RootNode | ElementNode | ComponentNode | CustomElementNode | FragmentNode | ExpressionNode;
|
|
2
|
+
export declare type LiteralNode = TextNode | DoctypeNode | CommentNode | FrontmatterNode;
|
|
3
|
+
export declare type Node = RootNode | ElementNode | ComponentNode | CustomElementNode | FragmentNode | ExpressionNode | TextNode | FrontmatterNode | DoctypeNode | CommentNode;
|
|
4
|
+
export interface Position {
|
|
5
|
+
start: Point;
|
|
6
|
+
end?: Point;
|
|
7
|
+
}
|
|
8
|
+
export interface Point {
|
|
9
|
+
/** 1-based line number */
|
|
10
|
+
line: number;
|
|
11
|
+
/** 1-based column number, per-line */
|
|
12
|
+
column: number;
|
|
13
|
+
/** 0-based byte offset */
|
|
14
|
+
offset: number;
|
|
15
|
+
}
|
|
16
|
+
export interface BaseNode {
|
|
17
|
+
type: string;
|
|
18
|
+
position?: Position;
|
|
19
|
+
}
|
|
20
|
+
export interface ParentLikeNode extends BaseNode {
|
|
21
|
+
type: 'element' | 'component' | 'custom-element' | 'fragment' | 'expression' | 'root';
|
|
22
|
+
children: Node[];
|
|
23
|
+
}
|
|
24
|
+
export interface ValueNode extends BaseNode {
|
|
25
|
+
value: string;
|
|
26
|
+
}
|
|
27
|
+
export interface RootNode extends ParentLikeNode {
|
|
28
|
+
type: 'root';
|
|
29
|
+
}
|
|
30
|
+
export interface AttributeNode extends BaseNode {
|
|
31
|
+
type: 'attribute';
|
|
32
|
+
kind: 'quoted' | 'empty' | 'expression' | 'spread' | 'shorthand' | 'template-literal';
|
|
33
|
+
name: string;
|
|
34
|
+
value: string;
|
|
35
|
+
}
|
|
36
|
+
export interface TextNode extends ValueNode {
|
|
37
|
+
type: 'text';
|
|
38
|
+
}
|
|
39
|
+
export interface ElementNode extends ParentLikeNode {
|
|
40
|
+
type: 'element';
|
|
41
|
+
name: string;
|
|
42
|
+
attributes: AttributeNode[];
|
|
43
|
+
}
|
|
44
|
+
export interface FragmentNode extends ParentLikeNode {
|
|
45
|
+
type: 'fragment';
|
|
46
|
+
name: string;
|
|
47
|
+
attributes: AttributeNode[];
|
|
48
|
+
}
|
|
49
|
+
export interface ComponentNode extends ParentLikeNode {
|
|
50
|
+
type: 'component';
|
|
51
|
+
name: string;
|
|
52
|
+
attributes: AttributeNode[];
|
|
53
|
+
}
|
|
54
|
+
export interface CustomElementNode extends ParentLikeNode {
|
|
55
|
+
type: 'custom-element';
|
|
56
|
+
name: string;
|
|
57
|
+
attributes: AttributeNode[];
|
|
58
|
+
}
|
|
59
|
+
export declare type TagLikeNode = ElementNode | FragmentNode | ComponentNode | CustomElementNode;
|
|
60
|
+
export interface DoctypeNode extends ValueNode {
|
|
61
|
+
type: 'doctype';
|
|
62
|
+
}
|
|
63
|
+
export interface CommentNode extends ValueNode {
|
|
64
|
+
type: 'comment';
|
|
65
|
+
}
|
|
66
|
+
export interface FrontmatterNode extends ValueNode {
|
|
67
|
+
type: 'frontmatter';
|
|
68
|
+
}
|
|
69
|
+
export interface ExpressionNode extends ParentLikeNode {
|
|
70
|
+
type: 'expression';
|
|
71
|
+
}
|
package/shared/ast.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const enum DiagnosticCode {
|
|
2
|
+
ERROR = 1000,
|
|
3
|
+
ERROR_UNTERMINATED_JS_COMMENT = 1001,
|
|
4
|
+
ERROR_FRAGMENT_SHORTHAND_ATTRS = 1002,
|
|
5
|
+
ERROR_UNMATCHED_IMPORT = 1003,
|
|
6
|
+
ERROR_UNSUPPORTED_SLOT_ATTRIBUTE = 1004,
|
|
7
|
+
WARNING = 2000,
|
|
8
|
+
WARNING_UNTERMINATED_HTML_COMMENT = 2001,
|
|
9
|
+
WARNING_UNCLOSED_HTML_TAG = 2002,
|
|
10
|
+
WARNING_DEPRECATED_DIRECTIVE = 2003,
|
|
11
|
+
WARNING_IGNORED_DIRECTIVE = 2004,
|
|
12
|
+
WARNING_UNSUPPORTED_EXPRESSION = 2005,
|
|
13
|
+
WARNING_SET_WITH_CHILDREN = 2006,
|
|
14
|
+
INFO = 3000,
|
|
15
|
+
HINT = 4000
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { RootNode } from './ast';
|
|
2
|
+
import { DiagnosticCode } from './diagnostics';
|
|
3
|
+
export * from './ast';
|
|
4
|
+
export * from './diagnostics';
|
|
5
|
+
export interface PreprocessorResult {
|
|
6
|
+
code: string;
|
|
7
|
+
map?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PreprocessorError {
|
|
10
|
+
error: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ParseOptions {
|
|
13
|
+
position?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare enum DiagnosticSeverity {
|
|
16
|
+
Error = 1,
|
|
17
|
+
Warning = 2,
|
|
18
|
+
Information = 3,
|
|
19
|
+
Hint = 4
|
|
20
|
+
}
|
|
21
|
+
export interface DiagnosticMessage {
|
|
22
|
+
severity: DiagnosticSeverity;
|
|
23
|
+
code: DiagnosticCode;
|
|
24
|
+
location: DiagnosticLocation;
|
|
25
|
+
hint?: string;
|
|
26
|
+
text: string;
|
|
27
|
+
}
|
|
28
|
+
export interface DiagnosticLocation {
|
|
29
|
+
file: string;
|
|
30
|
+
line: number;
|
|
31
|
+
column: number;
|
|
32
|
+
length: number;
|
|
33
|
+
}
|
|
34
|
+
export interface TransformOptions {
|
|
35
|
+
internalURL?: string;
|
|
36
|
+
site?: string;
|
|
37
|
+
sourcefile?: string;
|
|
38
|
+
pathname?: string;
|
|
39
|
+
moduleId?: string;
|
|
40
|
+
sourcemap?: boolean | 'inline' | 'external' | 'both';
|
|
41
|
+
compact?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated "as" has been removed and no longer has any effect!
|
|
44
|
+
*/
|
|
45
|
+
as?: 'document' | 'fragment';
|
|
46
|
+
projectRoot?: string;
|
|
47
|
+
resolvePath?: (specifier: string) => Promise<string>;
|
|
48
|
+
preprocessStyle?: (content: string, attrs: Record<string, string>) => null | Promise<PreprocessorResult | PreprocessorError>;
|
|
49
|
+
experimentalStaticExtraction?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare type HoistedScript = {
|
|
52
|
+
type: string;
|
|
53
|
+
} & ({
|
|
54
|
+
type: 'external';
|
|
55
|
+
src: string;
|
|
56
|
+
} | {
|
|
57
|
+
type: 'inline';
|
|
58
|
+
code: string;
|
|
59
|
+
map: string;
|
|
60
|
+
});
|
|
61
|
+
export interface HydratedComponent {
|
|
62
|
+
exportName: string;
|
|
63
|
+
specifier: string;
|
|
64
|
+
resolvedPath: string;
|
|
65
|
+
}
|
|
66
|
+
export interface TransformResult {
|
|
67
|
+
code: string;
|
|
68
|
+
map: string;
|
|
69
|
+
scope: string;
|
|
70
|
+
styleError: string[];
|
|
71
|
+
diagnostics: DiagnosticMessage[];
|
|
72
|
+
css: string[];
|
|
73
|
+
scripts: HoistedScript[];
|
|
74
|
+
hydratedComponents: HydratedComponent[];
|
|
75
|
+
clientOnlyComponents: HydratedComponent[];
|
|
76
|
+
}
|
|
77
|
+
export interface SourceMap {
|
|
78
|
+
file: string;
|
|
79
|
+
mappings: string;
|
|
80
|
+
names: string[];
|
|
81
|
+
sources: string[];
|
|
82
|
+
sourcesContent: string[];
|
|
83
|
+
version: number;
|
|
84
|
+
}
|
|
85
|
+
export interface TSXResult {
|
|
86
|
+
code: string;
|
|
87
|
+
map: SourceMap;
|
|
88
|
+
diagnostics: DiagnosticMessage[];
|
|
89
|
+
}
|
|
90
|
+
export interface ParseResult {
|
|
91
|
+
ast: RootNode;
|
|
92
|
+
diagnostics: DiagnosticMessage[];
|
|
93
|
+
}
|
|
94
|
+
export declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
|
|
95
|
+
export declare function parse(input: string, options?: ParseOptions): Promise<ParseResult>;
|
|
96
|
+
export declare function convertToTSX(input: string, options?: {
|
|
97
|
+
sourcefile?: string;
|
|
98
|
+
}): Promise<TSXResult>;
|
|
99
|
+
export declare function initialize(options: InitializeOptions): Promise<void>;
|
|
100
|
+
export interface InitializeOptions {
|
|
101
|
+
wasmURL?: string;
|
|
102
|
+
}
|
package/shared/types.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './ast';
|
|
2
|
+
export * from './diagnostics';
|
|
3
|
+
// eslint-disable-next-line no-shadow
|
|
4
|
+
export var DiagnosticSeverity;
|
|
5
|
+
(function (DiagnosticSeverity) {
|
|
6
|
+
DiagnosticSeverity[DiagnosticSeverity["Error"] = 1] = "Error";
|
|
7
|
+
DiagnosticSeverity[DiagnosticSeverity["Warning"] = 2] = "Warning";
|
|
8
|
+
DiagnosticSeverity[DiagnosticSeverity["Information"] = 3] = "Information";
|
|
9
|
+
DiagnosticSeverity[DiagnosticSeverity["Hint"] = 4] = "Hint";
|
|
10
|
+
})(DiagnosticSeverity || (DiagnosticSeverity = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<Fragment>
|
|
2
|
+
{/** prettier-ignore */}<li />
|
|
3
|
+
|
|
4
|
+
</Fragment>
|
|
5
|
+
export default function Index__AstroComponent_(_props: Record<string, any>): any {}
|
|
6
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiaW5kZXguYXN0cm8iXSwKICAic291cmNlc0NvbnRlbnQiOiBbIlxuXHUwMDNjIS0tIHByZXR0aWVyLWlnbm9yZSAtLVx1MDAzZVxuXHUwMDNjbGkgL1x1MDAzZVxuIl0sCiAgIm1hcHBpbmdzIjogIkFBQUEsQUFBQTtBQUFBLElBQ0ksQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxBQURwQixJQUVBLENBQUMsRUFBRSxDQUFDLEVBQUU7QUFDTixBQUhBO0FBQUE7IiwKICAibmFtZXMiOiBbXQp9
|
package/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './shared/types';
|
package/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './node/utils';
|