angular-rust-plugins 0.4.0 → 0.6.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/binding/angular-binding.darwin-arm64.node +0 -0
- package/binding/index.d.ts +12 -3
- package/binding/index.js +132 -110
- package/compiler/index.cjs +70 -4
- package/compiler/index.cjs.map +1 -1
- package/compiler/index.d.cts +0 -10
- package/compiler/index.d.ts +0 -10
- package/compiler/index.js +70 -4
- package/compiler/index.js.map +1 -1
- package/compiler/vite.cjs +70 -4
- package/compiler/vite.cjs.map +1 -1
- package/compiler/vite.js +70 -4
- package/compiler/vite.js.map +1 -1
- package/index.cjs +83 -18
- package/index.cjs.map +1 -1
- package/index.d.cts +0 -1
- package/index.d.ts +0 -1
- package/index.js +83 -18
- package/index.js.map +1 -1
- package/linker/index.cjs +13 -14
- package/linker/index.cjs.map +1 -1
- package/linker/index.js +13 -14
- package/linker/index.js.map +1 -1
- package/linker/rolldown.cjs +7 -15
- package/linker/rolldown.cjs.map +1 -1
- package/linker/rolldown.d.cts +1 -1
- package/linker/rolldown.d.ts +1 -1
- package/linker/rolldown.js +7 -15
- package/linker/rolldown.js.map +1 -1
- package/linker/vite.cjs +6 -19
- package/linker/vite.cjs.map +1 -1
- package/linker/vite.d.cts +1 -1
- package/linker/vite.d.ts +1 -1
- package/linker/vite.js +6 -19
- package/linker/vite.js.map +1 -1
- package/package.json +1 -1
|
Binary file
|
package/binding/index.d.ts
CHANGED
|
@@ -4,10 +4,19 @@
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
6
|
export declare function linkFile(sourceCode: string, filename: string): string;
|
|
7
|
+
export interface Diagnostic {
|
|
8
|
+
file?: string;
|
|
9
|
+
message: string;
|
|
10
|
+
code: number;
|
|
11
|
+
start?: number;
|
|
12
|
+
length?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface CompileResult {
|
|
15
|
+
code: string;
|
|
16
|
+
diagnostics: Array<Diagnostic>;
|
|
17
|
+
}
|
|
7
18
|
export declare class Compiler {
|
|
8
19
|
constructor();
|
|
9
|
-
compile(filename: string, content: string):
|
|
10
|
-
constructor();
|
|
11
|
-
compile(filename: string, content: string): string;
|
|
20
|
+
compile(filename: string, content: string): CompileResult;
|
|
12
21
|
linkFile(filename: string, sourceCode: string): string;
|
|
13
22
|
}
|
package/binding/index.js
CHANGED
|
@@ -5,26 +5,26 @@
|
|
|
5
5
|
/* auto-generated by NAPI-RS */
|
|
6
6
|
|
|
7
7
|
const { existsSync, readFileSync } = require('fs')
|
|
8
|
-
const { join } = require('path')
|
|
8
|
+
const { join } = require('path')
|
|
9
9
|
|
|
10
|
-
const { platform, arch } = process
|
|
10
|
+
const { platform, arch } = process
|
|
11
11
|
|
|
12
|
-
let nativeBinding = null
|
|
13
|
-
let localFileExisted = false
|
|
14
|
-
let loadError = null
|
|
12
|
+
let nativeBinding = null
|
|
13
|
+
let localFileExisted = false
|
|
14
|
+
let loadError = null
|
|
15
15
|
|
|
16
16
|
function isMusl() {
|
|
17
17
|
// For Node 10
|
|
18
18
|
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
19
19
|
try {
|
|
20
|
-
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
|
21
|
-
return readFileSync(lddPath, 'utf8').includes('musl')
|
|
20
|
+
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
|
21
|
+
return readFileSync(lddPath, 'utf8').includes('musl')
|
|
22
22
|
} catch (e) {
|
|
23
|
-
return true
|
|
23
|
+
return true
|
|
24
24
|
}
|
|
25
25
|
} else {
|
|
26
|
-
const { glibcVersionRuntime } = process.report.getReport().header
|
|
27
|
-
return !glibcVersionRuntime
|
|
26
|
+
const { glibcVersionRuntime } = process.report.getReport().header
|
|
27
|
+
return !glibcVersionRuntime
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -32,263 +32,285 @@ switch (platform) {
|
|
|
32
32
|
case 'android':
|
|
33
33
|
switch (arch) {
|
|
34
34
|
case 'arm64':
|
|
35
|
-
localFileExisted = existsSync(join(__dirname, 'angular-binding.android-arm64.node'))
|
|
35
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.android-arm64.node'))
|
|
36
36
|
try {
|
|
37
37
|
if (localFileExisted) {
|
|
38
|
-
nativeBinding = require('./angular-binding.android-arm64.node')
|
|
38
|
+
nativeBinding = require('./angular-binding.android-arm64.node')
|
|
39
39
|
} else {
|
|
40
|
-
nativeBinding = require('angular-rust-binding-android-arm64')
|
|
40
|
+
nativeBinding = require('angular-rust-binding-android-arm64')
|
|
41
41
|
}
|
|
42
42
|
} catch (e) {
|
|
43
|
-
loadError = e
|
|
43
|
+
loadError = e
|
|
44
44
|
}
|
|
45
|
-
break
|
|
45
|
+
break
|
|
46
46
|
case 'arm':
|
|
47
|
-
localFileExisted = existsSync(join(__dirname, 'angular-binding.android-arm-eabi.node'))
|
|
47
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.android-arm-eabi.node'))
|
|
48
48
|
try {
|
|
49
49
|
if (localFileExisted) {
|
|
50
|
-
nativeBinding = require('./angular-binding.android-arm-eabi.node')
|
|
50
|
+
nativeBinding = require('./angular-binding.android-arm-eabi.node')
|
|
51
51
|
} else {
|
|
52
|
-
nativeBinding = require('angular-rust-binding-android-arm-eabi')
|
|
52
|
+
nativeBinding = require('angular-rust-binding-android-arm-eabi')
|
|
53
53
|
}
|
|
54
54
|
} catch (e) {
|
|
55
|
-
loadError = e
|
|
55
|
+
loadError = e
|
|
56
56
|
}
|
|
57
|
-
break
|
|
57
|
+
break
|
|
58
58
|
default:
|
|
59
|
-
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
59
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
60
60
|
}
|
|
61
|
-
break
|
|
61
|
+
break
|
|
62
62
|
case 'win32':
|
|
63
63
|
switch (arch) {
|
|
64
64
|
case 'x64':
|
|
65
|
-
localFileExisted = existsSync(
|
|
65
|
+
localFileExisted = existsSync(
|
|
66
|
+
join(__dirname, 'angular-binding.win32-x64-msvc.node')
|
|
67
|
+
)
|
|
66
68
|
try {
|
|
67
69
|
if (localFileExisted) {
|
|
68
|
-
nativeBinding = require('./angular-binding.win32-x64-msvc.node')
|
|
70
|
+
nativeBinding = require('./angular-binding.win32-x64-msvc.node')
|
|
69
71
|
} else {
|
|
70
|
-
nativeBinding = require('angular-rust-binding-win32-x64-msvc')
|
|
72
|
+
nativeBinding = require('angular-rust-binding-win32-x64-msvc')
|
|
71
73
|
}
|
|
72
74
|
} catch (e) {
|
|
73
|
-
loadError = e
|
|
75
|
+
loadError = e
|
|
74
76
|
}
|
|
75
|
-
break
|
|
77
|
+
break
|
|
76
78
|
case 'ia32':
|
|
77
|
-
localFileExisted = existsSync(
|
|
79
|
+
localFileExisted = existsSync(
|
|
80
|
+
join(__dirname, 'angular-binding.win32-ia32-msvc.node')
|
|
81
|
+
)
|
|
78
82
|
try {
|
|
79
83
|
if (localFileExisted) {
|
|
80
|
-
nativeBinding = require('./angular-binding.win32-ia32-msvc.node')
|
|
84
|
+
nativeBinding = require('./angular-binding.win32-ia32-msvc.node')
|
|
81
85
|
} else {
|
|
82
|
-
nativeBinding = require('angular-rust-binding-win32-ia32-msvc')
|
|
86
|
+
nativeBinding = require('angular-rust-binding-win32-ia32-msvc')
|
|
83
87
|
}
|
|
84
88
|
} catch (e) {
|
|
85
|
-
loadError = e
|
|
89
|
+
loadError = e
|
|
86
90
|
}
|
|
87
|
-
break
|
|
91
|
+
break
|
|
88
92
|
case 'arm64':
|
|
89
|
-
localFileExisted = existsSync(
|
|
93
|
+
localFileExisted = existsSync(
|
|
94
|
+
join(__dirname, 'angular-binding.win32-arm64-msvc.node')
|
|
95
|
+
)
|
|
90
96
|
try {
|
|
91
97
|
if (localFileExisted) {
|
|
92
|
-
nativeBinding = require('./angular-binding.win32-arm64-msvc.node')
|
|
98
|
+
nativeBinding = require('./angular-binding.win32-arm64-msvc.node')
|
|
93
99
|
} else {
|
|
94
|
-
nativeBinding = require('angular-rust-binding-win32-arm64-msvc')
|
|
100
|
+
nativeBinding = require('angular-rust-binding-win32-arm64-msvc')
|
|
95
101
|
}
|
|
96
102
|
} catch (e) {
|
|
97
|
-
loadError = e
|
|
103
|
+
loadError = e
|
|
98
104
|
}
|
|
99
|
-
break
|
|
105
|
+
break
|
|
100
106
|
default:
|
|
101
|
-
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
107
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
102
108
|
}
|
|
103
|
-
break
|
|
109
|
+
break
|
|
104
110
|
case 'darwin':
|
|
105
|
-
localFileExisted = existsSync(join(__dirname, 'angular-binding.darwin-universal.node'))
|
|
111
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.darwin-universal.node'))
|
|
106
112
|
try {
|
|
107
113
|
if (localFileExisted) {
|
|
108
|
-
nativeBinding = require('./angular-binding.darwin-universal.node')
|
|
114
|
+
nativeBinding = require('./angular-binding.darwin-universal.node')
|
|
109
115
|
} else {
|
|
110
|
-
nativeBinding = require('angular-rust-binding-darwin-universal')
|
|
116
|
+
nativeBinding = require('angular-rust-binding-darwin-universal')
|
|
111
117
|
}
|
|
112
|
-
break
|
|
118
|
+
break
|
|
113
119
|
} catch {}
|
|
114
120
|
switch (arch) {
|
|
115
121
|
case 'x64':
|
|
116
|
-
localFileExisted = existsSync(join(__dirname, 'angular-binding.darwin-x64.node'))
|
|
122
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.darwin-x64.node'))
|
|
117
123
|
try {
|
|
118
124
|
if (localFileExisted) {
|
|
119
|
-
nativeBinding = require('./angular-binding.darwin-x64.node')
|
|
125
|
+
nativeBinding = require('./angular-binding.darwin-x64.node')
|
|
120
126
|
} else {
|
|
121
|
-
nativeBinding = require('angular-rust-binding-darwin-x64')
|
|
127
|
+
nativeBinding = require('angular-rust-binding-darwin-x64')
|
|
122
128
|
}
|
|
123
129
|
} catch (e) {
|
|
124
|
-
loadError = e
|
|
130
|
+
loadError = e
|
|
125
131
|
}
|
|
126
|
-
break
|
|
132
|
+
break
|
|
127
133
|
case 'arm64':
|
|
128
|
-
localFileExisted = existsSync(
|
|
134
|
+
localFileExisted = existsSync(
|
|
135
|
+
join(__dirname, 'angular-binding.darwin-arm64.node')
|
|
136
|
+
)
|
|
129
137
|
try {
|
|
130
138
|
if (localFileExisted) {
|
|
131
|
-
nativeBinding = require('./angular-binding.darwin-arm64.node')
|
|
139
|
+
nativeBinding = require('./angular-binding.darwin-arm64.node')
|
|
132
140
|
} else {
|
|
133
|
-
nativeBinding = require('angular-rust-binding-darwin-arm64')
|
|
141
|
+
nativeBinding = require('angular-rust-binding-darwin-arm64')
|
|
134
142
|
}
|
|
135
143
|
} catch (e) {
|
|
136
|
-
loadError = e
|
|
144
|
+
loadError = e
|
|
137
145
|
}
|
|
138
|
-
break
|
|
146
|
+
break
|
|
139
147
|
default:
|
|
140
|
-
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
148
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
141
149
|
}
|
|
142
|
-
break
|
|
150
|
+
break
|
|
143
151
|
case 'freebsd':
|
|
144
152
|
if (arch !== 'x64') {
|
|
145
|
-
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
153
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
146
154
|
}
|
|
147
|
-
localFileExisted = existsSync(join(__dirname, 'angular-binding.freebsd-x64.node'))
|
|
155
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.freebsd-x64.node'))
|
|
148
156
|
try {
|
|
149
157
|
if (localFileExisted) {
|
|
150
|
-
nativeBinding = require('./angular-binding.freebsd-x64.node')
|
|
158
|
+
nativeBinding = require('./angular-binding.freebsd-x64.node')
|
|
151
159
|
} else {
|
|
152
|
-
nativeBinding = require('angular-rust-binding-freebsd-x64')
|
|
160
|
+
nativeBinding = require('angular-rust-binding-freebsd-x64')
|
|
153
161
|
}
|
|
154
162
|
} catch (e) {
|
|
155
|
-
loadError = e
|
|
163
|
+
loadError = e
|
|
156
164
|
}
|
|
157
|
-
break
|
|
165
|
+
break
|
|
158
166
|
case 'linux':
|
|
159
167
|
switch (arch) {
|
|
160
168
|
case 'x64':
|
|
161
169
|
if (isMusl()) {
|
|
162
|
-
localFileExisted = existsSync(
|
|
170
|
+
localFileExisted = existsSync(
|
|
171
|
+
join(__dirname, 'angular-binding.linux-x64-musl.node')
|
|
172
|
+
)
|
|
163
173
|
try {
|
|
164
174
|
if (localFileExisted) {
|
|
165
|
-
nativeBinding = require('./angular-binding.linux-x64-musl.node')
|
|
175
|
+
nativeBinding = require('./angular-binding.linux-x64-musl.node')
|
|
166
176
|
} else {
|
|
167
|
-
nativeBinding = require('angular-rust-binding-linux-x64-musl')
|
|
177
|
+
nativeBinding = require('angular-rust-binding-linux-x64-musl')
|
|
168
178
|
}
|
|
169
179
|
} catch (e) {
|
|
170
|
-
loadError = e
|
|
180
|
+
loadError = e
|
|
171
181
|
}
|
|
172
182
|
} else {
|
|
173
|
-
localFileExisted = existsSync(
|
|
183
|
+
localFileExisted = existsSync(
|
|
184
|
+
join(__dirname, 'angular-binding.linux-x64-gnu.node')
|
|
185
|
+
)
|
|
174
186
|
try {
|
|
175
187
|
if (localFileExisted) {
|
|
176
|
-
nativeBinding = require('./angular-binding.linux-x64-gnu.node')
|
|
188
|
+
nativeBinding = require('./angular-binding.linux-x64-gnu.node')
|
|
177
189
|
} else {
|
|
178
|
-
nativeBinding = require('angular-rust-binding-linux-x64-gnu')
|
|
190
|
+
nativeBinding = require('angular-rust-binding-linux-x64-gnu')
|
|
179
191
|
}
|
|
180
192
|
} catch (e) {
|
|
181
|
-
loadError = e
|
|
193
|
+
loadError = e
|
|
182
194
|
}
|
|
183
195
|
}
|
|
184
|
-
break
|
|
196
|
+
break
|
|
185
197
|
case 'arm64':
|
|
186
198
|
if (isMusl()) {
|
|
187
|
-
localFileExisted = existsSync(
|
|
199
|
+
localFileExisted = existsSync(
|
|
200
|
+
join(__dirname, 'angular-binding.linux-arm64-musl.node')
|
|
201
|
+
)
|
|
188
202
|
try {
|
|
189
203
|
if (localFileExisted) {
|
|
190
|
-
nativeBinding = require('./angular-binding.linux-arm64-musl.node')
|
|
204
|
+
nativeBinding = require('./angular-binding.linux-arm64-musl.node')
|
|
191
205
|
} else {
|
|
192
|
-
nativeBinding = require('angular-rust-binding-linux-arm64-musl')
|
|
206
|
+
nativeBinding = require('angular-rust-binding-linux-arm64-musl')
|
|
193
207
|
}
|
|
194
208
|
} catch (e) {
|
|
195
|
-
loadError = e
|
|
209
|
+
loadError = e
|
|
196
210
|
}
|
|
197
211
|
} else {
|
|
198
|
-
localFileExisted = existsSync(
|
|
212
|
+
localFileExisted = existsSync(
|
|
213
|
+
join(__dirname, 'angular-binding.linux-arm64-gnu.node')
|
|
214
|
+
)
|
|
199
215
|
try {
|
|
200
216
|
if (localFileExisted) {
|
|
201
|
-
nativeBinding = require('./angular-binding.linux-arm64-gnu.node')
|
|
217
|
+
nativeBinding = require('./angular-binding.linux-arm64-gnu.node')
|
|
202
218
|
} else {
|
|
203
|
-
nativeBinding = require('angular-rust-binding-linux-arm64-gnu')
|
|
219
|
+
nativeBinding = require('angular-rust-binding-linux-arm64-gnu')
|
|
204
220
|
}
|
|
205
221
|
} catch (e) {
|
|
206
|
-
loadError = e
|
|
222
|
+
loadError = e
|
|
207
223
|
}
|
|
208
224
|
}
|
|
209
|
-
break
|
|
225
|
+
break
|
|
210
226
|
case 'arm':
|
|
211
227
|
if (isMusl()) {
|
|
212
228
|
localFileExisted = existsSync(
|
|
213
229
|
join(__dirname, 'angular-binding.linux-arm-musleabihf.node')
|
|
214
|
-
)
|
|
230
|
+
)
|
|
215
231
|
try {
|
|
216
232
|
if (localFileExisted) {
|
|
217
|
-
nativeBinding = require('./angular-binding.linux-arm-musleabihf.node')
|
|
233
|
+
nativeBinding = require('./angular-binding.linux-arm-musleabihf.node')
|
|
218
234
|
} else {
|
|
219
|
-
nativeBinding = require('angular-rust-binding-linux-arm-musleabihf')
|
|
235
|
+
nativeBinding = require('angular-rust-binding-linux-arm-musleabihf')
|
|
220
236
|
}
|
|
221
237
|
} catch (e) {
|
|
222
|
-
loadError = e
|
|
238
|
+
loadError = e
|
|
223
239
|
}
|
|
224
240
|
} else {
|
|
225
241
|
localFileExisted = existsSync(
|
|
226
242
|
join(__dirname, 'angular-binding.linux-arm-gnueabihf.node')
|
|
227
|
-
)
|
|
243
|
+
)
|
|
228
244
|
try {
|
|
229
245
|
if (localFileExisted) {
|
|
230
|
-
nativeBinding = require('./angular-binding.linux-arm-gnueabihf.node')
|
|
246
|
+
nativeBinding = require('./angular-binding.linux-arm-gnueabihf.node')
|
|
231
247
|
} else {
|
|
232
|
-
nativeBinding = require('angular-rust-binding-linux-arm-gnueabihf')
|
|
248
|
+
nativeBinding = require('angular-rust-binding-linux-arm-gnueabihf')
|
|
233
249
|
}
|
|
234
250
|
} catch (e) {
|
|
235
|
-
loadError = e
|
|
251
|
+
loadError = e
|
|
236
252
|
}
|
|
237
253
|
}
|
|
238
|
-
break
|
|
254
|
+
break
|
|
239
255
|
case 'riscv64':
|
|
240
256
|
if (isMusl()) {
|
|
241
|
-
localFileExisted = existsSync(
|
|
257
|
+
localFileExisted = existsSync(
|
|
258
|
+
join(__dirname, 'angular-binding.linux-riscv64-musl.node')
|
|
259
|
+
)
|
|
242
260
|
try {
|
|
243
261
|
if (localFileExisted) {
|
|
244
|
-
nativeBinding = require('./angular-binding.linux-riscv64-musl.node')
|
|
262
|
+
nativeBinding = require('./angular-binding.linux-riscv64-musl.node')
|
|
245
263
|
} else {
|
|
246
|
-
nativeBinding = require('angular-rust-binding-linux-riscv64-musl')
|
|
264
|
+
nativeBinding = require('angular-rust-binding-linux-riscv64-musl')
|
|
247
265
|
}
|
|
248
266
|
} catch (e) {
|
|
249
|
-
loadError = e
|
|
267
|
+
loadError = e
|
|
250
268
|
}
|
|
251
269
|
} else {
|
|
252
|
-
localFileExisted = existsSync(
|
|
270
|
+
localFileExisted = existsSync(
|
|
271
|
+
join(__dirname, 'angular-binding.linux-riscv64-gnu.node')
|
|
272
|
+
)
|
|
253
273
|
try {
|
|
254
274
|
if (localFileExisted) {
|
|
255
|
-
nativeBinding = require('./angular-binding.linux-riscv64-gnu.node')
|
|
275
|
+
nativeBinding = require('./angular-binding.linux-riscv64-gnu.node')
|
|
256
276
|
} else {
|
|
257
|
-
nativeBinding = require('angular-rust-binding-linux-riscv64-gnu')
|
|
277
|
+
nativeBinding = require('angular-rust-binding-linux-riscv64-gnu')
|
|
258
278
|
}
|
|
259
279
|
} catch (e) {
|
|
260
|
-
loadError = e
|
|
280
|
+
loadError = e
|
|
261
281
|
}
|
|
262
282
|
}
|
|
263
|
-
break
|
|
283
|
+
break
|
|
264
284
|
case 's390x':
|
|
265
|
-
localFileExisted = existsSync(
|
|
285
|
+
localFileExisted = existsSync(
|
|
286
|
+
join(__dirname, 'angular-binding.linux-s390x-gnu.node')
|
|
287
|
+
)
|
|
266
288
|
try {
|
|
267
289
|
if (localFileExisted) {
|
|
268
|
-
nativeBinding = require('./angular-binding.linux-s390x-gnu.node')
|
|
290
|
+
nativeBinding = require('./angular-binding.linux-s390x-gnu.node')
|
|
269
291
|
} else {
|
|
270
|
-
nativeBinding = require('angular-rust-binding-linux-s390x-gnu')
|
|
292
|
+
nativeBinding = require('angular-rust-binding-linux-s390x-gnu')
|
|
271
293
|
}
|
|
272
294
|
} catch (e) {
|
|
273
|
-
loadError = e
|
|
295
|
+
loadError = e
|
|
274
296
|
}
|
|
275
|
-
break
|
|
297
|
+
break
|
|
276
298
|
default:
|
|
277
|
-
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
299
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
278
300
|
}
|
|
279
|
-
break
|
|
301
|
+
break
|
|
280
302
|
default:
|
|
281
|
-
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
303
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
282
304
|
}
|
|
283
305
|
|
|
284
306
|
if (!nativeBinding) {
|
|
285
307
|
if (loadError) {
|
|
286
|
-
throw loadError
|
|
308
|
+
throw loadError
|
|
287
309
|
}
|
|
288
|
-
throw new Error(`Failed to load native binding`)
|
|
310
|
+
throw new Error(`Failed to load native binding`)
|
|
289
311
|
}
|
|
290
312
|
|
|
291
|
-
const { Compiler, linkFile } = nativeBinding
|
|
313
|
+
const { Compiler, linkFile } = nativeBinding
|
|
292
314
|
|
|
293
|
-
module.exports.Compiler = Compiler
|
|
294
|
-
module.exports.linkFile = linkFile
|
|
315
|
+
module.exports.Compiler = Compiler
|
|
316
|
+
module.exports.linkFile = linkFile
|
package/compiler/index.cjs
CHANGED
|
@@ -30,6 +30,49 @@ var import_path = require("path");
|
|
|
30
30
|
var import_url = require("url");
|
|
31
31
|
var import_meta = {};
|
|
32
32
|
var compilerInstance = null;
|
|
33
|
+
var RED = "\x1B[31m";
|
|
34
|
+
var YELLOW = "\x1B[33m";
|
|
35
|
+
var CYAN = "\x1B[36m";
|
|
36
|
+
var BOLD = "\x1B[1m";
|
|
37
|
+
var RESET = "\x1B[0m";
|
|
38
|
+
function formatDiagnostic(diag, sourceCode) {
|
|
39
|
+
const level = "WARNING";
|
|
40
|
+
const codeStr = `NG${diag.code}`;
|
|
41
|
+
const file = diag.file || "unknown";
|
|
42
|
+
let line = 1;
|
|
43
|
+
let col = 0;
|
|
44
|
+
let lineStartPos = 0;
|
|
45
|
+
if (diag.start !== void 0 && diag.start !== null) {
|
|
46
|
+
for (let i = 0; i < diag.start && i < sourceCode.length; i++) {
|
|
47
|
+
if (sourceCode[i] === "\n") {
|
|
48
|
+
line++;
|
|
49
|
+
col = 0;
|
|
50
|
+
lineStartPos = i + 1;
|
|
51
|
+
} else {
|
|
52
|
+
col++;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
let output = `
|
|
57
|
+
${BOLD}${YELLOW}\u25B2 [${level}] ${RED}${codeStr}${RESET}${BOLD}: ${diag.message}${RESET} ${YELLOW}[plugin rust-ngc-plugin]${RESET}
|
|
58
|
+
`;
|
|
59
|
+
const lineStr = line.toString();
|
|
60
|
+
const colStr = (col + 1).toString();
|
|
61
|
+
output += `
|
|
62
|
+
${CYAN}${file}:${lineStr}:${colStr}:${RESET}
|
|
63
|
+
`;
|
|
64
|
+
let lineEndPos = sourceCode.indexOf("\n", lineStartPos);
|
|
65
|
+
if (lineEndPos === -1) lineEndPos = sourceCode.length;
|
|
66
|
+
const lineContent = sourceCode.substring(lineStartPos, lineEndPos);
|
|
67
|
+
output += ` ${BOLD}${lineStr} \u2502 ${RESET}${lineContent}
|
|
68
|
+
`;
|
|
69
|
+
const gutterWidth = lineStr.length + 3;
|
|
70
|
+
const gutterEmpty = " ".repeat(gutterWidth);
|
|
71
|
+
const length = diag.length || 1;
|
|
72
|
+
const underline = "~".repeat(length);
|
|
73
|
+
output += ` ${gutterEmpty}${" ".repeat(col)}${RED}${underline}${RESET}`;
|
|
74
|
+
return output;
|
|
75
|
+
}
|
|
33
76
|
function getCompiler(options) {
|
|
34
77
|
if (compilerInstance) {
|
|
35
78
|
return compilerInstance;
|
|
@@ -84,9 +127,26 @@ function angularCompilerVitePlugin(options) {
|
|
|
84
127
|
compiler = getCompiler(options);
|
|
85
128
|
}
|
|
86
129
|
if (id.includes("node_modules")) {
|
|
130
|
+
if (id.includes("@angular") && code.includes("\u0275\u0275ngDeclare")) {
|
|
131
|
+
const cleanId2 = id.split("?")[0];
|
|
132
|
+
if (cleanId2.endsWith(".mjs") || cleanId2.endsWith(".js")) {
|
|
133
|
+
try {
|
|
134
|
+
const result = compiler.linkFile(id, code);
|
|
135
|
+
if (result.startsWith("/* Linker Error")) {
|
|
136
|
+
if (debug) console.error(`[Linker Error] ${id}: ${result}`);
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
return { code: result, map: null };
|
|
140
|
+
} catch (e) {
|
|
141
|
+
if (debug) console.error(`Linker failed for ${id}:`, e);
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
87
146
|
return null;
|
|
88
147
|
}
|
|
89
|
-
|
|
148
|
+
const cleanId = id.split("?")[0];
|
|
149
|
+
if (!cleanId.endsWith(".ts") || cleanId.endsWith(".d.ts")) {
|
|
90
150
|
return null;
|
|
91
151
|
}
|
|
92
152
|
if (debug) {
|
|
@@ -94,15 +154,21 @@ function angularCompilerVitePlugin(options) {
|
|
|
94
154
|
}
|
|
95
155
|
try {
|
|
96
156
|
const result = compiler.compile(id, code);
|
|
97
|
-
|
|
157
|
+
const { code: compiledCode, diagnostics } = result;
|
|
158
|
+
if (compiledCode.startsWith("/* Error")) {
|
|
98
159
|
console.error(`[Angular Compiler Error] ${id}:
|
|
99
|
-
${
|
|
160
|
+
${compiledCode}`);
|
|
100
161
|
throw new Error(`Rust Compilation Failed for ${id}`);
|
|
101
162
|
}
|
|
163
|
+
if (diagnostics && diagnostics.length > 0) {
|
|
164
|
+
diagnostics.forEach((diag) => {
|
|
165
|
+
console.warn(formatDiagnostic(diag, code));
|
|
166
|
+
});
|
|
167
|
+
}
|
|
102
168
|
if (debug) {
|
|
103
169
|
console.log(`[Angular Compiler] Successfully compiled: ${id}`);
|
|
104
170
|
}
|
|
105
|
-
return { code:
|
|
171
|
+
return { code: compiledCode, map: null };
|
|
106
172
|
} catch (e) {
|
|
107
173
|
console.error(`[Angular Compiler Failed] ${id}:`, e);
|
|
108
174
|
throw e;
|
package/compiler/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/compiler/index.ts","../../src/compiler/vite.ts"],"sourcesContent":["/**\n * Angular Compiler Plugins - Index\n *\n * Re-exports all compiler plugins for different bundlers.\n */\n\nexport { angularCompilerVitePlugin } from \"./vite\";\nexport type { CompilerOptions } from \"./vite\";\nexport type { CompilerBinding } from \"./types\";\n","/**\n * Angular Compiler Plugin for Vite\n *\n * This plugin compiles Angular TypeScript files using the Rust-based Angular compiler.\n * Use with the linker plugin for a complete Angular build solution.\n *\n * @example\n * ```js\n * import { angularCompilerVitePlugin } from 'angular-rust-plugins/compiler/vite';\n * import { angularLinkerVitePlugin } from 'angular-rust-plugins/linker/vite';\n * import { defineConfig } from 'vite';\n *\n * export default defineConfig({\n * plugins: [\n * angularLinkerVitePlugin(),\n * angularCompilerVitePlugin(),\n * ],\n * });\n * ```\n */\n\nimport type { Plugin, HmrContext } from \"vite\";\nimport { createRequire } from \"module\";\nimport { dirname, join } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport type { CompilerBinding } from \"./types\";\n\nlet compilerInstance: CompilerBinding | null = null;\n\nexport interface CompilerOptions {\n /**\n * Enable debug logging\n * @default false\n */\n debug?: boolean;\n\n /**\n * Custom path to the Angular Rust binding package\n */\n bindingPath?: string;\n}\n\nfunction getCompiler(options?: CompilerOptions): CompilerBinding {\n if (compilerInstance) {\n return compilerInstance;\n }\n\n try {\n let binding: { Compiler: new () => CompilerBinding };\n\n if (options?.bindingPath) {\n const require = createRequire(import.meta.url);\n binding = require(options.bindingPath);\n } else {\n // Load from bundled binding directory\n // Use import.meta.url to get the actual location of this file\n const currentFileUrl = import.meta.url;\n const currentFilePath = fileURLToPath(currentFileUrl);\n const currentDir = dirname(currentFilePath);\n const require = createRequire(currentFileUrl);\n\n // Try multiple possible binding locations\n const possiblePaths = [\n join(currentDir, \"..\", \"binding\"), // dist/compiler/../binding\n join(currentDir, \"..\", \"..\", \"binding\"), // in case of deeper nesting\n join(currentDir, \"binding\"), // same directory\n ];\n\n let loadedBinding: { Compiler: new () => CompilerBinding } | null = null;\n let lastError: unknown = null;\n\n for (const bindingPath of possiblePaths) {\n try {\n loadedBinding = require(bindingPath);\n break;\n } catch (e) {\n lastError = e;\n }\n }\n\n if (!loadedBinding) {\n throw (\n lastError ||\n new Error(\"Could not find binding in any expected location\")\n );\n }\n\n binding = loadedBinding;\n }\n\n compilerInstance = new binding.Compiler();\n return compilerInstance;\n } catch (e) {\n throw new Error(`Failed to load Angular Rust binding. Error: ${e}`);\n }\n}\n\n/**\n * Creates a Vite plugin for Angular Rust compiler\n * Compiles .ts files (except .d.ts) using the Rust compiler\n */\nexport function angularCompilerVitePlugin(options?: CompilerOptions): Plugin {\n const debug = options?.debug ?? false;\n let compiler: CompilerBinding;\n\n return {\n name: \"angular-rust-compiler\",\n enforce: \"pre\",\n\n transform(code: string, id: string) {\n // Lazy initialize compiler\n if (!compiler) {\n compiler = getCompiler(options);\n }\n\n // Skip node_modules - those are handled by linker, not compiler\n if (id.includes(\"node_modules\")) {\n return null;\n }\n\n // Only process TypeScript files, skip declaration files\n if (!id.endsWith(\".ts\") || id.endsWith(\".d.ts\")) {\n return null;\n }\n\n if (debug) {\n console.log(`[Angular Compiler] Compiling: ${id}`);\n }\n\n try {\n const result = compiler.compile(id, code);\n\n if (result.startsWith(\"/* Error\")) {\n console.error(`[Angular Compiler Error] ${id}:\\n${result}`);\n throw new Error(`Rust Compilation Failed for ${id}`);\n }\n\n if (debug) {\n console.log(`[Angular Compiler] Successfully compiled: ${id}`);\n }\n\n return { code: result, map: null };\n } catch (e) {\n console.error(`[Angular Compiler Failed] ${id}:`, e);\n throw e;\n }\n },\n\n handleHotUpdate({ file, server }: HmrContext) {\n // When HTML template changes, invalidate the corresponding TS file\n if (file.endsWith(\".html\")) {\n const tsFile = file.replace(/\\.html$/, \".ts\");\n\n if (debug) {\n console.log(`[HMR] HTML changed: ${file}`);\n console.log(`[HMR] Invalidating TS: ${tsFile}`);\n }\n\n const mod = server.moduleGraph.getModuleById(tsFile);\n if (mod) {\n server.moduleGraph.invalidateModule(mod);\n server.ws.send({ type: \"full-reload\", path: \"*\" });\n return [];\n } else {\n server.ws.send({ type: \"full-reload\", path: \"*\" });\n return [];\n }\n }\n },\n };\n}\n\nexport default angularCompilerVitePlugin;\n"],"mappings":";;;;;;;;;;;;;;;;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/compiler/index.ts","../../src/compiler/vite.ts"],"sourcesContent":["/**\n * Angular Compiler Plugins - Index\n *\n * Re-exports all compiler plugins for different bundlers.\n */\n\nexport { angularCompilerVitePlugin } from \"./vite\";\nexport type { CompilerOptions } from \"./vite\";\n","/**\n * Angular Compiler Plugin for Vite\n *\n * This plugin compiles Angular TypeScript files using the Rust-based Angular compiler.\n * Use with the linker plugin for a complete Angular build solution.\n *\n * @example\n * ```js\n * import { angularCompilerVitePlugin } from 'angular-rust-plugins/compiler/vite';\n * import { angularLinkerVitePlugin } from 'angular-rust-plugins/linker/vite';\n * import { defineConfig } from 'vite';\n *\n * export default defineConfig({\n * plugins: [\n * angularLinkerVitePlugin(),\n * angularCompilerVitePlugin(),\n * ],\n * });\n * ```\n */\n\nimport type { Plugin, HmrContext } from \"vite\";\nimport { createRequire } from \"module\";\nimport { dirname, join } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { Compiler } from \"../binding\";\n\nlet compilerInstance: Compiler | null = null;\n\nexport interface CompilerOptions {\n /**\n * Enable debug logging\n * @default false\n */\n debug?: boolean;\n\n /**\n * Custom path to the Angular Rust binding package\n */\n bindingPath?: string;\n}\n\n// ============ Diagnostic Formatting ============\nconst RED = '\\x1b[31m';\nconst YELLOW = '\\x1b[33m';\nconst CYAN = '\\x1b[36m';\nconst BOLD = '\\x1b[1m';\nconst RESET = '\\x1b[0m';\n\nfunction formatDiagnostic(diag: any, sourceCode: string): string {\n const level = 'WARNING';\n const codeStr = `NG${diag.code}`;\n const file = diag.file || 'unknown';\n\n let line = 1;\n let col = 0;\n let lineStartPos = 0;\n\n if (diag.start !== undefined && diag.start !== null) {\n for (let i = 0; i < diag.start && i < sourceCode.length; i++) {\n if (sourceCode[i] === '\\n') {\n line++;\n col = 0;\n lineStartPos = i + 1;\n } else {\n col++;\n }\n }\n }\n\n let output = `\\n${BOLD}${YELLOW}▲ [${level}] ${RED}${codeStr}${RESET}${BOLD}: ${diag.message}${RESET} ${YELLOW}[plugin rust-ngc-plugin]${RESET}\\n`;\n\n const lineStr = line.toString();\n const colStr = (col + 1).toString();\n output += `\\n ${CYAN}${file}:${lineStr}:${colStr}:${RESET}\\n`;\n\n let lineEndPos = sourceCode.indexOf('\\n', lineStartPos);\n if (lineEndPos === -1) lineEndPos = sourceCode.length;\n const lineContent = sourceCode.substring(lineStartPos, lineEndPos);\n\n output += ` ${BOLD}${lineStr} │ ${RESET}${lineContent}\\n`;\n\n const gutterWidth = lineStr.length + 3;\n const gutterEmpty = ' '.repeat(gutterWidth);\n const length = diag.length || 1;\n const underline = '~'.repeat(length);\n\n output += ` ${gutterEmpty}${' '.repeat(col)}${RED}${underline}${RESET}`;\n\n return output;\n}\n\nfunction getCompiler(options?: CompilerOptions): Compiler {\n if (compilerInstance) {\n return compilerInstance;\n }\n\n try {\n let binding: { Compiler: new () => Compiler };\n\n if (options?.bindingPath) {\n const require = createRequire(import.meta.url);\n binding = require(options.bindingPath);\n } else {\n // Load from bundled binding directory\n // Use import.meta.url to get the actual location of this file\n const currentFileUrl = import.meta.url;\n const currentFilePath = fileURLToPath(currentFileUrl);\n const currentDir = dirname(currentFilePath);\n const require = createRequire(currentFileUrl);\n\n // Try multiple possible binding locations\n const possiblePaths = [\n join(currentDir, \"..\", \"binding\"), // dist/compiler/../binding\n join(currentDir, \"..\", \"..\", \"binding\"), // in case of deeper nesting\n join(currentDir, \"binding\"), // same directory\n ];\n\n let loadedBinding: { Compiler: new () => Compiler } | null = null;\n let lastError: unknown = null;\n\n for (const bindingPath of possiblePaths) {\n try {\n loadedBinding = require(bindingPath);\n break;\n } catch (e) {\n lastError = e;\n }\n }\n\n if (!loadedBinding) {\n throw (\n lastError ||\n new Error(\"Could not find binding in any expected location\")\n );\n }\n\n binding = loadedBinding;\n }\n\n compilerInstance = new binding.Compiler();\n return compilerInstance;\n } catch (e) {\n throw new Error(`Failed to load Angular Rust binding. Error: ${e}`);\n }\n}\n\n/**\n * Creates a Vite plugin for Angular Rust compiler\n * Compiles .ts files (except .d.ts) using the Rust compiler\n */\nexport function angularCompilerVitePlugin(options?: CompilerOptions): Plugin {\n const debug = options?.debug ?? false;\n let compiler: Compiler;\n\n return {\n name: \"angular-rust-compiler\",\n enforce: \"pre\",\n\n transform(code: string, id: string) {\n // Lazy initialize compiler\n if (!compiler) {\n compiler = getCompiler(options);\n }\n\n // Skip node_modules but check for Angular packages that need linking\n if (id.includes('node_modules')) {\n if (id.includes('@angular') && code.includes('ɵɵngDeclare')) {\n const cleanId = id.split('?')[0];\n if (cleanId.endsWith('.mjs') || cleanId.endsWith('.js')) {\n try {\n const result = compiler.linkFile(id, code);\n if (result.startsWith('/* Linker Error')) {\n if (debug) console.error(`[Linker Error] ${id}: ${result}`);\n return null;\n }\n return { code: result, map: null };\n } catch (e) {\n if (debug) console.error(`Linker failed for ${id}:`, e);\n return null;\n }\n }\n }\n return null;\n }\n\n // Only process TypeScript files, skip declaration files\n const cleanId = id.split('?')[0];\n if (!cleanId.endsWith('.ts') || cleanId.endsWith('.d.ts')) {\n return null;\n }\n\n if (debug) {\n console.log(`[Angular Compiler] Compiling: ${id}`);\n }\n\n try {\n const result = compiler.compile(id, code);\n\n // Handle structured result\n const { code: compiledCode, diagnostics } = result;\n\n if (compiledCode.startsWith('/* Error')) {\n console.error(`[Angular Compiler Error] ${id}:\\n${compiledCode}`);\n throw new Error(`Rust Compilation Failed for ${id}`);\n }\n\n if (diagnostics && diagnostics.length > 0) {\n diagnostics.forEach((diag: any) => {\n console.warn(formatDiagnostic(diag, code));\n });\n }\n\n if (debug) {\n console.log(`[Angular Compiler] Successfully compiled: ${id}`);\n }\n\n return { code: compiledCode, map: null };\n } catch (e) {\n console.error(`[Angular Compiler Failed] ${id}:`, e);\n throw e;\n }\n },\n\n handleHotUpdate({ file, server }: HmrContext) {\n // When HTML template changes, invalidate the corresponding TS file\n if (file.endsWith(\".html\")) {\n const tsFile = file.replace(/\\.html$/, \".ts\");\n\n if (debug) {\n console.log(`[HMR] HTML changed: ${file}`);\n console.log(`[HMR] Invalidating TS: ${tsFile}`);\n }\n\n const mod = server.moduleGraph.getModuleById(tsFile);\n if (mod) {\n server.moduleGraph.invalidateModule(mod);\n server.ws.send({ type: \"full-reload\", path: \"*\" });\n return [];\n } else {\n server.ws.send({ type: \"full-reload\", path: \"*\" });\n return [];\n }\n }\n },\n };\n}\n\nexport default angularCompilerVitePlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsBA,oBAA8B;AAC9B,kBAA8B;AAC9B,iBAA8B;AAxB9B;AA2BA,IAAI,mBAAoC;AAgBxC,IAAM,MAAM;AACZ,IAAM,SAAS;AACf,IAAM,OAAO;AACb,IAAM,OAAO;AACb,IAAM,QAAQ;AAEd,SAAS,iBAAiB,MAAW,YAA4B;AAC/D,QAAM,QAAQ;AACd,QAAM,UAAU,KAAK,KAAK,IAAI;AAC9B,QAAM,OAAO,KAAK,QAAQ;AAE1B,MAAI,OAAO;AACX,MAAI,MAAM;AACV,MAAI,eAAe;AAEnB,MAAI,KAAK,UAAU,UAAa,KAAK,UAAU,MAAM;AACnD,aAAS,IAAI,GAAG,IAAI,KAAK,SAAS,IAAI,WAAW,QAAQ,KAAK;AAC5D,UAAI,WAAW,CAAC,MAAM,MAAM;AAC1B;AACA,cAAM;AACN,uBAAe,IAAI;AAAA,MACrB,OAAO;AACL;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,SAAS;AAAA,EAAK,IAAI,GAAG,MAAM,WAAM,KAAK,KAAK,GAAG,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI,KAAK,KAAK,OAAO,GAAG,KAAK,IAAI,MAAM,2BAA2B,KAAK;AAAA;AAE9I,QAAM,UAAU,KAAK,SAAS;AAC9B,QAAM,UAAU,MAAM,GAAG,SAAS;AAClC,YAAU;AAAA,MAAS,IAAI,GAAG,IAAI,IAAI,OAAO,IAAI,MAAM,IAAI,KAAK;AAAA;AAE5D,MAAI,aAAa,WAAW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C,kBAAQ,MAAM,4BAA4B,EAAE;AAAA,EAAM,YAAY,EAAE;AAChE,gBAAM,IAAI,MAAM,+BAA+B,EAAE,EAAE;AAAA,QACrD;AAEA,YAAI,eAAe,YAAY,SAAS,GAAG;AACzC,sBAAY,QAAQ,CAAC,SAAc;AACjC,oBAAQ,KAAK,iBAAiB,MAAM,IAAI,CAAC;AAAA,UAC3C,CAAC;AAAA,QACH;AAEA,YAAI,OAAO;AACT,kBAAQ,IAAI,6CAA6C,EAAE,EAAE;AAAA,QAC/D;AAEA,eAAO,EAAE,MAAM,cAAc,KAAK,KAAK;AAAA,MACzC,SAAS,GAAG;AACV,gBAAQ,MAAM,6BAA6B,EAAE,KAAK,CAAC;AACnD,cAAM;AAAA,MACR;AAAA,IACF;AAAA,IAEA,gBAAgB,EAAE,MAAM,OAAO,GAAe;AAE5C,UAAI,KAAK,SAAS,OAAO,GAAG;AAC1B,cAAM,SAAS,KAAK,QAAQ,WAAW,KAAK;AAE5C,YAAI,OAAO;AACT,kBAAQ,IAAI,uBAAuB,IAAI,EAAE;AACzC,kBAAQ,IAAI,0BAA0B,MAAM,EAAE;AAAA,QAChD;AAEA,cAAM,MAAM,OAAO,YAAY,cAAc,MAAM;AACnD,YAAI,KAAK;AACP,iBAAO,YAAY,iBAAiB,GAAG;AACvC,iBAAO,GAAG,KAAK,EAAE,MAAM,eAAe,MAAM,IAAI,CAAC;AACjD,iBAAO,CAAC;AAAA,QACV,OAAO;AACL,iBAAO,GAAG,KAAK,EAAE,MAAM,eAAe,MAAM,IAAI,CAAC;AACjD,iBAAO,CAAC;AAAA,QACV;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["require","cleanId"]}
|
package/compiler/index.d.cts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
export { CompilerOptions, default as angularCompilerVitePlugin } from './vite.cjs';
|
|
2
2
|
import 'vite';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Compiler Types
|
|
6
|
-
*/
|
|
7
|
-
interface CompilerBinding {
|
|
8
|
-
compile(filePath: string, code: string): string;
|
|
9
|
-
linkFile(filePath: string, code: string): string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type { CompilerBinding };
|
package/compiler/index.d.ts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
export { CompilerOptions, default as angularCompilerVitePlugin } from './vite.js';
|
|
2
2
|
import 'vite';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Compiler Types
|
|
6
|
-
*/
|
|
7
|
-
interface CompilerBinding {
|
|
8
|
-
compile(filePath: string, code: string): string;
|
|
9
|
-
linkFile(filePath: string, code: string): string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type { CompilerBinding };
|