driftjs-compiler 0.0.4 → 0.0.6

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/types/opcodes.ts DELETED
@@ -1,66 +0,0 @@
1
- /**
2
- * Register-based Bytecode Opcodes supported by DriftJS.
3
- */
4
- export enum Opcode {
5
- RETURN = 0x00,
6
- CREATE_ELEMENT = 0x01,
7
- CREATE_TEXT = 0x02,
8
- CREATE_COMMENT = 0x03,
9
- APPEND_CHILD = 0x04,
10
- SET_ATTR = 0x05,
11
- CREATE_FRAGMENT = 0x06,
12
- INTERPOLATE_TEXT = 0x07,
13
- JUMP = 0x08,
14
- JUMP_IF_FALSE = 0x09,
15
- EVAL_EXPR = 0x0A,
16
- LOOP_ITER = 0x0B,
17
- /** Execute a script-block AST stored in the constant pool to initialise the component scope. */
18
- EXEC_SCRIPT = 0x0C,
19
- /** Reactive conditional block: re-renders its subtree when deps change. */
20
- REACTIVE_IF = 0x0D,
21
- /** Reactive loop block: re-renders its subtree when deps change. */
22
- REACTIVE_FOR = 0x0E,
23
- }
24
-
25
- /**
26
- * Describes which bytecode PC positions reference a declared variable,
27
- * enabling the runtime to re-evaluate bindings when state changes.
28
- */
29
- export interface ReactiveBinding {
30
- readonly variable: string;
31
- readonly positions: readonly { readonly pc: number; readonly opcode: Opcode }[];
32
- }
33
-
34
- export interface ImportSpec {
35
- readonly localName: string;
36
- readonly source: string;
37
- readonly isDefault: boolean;
38
- readonly importedName?: string;
39
- }
40
-
41
- /**
42
- * Output module emitted by DriftGenerator.
43
- */
44
- export interface CompiledModule {
45
- readonly bytecode: readonly number[];
46
- readonly constants: readonly any[];
47
- readonly reactiveBindings?: readonly ReactiveBinding[];
48
- /** All variable names declared in the component's <script> block. Used by the runtime for change-detection. */
49
- readonly declaredVars?: readonly string[];
50
- /** Import statements declared in the component's <script> block. */
51
- readonly imports?: readonly ImportSpec[];
52
- /** Component scope containing imported components or scope bindings. */
53
- readonly scope?: Record<string, any>;
54
- }
55
-
56
- /**
57
- * Cached row record used by the keyed list reconciler.
58
- */
59
- export interface ItemRecord {
60
- key: unknown;
61
- nodes: any[];
62
- childRegions?: any[];
63
- itemVal: unknown;
64
- indexVal: number;
65
- }
66
-
package/types/token.ts DELETED
@@ -1,61 +0,0 @@
1
- /**
2
- * Line and column position in source code.
3
- */
4
- export interface SourceLocation {
5
- readonly line: number;
6
- readonly column: number;
7
- readonly offset: number;
8
- }
9
-
10
- /**
11
- * Start and end location range.
12
- */
13
- export interface SourceRange {
14
- readonly start: SourceLocation;
15
- readonly end: SourceLocation;
16
- }
17
-
18
- /**
19
- * Token types supported by DriftLexer.
20
- */
21
- export const TokenType = {
22
- TagOpen: 'TagOpen',
23
- TagOpenSlash: 'TagOpenSlash',
24
- TagClose: 'TagClose',
25
- TagSelfClose: 'TagSelfClose',
26
- Equals: 'Equals',
27
- Identifier: 'Identifier',
28
- StringLiteral: 'StringLiteral',
29
- Text: 'Text',
30
- Interpolation: 'Interpolation',
31
- Comment: 'Comment',
32
- DirectiveIf: 'DirectiveIf',
33
- DirectiveElseIf: 'DirectiveElseIf',
34
- DirectiveElse: 'DirectiveElse',
35
- DirectiveFor: 'DirectiveFor',
36
- DirectiveSwitch: 'DirectiveSwitch',
37
- DirectiveCase: 'DirectiveCase',
38
- DirectiveDefault: 'DirectiveDefault',
39
- BlockOpen: 'BlockOpen',
40
- BlockClose: 'BlockClose',
41
- EOF: 'EOF',
42
- } as const;
43
-
44
- export type TokenType = typeof TokenType[keyof typeof TokenType];
45
-
46
- /**
47
- * Token produced by DriftLexer.
48
- */
49
- export interface Token {
50
- readonly type: TokenType;
51
- readonly value: string;
52
- readonly loc: SourceRange;
53
- }
54
-
55
- /**
56
- * Token source interface for parser consumption.
57
- */
58
- export interface TokenSource {
59
- nextToken(): Token;
60
- }
61
-
package/vite.config.ts DELETED
@@ -1,20 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import { resolve, dirname } from 'path';
3
- import { fileURLToPath } from 'url';
4
-
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = dirname(__filename);
7
-
8
- export default defineConfig({
9
- build: {
10
- outDir: 'dist',
11
- minify: true,
12
- emptyOutDir: true,
13
- lib: {
14
- formats: ['es', 'cjs'],
15
- entry: resolve(__dirname, 'src/index.ts'),
16
- name: 'DriftCompiler',
17
- fileName: (format: string) => `index-${format}.js`
18
- }
19
- }
20
- })