angular-rust-plugins 0.2.0 → 0.4.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/README.md +237 -27
- package/binding/angular-binding.darwin-arm64.node +0 -0
- package/binding/index.d.ts +6 -6
- package/binding/index.js +110 -132
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,43 +4,145 @@ High-performance Angular linker and compiler plugins powered by Rust. Supports *
|
|
|
4
4
|
|
|
5
5
|
This package bundles the Angular Rust binding - no additional dependencies needed!
|
|
6
6
|
|
|
7
|
+
## ✨ Features
|
|
8
|
+
|
|
9
|
+
- ✅ **Standard Directives**: Full support for `*ngIf` (with `else`, `then`, `as`) and `*ngFor` (with all context variables).
|
|
10
|
+
- ✅ **Template Parity**: 100% output parity with NGTSC for template instructions and `consts` array sorting.
|
|
11
|
+
- ✅ **Change Detection**: Optimized listener emission for `OnPush` components.
|
|
12
|
+
- ✅ **Signal Support**: Full support for modern Angular signals (`input()`, `output()`, `computed()`, etc.).
|
|
13
|
+
- ✅ **Blazing Fast**: Uses the Rust-based compiler for ~3-5x faster compilation compared to standard TypeScript-based compilation.
|
|
14
|
+
|
|
7
15
|
## 🚀 Installation
|
|
8
16
|
|
|
9
17
|
```bash
|
|
10
18
|
npm install angular-rust-plugins
|
|
11
19
|
```
|
|
12
20
|
|
|
13
|
-
##
|
|
21
|
+
## 📋 Quick Start
|
|
22
|
+
|
|
23
|
+
### 1. Create `index.html`
|
|
24
|
+
|
|
25
|
+
Create an `index.html` file at the root of your project:
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<!doctype html>
|
|
29
|
+
<html lang="en">
|
|
30
|
+
<head>
|
|
31
|
+
<meta charset="utf-8">
|
|
32
|
+
<title>My Angular App</title>
|
|
33
|
+
<base href="/">
|
|
34
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
35
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
36
|
+
</head>
|
|
37
|
+
<body>
|
|
38
|
+
<app-root></app-root>
|
|
39
|
+
<script type="module" src="/src/main.ts"></script>
|
|
40
|
+
</body>
|
|
41
|
+
</html>
|
|
42
|
+
```
|
|
14
43
|
|
|
15
|
-
###
|
|
44
|
+
### 2. Create `vite.config.mjs`
|
|
16
45
|
|
|
17
46
|
```js
|
|
18
|
-
// vite.config.js
|
|
19
47
|
import { defineConfig } from "vite";
|
|
20
|
-
import {
|
|
48
|
+
import { angularLinkerRolldownPlugin } from "angular-rust-plugins/linker/rolldown";
|
|
49
|
+
import { angularCompilerVitePlugin } from "angular-rust-plugins/compiler/vite";
|
|
50
|
+
|
|
51
|
+
export default defineConfig({
|
|
52
|
+
plugins: [
|
|
53
|
+
// Linker plugin - processes @angular/* packages in node_modules
|
|
54
|
+
angularLinkerRolldownPlugin(),
|
|
55
|
+
// Compiler plugin - compiles your .ts files with Angular decorators
|
|
56
|
+
angularCompilerVitePlugin(),
|
|
57
|
+
],
|
|
58
|
+
resolve: {
|
|
59
|
+
extensions: [".ts", ".js", ".json"],
|
|
60
|
+
},
|
|
61
|
+
server: {
|
|
62
|
+
port: 4200,
|
|
63
|
+
},
|
|
64
|
+
optimizeDeps: {
|
|
65
|
+
// Exclude Angular packages from pre-bundling so linker plugin can process them
|
|
66
|
+
exclude: [
|
|
67
|
+
"@angular/core",
|
|
68
|
+
"@angular/common",
|
|
69
|
+
"@angular/platform-browser",
|
|
70
|
+
"@angular/router",
|
|
71
|
+
"@angular/forms",
|
|
72
|
+
],
|
|
73
|
+
// Still include zone.js and rxjs which don't need linking
|
|
74
|
+
include: ["zone.js", "rxjs", "rxjs/operators"],
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 3. Run dev server
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx vite
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 📖 Complete Configuration Examples
|
|
86
|
+
|
|
87
|
+
### Full Angular Setup with Vite (Recommended)
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
// vite.config.mjs
|
|
91
|
+
import { defineConfig } from "vite";
|
|
92
|
+
import { angularLinkerRolldownPlugin } from "angular-rust-plugins/linker/rolldown";
|
|
21
93
|
import { angularCompilerVitePlugin } from "angular-rust-plugins/compiler/vite";
|
|
22
94
|
|
|
23
95
|
export default defineConfig({
|
|
24
96
|
plugins: [
|
|
25
|
-
|
|
26
|
-
angularCompilerVitePlugin(
|
|
97
|
+
angularLinkerRolldownPlugin({ debug: false }),
|
|
98
|
+
angularCompilerVitePlugin({ debug: false }),
|
|
27
99
|
],
|
|
100
|
+
resolve: {
|
|
101
|
+
extensions: [".ts", ".js", ".json"],
|
|
102
|
+
},
|
|
103
|
+
server: {
|
|
104
|
+
port: 4200,
|
|
105
|
+
open: true, // Open browser automatically
|
|
106
|
+
},
|
|
107
|
+
build: {
|
|
108
|
+
target: "esnext",
|
|
109
|
+
sourcemap: true,
|
|
110
|
+
},
|
|
111
|
+
optimizeDeps: {
|
|
112
|
+
exclude: [
|
|
113
|
+
"@angular/core",
|
|
114
|
+
"@angular/common",
|
|
115
|
+
"@angular/platform-browser",
|
|
116
|
+
"@angular/router",
|
|
117
|
+
"@angular/forms",
|
|
118
|
+
"@angular/animations",
|
|
119
|
+
"@angular/platform-browser-dynamic",
|
|
120
|
+
],
|
|
121
|
+
include: ["zone.js", "rxjs", "rxjs/operators"],
|
|
122
|
+
},
|
|
28
123
|
});
|
|
29
124
|
```
|
|
30
125
|
|
|
31
|
-
### Linker Only (Vite)
|
|
126
|
+
### Linker Only (Vite) - For existing Angular projects
|
|
127
|
+
|
|
128
|
+
If you only need the linker (for pre-AOT compiled Angular libraries):
|
|
32
129
|
|
|
33
130
|
```js
|
|
131
|
+
import { defineConfig } from "vite";
|
|
34
132
|
import { angularLinkerVitePlugin } from "angular-rust-plugins/linker/vite";
|
|
35
133
|
|
|
36
134
|
export default defineConfig({
|
|
37
135
|
plugins: [angularLinkerVitePlugin()],
|
|
136
|
+
optimizeDeps: {
|
|
137
|
+
exclude: ["@angular/core", "@angular/common", "@angular/platform-browser"],
|
|
138
|
+
},
|
|
38
139
|
});
|
|
39
140
|
```
|
|
40
141
|
|
|
41
|
-
### Linker with Rolldown
|
|
142
|
+
### Linker with Rolldown (for Vite 6+)
|
|
42
143
|
|
|
43
144
|
```js
|
|
145
|
+
import { defineConfig } from "vite";
|
|
44
146
|
import { angularLinkerRolldownPlugin } from "angular-rust-plugins/linker/rolldown";
|
|
45
147
|
|
|
46
148
|
export default defineConfig({
|
|
@@ -54,26 +156,30 @@ export default defineConfig({
|
|
|
54
156
|
### Linker with esbuild
|
|
55
157
|
|
|
56
158
|
```js
|
|
159
|
+
import esbuild from "esbuild";
|
|
57
160
|
import { angularLinkerEsbuildPlugin } from "angular-rust-plugins/linker/esbuild";
|
|
58
161
|
|
|
59
162
|
esbuild.build({
|
|
163
|
+
entryPoints: ["src/main.ts"],
|
|
164
|
+
bundle: true,
|
|
165
|
+
outfile: "dist/bundle.js",
|
|
60
166
|
plugins: [angularLinkerEsbuildPlugin()],
|
|
61
167
|
});
|
|
62
168
|
```
|
|
63
169
|
|
|
64
170
|
## 📦 Package Exports
|
|
65
171
|
|
|
66
|
-
| Export Path | Description
|
|
67
|
-
| -------------------------------------- |
|
|
68
|
-
| `angular-rust-plugins` | All plugins
|
|
69
|
-
| **Linker Plugins** |
|
|
70
|
-
| `angular-rust-plugins/linker` | All linker plugins
|
|
71
|
-
| `angular-rust-plugins/linker/vite` | Vite linker plugin
|
|
72
|
-
| `angular-rust-plugins/linker/esbuild` | esbuild linker plugin
|
|
73
|
-
| `angular-rust-plugins/linker/rolldown` | Rolldown linker plugin
|
|
74
|
-
| **Compiler Plugins** |
|
|
75
|
-
| `angular-rust-plugins/compiler` | All compiler plugins
|
|
76
|
-
| `angular-rust-plugins/compiler/vite` | Vite compiler plugin
|
|
172
|
+
| Export Path | Description |
|
|
173
|
+
| -------------------------------------- | ---------------------------------- |
|
|
174
|
+
| `angular-rust-plugins` | All plugins |
|
|
175
|
+
| **Linker Plugins** | |
|
|
176
|
+
| `angular-rust-plugins/linker` | All linker plugins |
|
|
177
|
+
| `angular-rust-plugins/linker/vite` | Vite linker plugin (esbuild-based) |
|
|
178
|
+
| `angular-rust-plugins/linker/esbuild` | esbuild linker plugin |
|
|
179
|
+
| `angular-rust-plugins/linker/rolldown` | Rolldown linker plugin |
|
|
180
|
+
| **Compiler Plugins** | |
|
|
181
|
+
| `angular-rust-plugins/compiler` | All compiler plugins |
|
|
182
|
+
| `angular-rust-plugins/compiler/vite` | Vite compiler plugin |
|
|
77
183
|
|
|
78
184
|
## ⚙️ Options
|
|
79
185
|
|
|
@@ -81,8 +187,8 @@ esbuild.build({
|
|
|
81
187
|
|
|
82
188
|
```ts
|
|
83
189
|
interface LinkerOptions {
|
|
84
|
-
debug?: boolean; // Enable debug logging
|
|
85
|
-
bindingPath?: string; // Custom path to binding
|
|
190
|
+
debug?: boolean; // Enable debug logging (default: false)
|
|
191
|
+
bindingPath?: string; // Custom path to binding (optional)
|
|
86
192
|
}
|
|
87
193
|
```
|
|
88
194
|
|
|
@@ -90,11 +196,119 @@ interface LinkerOptions {
|
|
|
90
196
|
|
|
91
197
|
```ts
|
|
92
198
|
interface CompilerOptions {
|
|
93
|
-
debug?: boolean; // Enable debug logging
|
|
94
|
-
bindingPath?: string; // Custom path to binding
|
|
199
|
+
debug?: boolean; // Enable debug logging (default: false)
|
|
200
|
+
bindingPath?: string; // Custom path to binding (optional)
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## 📁 Project Structure
|
|
205
|
+
|
|
206
|
+
Your Angular project should have this structure:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
my-angular-app/
|
|
210
|
+
├── index.html # Entry HTML file
|
|
211
|
+
├── vite.config.mjs # Vite configuration
|
|
212
|
+
├── package.json
|
|
213
|
+
├── tsconfig.json
|
|
214
|
+
├── src/
|
|
215
|
+
│ ├── main.ts # Bootstrap entry
|
|
216
|
+
│ ├── styles.css # Global styles
|
|
217
|
+
│ └── app/
|
|
218
|
+
│ ├── app.ts # Root component
|
|
219
|
+
│ ├── app.html # Root template
|
|
220
|
+
│ └── app.config.ts # App configuration
|
|
221
|
+
└── public/
|
|
222
|
+
└── favicon.ico
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Example `src/main.ts`
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { bootstrapApplication } from "@angular/platform-browser";
|
|
229
|
+
import { appConfig } from "./app/app.config";
|
|
230
|
+
import { App } from "./app/app";
|
|
231
|
+
|
|
232
|
+
bootstrapApplication(App, appConfig).catch((err) => console.error(err));
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Example `src/app/app.ts`
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
import { Component } from "@angular/core";
|
|
239
|
+
|
|
240
|
+
@Component({
|
|
241
|
+
selector: "app-root",
|
|
242
|
+
standalone: true,
|
|
243
|
+
templateUrl: "./app.html",
|
|
244
|
+
styleUrl: "./app.css",
|
|
245
|
+
})
|
|
246
|
+
export class App {
|
|
247
|
+
title = "My Angular App";
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## 🔧 Troubleshooting
|
|
252
|
+
|
|
253
|
+
### Angular packages not being linked
|
|
254
|
+
|
|
255
|
+
Make sure Angular packages are excluded from `optimizeDeps`:
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
optimizeDeps: {
|
|
259
|
+
exclude: [
|
|
260
|
+
"@angular/core",
|
|
261
|
+
"@angular/common",
|
|
262
|
+
"@angular/platform-browser",
|
|
263
|
+
// Add other @angular/* packages you use
|
|
264
|
+
],
|
|
95
265
|
}
|
|
96
266
|
```
|
|
97
267
|
|
|
268
|
+
### TypeScript compilation errors
|
|
269
|
+
|
|
270
|
+
Ensure your `tsconfig.json` includes:
|
|
271
|
+
|
|
272
|
+
```json
|
|
273
|
+
{
|
|
274
|
+
"compilerOptions": {
|
|
275
|
+
"target": "ES2022",
|
|
276
|
+
"module": "ES2022",
|
|
277
|
+
"moduleResolution": "bundler",
|
|
278
|
+
"experimentalDecorators": true,
|
|
279
|
+
"emitDecoratorMetadata": true
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### HMR (Hot Module Replacement)
|
|
285
|
+
|
|
286
|
+
The compiler plugin includes HMR support for `.html` template files. When you modify a template, the corresponding component will be recompiled automatically.
|
|
287
|
+
|
|
288
|
+
## 💡 Advanced Directive Support
|
|
289
|
+
|
|
290
|
+
The compiler now achieves full feature parity with the standard Angular compiler for core structural directives:
|
|
291
|
+
|
|
292
|
+
### `*ngFor` Support
|
|
293
|
+
- **Full Context Access**: Support for `index`, `count`, `first`, `last`, `even`, `odd`.
|
|
294
|
+
- **Performance**: Automatic optimization of context access in event listeners.
|
|
295
|
+
- **Parity**: Identical `consts` array ordering through source-span sorting.
|
|
296
|
+
|
|
297
|
+
### `*ngIf` Support
|
|
298
|
+
- **Complex Templates**: Support for `else` and `then` templates with `TemplateRef` extraction.
|
|
299
|
+
- **As Syntax**: Support for the `as` local variable binding (e.g., `*ngIf="obs$ | async as val"`).
|
|
300
|
+
- **Context Isolation**: Correct variable scoping and restoration for nested conditionals.
|
|
301
|
+
|
|
302
|
+
## ⚡ Performance
|
|
303
|
+
|
|
304
|
+
**2-5x faster** than TypeScript-based Angular compiler with lower memory usage.
|
|
305
|
+
|
|
306
|
+
| Metric | angular-rust-plugins | Angular CLI |
|
|
307
|
+
| --------------- | -------------------- | ----------- |
|
|
308
|
+
| Initial compile | ~500ms | ~2000ms |
|
|
309
|
+
| HMR update | ~50ms | ~200ms |
|
|
310
|
+
| Memory usage | ~100MB | ~500MB |
|
|
311
|
+
|
|
98
312
|
## 🔧 Development
|
|
99
313
|
|
|
100
314
|
```bash
|
|
@@ -105,10 +319,6 @@ npm run build
|
|
|
105
319
|
npm run build:full
|
|
106
320
|
```
|
|
107
321
|
|
|
108
|
-
## ⚡ Performance
|
|
109
|
-
|
|
110
|
-
**2-5x faster** than TypeScript-based Angular compiler with lower memory usage.
|
|
111
|
-
|
|
112
322
|
## 📝 License
|
|
113
323
|
|
|
114
324
|
MIT
|
|
Binary file
|
package/binding/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
-
export declare function linkFile(sourceCode: string, filename: string): string
|
|
6
|
+
export declare function linkFile(sourceCode: string, filename: string): string;
|
|
7
7
|
export declare class Compiler {
|
|
8
|
-
constructor()
|
|
9
|
-
compile(filename: string, content: string): string
|
|
10
|
-
constructor()
|
|
11
|
-
compile(filename: string, content: string): string
|
|
12
|
-
linkFile(filename: string, sourceCode: string): string
|
|
8
|
+
constructor();
|
|
9
|
+
compile(filename: string, content: string): string;
|
|
10
|
+
constructor();
|
|
11
|
+
compile(filename: string, content: string): string;
|
|
12
|
+
linkFile(filename: string, sourceCode: string): string;
|
|
13
13
|
}
|
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,285 +32,263 @@ 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('
|
|
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('
|
|
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(
|
|
66
|
-
join(__dirname, 'angular-binding.win32-x64-msvc.node')
|
|
67
|
-
)
|
|
65
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.win32-x64-msvc.node'));
|
|
68
66
|
try {
|
|
69
67
|
if (localFileExisted) {
|
|
70
|
-
nativeBinding = require('./angular-binding.win32-x64-msvc.node')
|
|
68
|
+
nativeBinding = require('./angular-binding.win32-x64-msvc.node');
|
|
71
69
|
} else {
|
|
72
|
-
nativeBinding = require('
|
|
70
|
+
nativeBinding = require('angular-rust-binding-win32-x64-msvc');
|
|
73
71
|
}
|
|
74
72
|
} catch (e) {
|
|
75
|
-
loadError = e
|
|
73
|
+
loadError = e;
|
|
76
74
|
}
|
|
77
|
-
break
|
|
75
|
+
break;
|
|
78
76
|
case 'ia32':
|
|
79
|
-
localFileExisted = existsSync(
|
|
80
|
-
join(__dirname, 'angular-binding.win32-ia32-msvc.node')
|
|
81
|
-
)
|
|
77
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.win32-ia32-msvc.node'));
|
|
82
78
|
try {
|
|
83
79
|
if (localFileExisted) {
|
|
84
|
-
nativeBinding = require('./angular-binding.win32-ia32-msvc.node')
|
|
80
|
+
nativeBinding = require('./angular-binding.win32-ia32-msvc.node');
|
|
85
81
|
} else {
|
|
86
|
-
nativeBinding = require('
|
|
82
|
+
nativeBinding = require('angular-rust-binding-win32-ia32-msvc');
|
|
87
83
|
}
|
|
88
84
|
} catch (e) {
|
|
89
|
-
loadError = e
|
|
85
|
+
loadError = e;
|
|
90
86
|
}
|
|
91
|
-
break
|
|
87
|
+
break;
|
|
92
88
|
case 'arm64':
|
|
93
|
-
localFileExisted = existsSync(
|
|
94
|
-
join(__dirname, 'angular-binding.win32-arm64-msvc.node')
|
|
95
|
-
)
|
|
89
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.win32-arm64-msvc.node'));
|
|
96
90
|
try {
|
|
97
91
|
if (localFileExisted) {
|
|
98
|
-
nativeBinding = require('./angular-binding.win32-arm64-msvc.node')
|
|
92
|
+
nativeBinding = require('./angular-binding.win32-arm64-msvc.node');
|
|
99
93
|
} else {
|
|
100
|
-
nativeBinding = require('
|
|
94
|
+
nativeBinding = require('angular-rust-binding-win32-arm64-msvc');
|
|
101
95
|
}
|
|
102
96
|
} catch (e) {
|
|
103
|
-
loadError = e
|
|
97
|
+
loadError = e;
|
|
104
98
|
}
|
|
105
|
-
break
|
|
99
|
+
break;
|
|
106
100
|
default:
|
|
107
|
-
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
101
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`);
|
|
108
102
|
}
|
|
109
|
-
break
|
|
103
|
+
break;
|
|
110
104
|
case 'darwin':
|
|
111
|
-
localFileExisted = existsSync(join(__dirname, 'angular-binding.darwin-universal.node'))
|
|
105
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.darwin-universal.node'));
|
|
112
106
|
try {
|
|
113
107
|
if (localFileExisted) {
|
|
114
|
-
nativeBinding = require('./angular-binding.darwin-universal.node')
|
|
108
|
+
nativeBinding = require('./angular-binding.darwin-universal.node');
|
|
115
109
|
} else {
|
|
116
|
-
nativeBinding = require('
|
|
110
|
+
nativeBinding = require('angular-rust-binding-darwin-universal');
|
|
117
111
|
}
|
|
118
|
-
break
|
|
112
|
+
break;
|
|
119
113
|
} catch {}
|
|
120
114
|
switch (arch) {
|
|
121
115
|
case 'x64':
|
|
122
|
-
localFileExisted = existsSync(join(__dirname, 'angular-binding.darwin-x64.node'))
|
|
116
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.darwin-x64.node'));
|
|
123
117
|
try {
|
|
124
118
|
if (localFileExisted) {
|
|
125
|
-
nativeBinding = require('./angular-binding.darwin-x64.node')
|
|
119
|
+
nativeBinding = require('./angular-binding.darwin-x64.node');
|
|
126
120
|
} else {
|
|
127
|
-
nativeBinding = require('
|
|
121
|
+
nativeBinding = require('angular-rust-binding-darwin-x64');
|
|
128
122
|
}
|
|
129
123
|
} catch (e) {
|
|
130
|
-
loadError = e
|
|
124
|
+
loadError = e;
|
|
131
125
|
}
|
|
132
|
-
break
|
|
126
|
+
break;
|
|
133
127
|
case 'arm64':
|
|
134
|
-
localFileExisted = existsSync(
|
|
135
|
-
join(__dirname, 'angular-binding.darwin-arm64.node')
|
|
136
|
-
)
|
|
128
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.darwin-arm64.node'));
|
|
137
129
|
try {
|
|
138
130
|
if (localFileExisted) {
|
|
139
|
-
nativeBinding = require('./angular-binding.darwin-arm64.node')
|
|
131
|
+
nativeBinding = require('./angular-binding.darwin-arm64.node');
|
|
140
132
|
} else {
|
|
141
|
-
nativeBinding = require('
|
|
133
|
+
nativeBinding = require('angular-rust-binding-darwin-arm64');
|
|
142
134
|
}
|
|
143
135
|
} catch (e) {
|
|
144
|
-
loadError = e
|
|
136
|
+
loadError = e;
|
|
145
137
|
}
|
|
146
|
-
break
|
|
138
|
+
break;
|
|
147
139
|
default:
|
|
148
|
-
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
140
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`);
|
|
149
141
|
}
|
|
150
|
-
break
|
|
142
|
+
break;
|
|
151
143
|
case 'freebsd':
|
|
152
144
|
if (arch !== 'x64') {
|
|
153
|
-
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
145
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
|
|
154
146
|
}
|
|
155
|
-
localFileExisted = existsSync(join(__dirname, 'angular-binding.freebsd-x64.node'))
|
|
147
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.freebsd-x64.node'));
|
|
156
148
|
try {
|
|
157
149
|
if (localFileExisted) {
|
|
158
|
-
nativeBinding = require('./angular-binding.freebsd-x64.node')
|
|
150
|
+
nativeBinding = require('./angular-binding.freebsd-x64.node');
|
|
159
151
|
} else {
|
|
160
|
-
nativeBinding = require('
|
|
152
|
+
nativeBinding = require('angular-rust-binding-freebsd-x64');
|
|
161
153
|
}
|
|
162
154
|
} catch (e) {
|
|
163
|
-
loadError = e
|
|
155
|
+
loadError = e;
|
|
164
156
|
}
|
|
165
|
-
break
|
|
157
|
+
break;
|
|
166
158
|
case 'linux':
|
|
167
159
|
switch (arch) {
|
|
168
160
|
case 'x64':
|
|
169
161
|
if (isMusl()) {
|
|
170
|
-
localFileExisted = existsSync(
|
|
171
|
-
join(__dirname, 'angular-binding.linux-x64-musl.node')
|
|
172
|
-
)
|
|
162
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.linux-x64-musl.node'));
|
|
173
163
|
try {
|
|
174
164
|
if (localFileExisted) {
|
|
175
|
-
nativeBinding = require('./angular-binding.linux-x64-musl.node')
|
|
165
|
+
nativeBinding = require('./angular-binding.linux-x64-musl.node');
|
|
176
166
|
} else {
|
|
177
|
-
nativeBinding = require('
|
|
167
|
+
nativeBinding = require('angular-rust-binding-linux-x64-musl');
|
|
178
168
|
}
|
|
179
169
|
} catch (e) {
|
|
180
|
-
loadError = e
|
|
170
|
+
loadError = e;
|
|
181
171
|
}
|
|
182
172
|
} else {
|
|
183
|
-
localFileExisted = existsSync(
|
|
184
|
-
join(__dirname, 'angular-binding.linux-x64-gnu.node')
|
|
185
|
-
)
|
|
173
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.linux-x64-gnu.node'));
|
|
186
174
|
try {
|
|
187
175
|
if (localFileExisted) {
|
|
188
|
-
nativeBinding = require('./angular-binding.linux-x64-gnu.node')
|
|
176
|
+
nativeBinding = require('./angular-binding.linux-x64-gnu.node');
|
|
189
177
|
} else {
|
|
190
|
-
nativeBinding = require('
|
|
178
|
+
nativeBinding = require('angular-rust-binding-linux-x64-gnu');
|
|
191
179
|
}
|
|
192
180
|
} catch (e) {
|
|
193
|
-
loadError = e
|
|
181
|
+
loadError = e;
|
|
194
182
|
}
|
|
195
183
|
}
|
|
196
|
-
break
|
|
184
|
+
break;
|
|
197
185
|
case 'arm64':
|
|
198
186
|
if (isMusl()) {
|
|
199
|
-
localFileExisted = existsSync(
|
|
200
|
-
join(__dirname, 'angular-binding.linux-arm64-musl.node')
|
|
201
|
-
)
|
|
187
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.linux-arm64-musl.node'));
|
|
202
188
|
try {
|
|
203
189
|
if (localFileExisted) {
|
|
204
|
-
nativeBinding = require('./angular-binding.linux-arm64-musl.node')
|
|
190
|
+
nativeBinding = require('./angular-binding.linux-arm64-musl.node');
|
|
205
191
|
} else {
|
|
206
|
-
nativeBinding = require('
|
|
192
|
+
nativeBinding = require('angular-rust-binding-linux-arm64-musl');
|
|
207
193
|
}
|
|
208
194
|
} catch (e) {
|
|
209
|
-
loadError = e
|
|
195
|
+
loadError = e;
|
|
210
196
|
}
|
|
211
197
|
} else {
|
|
212
|
-
localFileExisted = existsSync(
|
|
213
|
-
join(__dirname, 'angular-binding.linux-arm64-gnu.node')
|
|
214
|
-
)
|
|
198
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.linux-arm64-gnu.node'));
|
|
215
199
|
try {
|
|
216
200
|
if (localFileExisted) {
|
|
217
|
-
nativeBinding = require('./angular-binding.linux-arm64-gnu.node')
|
|
201
|
+
nativeBinding = require('./angular-binding.linux-arm64-gnu.node');
|
|
218
202
|
} else {
|
|
219
|
-
nativeBinding = require('
|
|
203
|
+
nativeBinding = require('angular-rust-binding-linux-arm64-gnu');
|
|
220
204
|
}
|
|
221
205
|
} catch (e) {
|
|
222
|
-
loadError = e
|
|
206
|
+
loadError = e;
|
|
223
207
|
}
|
|
224
208
|
}
|
|
225
|
-
break
|
|
209
|
+
break;
|
|
226
210
|
case 'arm':
|
|
227
211
|
if (isMusl()) {
|
|
228
212
|
localFileExisted = existsSync(
|
|
229
213
|
join(__dirname, 'angular-binding.linux-arm-musleabihf.node')
|
|
230
|
-
)
|
|
214
|
+
);
|
|
231
215
|
try {
|
|
232
216
|
if (localFileExisted) {
|
|
233
|
-
nativeBinding = require('./angular-binding.linux-arm-musleabihf.node')
|
|
217
|
+
nativeBinding = require('./angular-binding.linux-arm-musleabihf.node');
|
|
234
218
|
} else {
|
|
235
|
-
nativeBinding = require('
|
|
219
|
+
nativeBinding = require('angular-rust-binding-linux-arm-musleabihf');
|
|
236
220
|
}
|
|
237
221
|
} catch (e) {
|
|
238
|
-
loadError = e
|
|
222
|
+
loadError = e;
|
|
239
223
|
}
|
|
240
224
|
} else {
|
|
241
225
|
localFileExisted = existsSync(
|
|
242
226
|
join(__dirname, 'angular-binding.linux-arm-gnueabihf.node')
|
|
243
|
-
)
|
|
227
|
+
);
|
|
244
228
|
try {
|
|
245
229
|
if (localFileExisted) {
|
|
246
|
-
nativeBinding = require('./angular-binding.linux-arm-gnueabihf.node')
|
|
230
|
+
nativeBinding = require('./angular-binding.linux-arm-gnueabihf.node');
|
|
247
231
|
} else {
|
|
248
|
-
nativeBinding = require('
|
|
232
|
+
nativeBinding = require('angular-rust-binding-linux-arm-gnueabihf');
|
|
249
233
|
}
|
|
250
234
|
} catch (e) {
|
|
251
|
-
loadError = e
|
|
235
|
+
loadError = e;
|
|
252
236
|
}
|
|
253
237
|
}
|
|
254
|
-
break
|
|
238
|
+
break;
|
|
255
239
|
case 'riscv64':
|
|
256
240
|
if (isMusl()) {
|
|
257
|
-
localFileExisted = existsSync(
|
|
258
|
-
join(__dirname, 'angular-binding.linux-riscv64-musl.node')
|
|
259
|
-
)
|
|
241
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.linux-riscv64-musl.node'));
|
|
260
242
|
try {
|
|
261
243
|
if (localFileExisted) {
|
|
262
|
-
nativeBinding = require('./angular-binding.linux-riscv64-musl.node')
|
|
244
|
+
nativeBinding = require('./angular-binding.linux-riscv64-musl.node');
|
|
263
245
|
} else {
|
|
264
|
-
nativeBinding = require('
|
|
246
|
+
nativeBinding = require('angular-rust-binding-linux-riscv64-musl');
|
|
265
247
|
}
|
|
266
248
|
} catch (e) {
|
|
267
|
-
loadError = e
|
|
249
|
+
loadError = e;
|
|
268
250
|
}
|
|
269
251
|
} else {
|
|
270
|
-
localFileExisted = existsSync(
|
|
271
|
-
join(__dirname, 'angular-binding.linux-riscv64-gnu.node')
|
|
272
|
-
)
|
|
252
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.linux-riscv64-gnu.node'));
|
|
273
253
|
try {
|
|
274
254
|
if (localFileExisted) {
|
|
275
|
-
nativeBinding = require('./angular-binding.linux-riscv64-gnu.node')
|
|
255
|
+
nativeBinding = require('./angular-binding.linux-riscv64-gnu.node');
|
|
276
256
|
} else {
|
|
277
|
-
nativeBinding = require('
|
|
257
|
+
nativeBinding = require('angular-rust-binding-linux-riscv64-gnu');
|
|
278
258
|
}
|
|
279
259
|
} catch (e) {
|
|
280
|
-
loadError = e
|
|
260
|
+
loadError = e;
|
|
281
261
|
}
|
|
282
262
|
}
|
|
283
|
-
break
|
|
263
|
+
break;
|
|
284
264
|
case 's390x':
|
|
285
|
-
localFileExisted = existsSync(
|
|
286
|
-
join(__dirname, 'angular-binding.linux-s390x-gnu.node')
|
|
287
|
-
)
|
|
265
|
+
localFileExisted = existsSync(join(__dirname, 'angular-binding.linux-s390x-gnu.node'));
|
|
288
266
|
try {
|
|
289
267
|
if (localFileExisted) {
|
|
290
|
-
nativeBinding = require('./angular-binding.linux-s390x-gnu.node')
|
|
268
|
+
nativeBinding = require('./angular-binding.linux-s390x-gnu.node');
|
|
291
269
|
} else {
|
|
292
|
-
nativeBinding = require('
|
|
270
|
+
nativeBinding = require('angular-rust-binding-linux-s390x-gnu');
|
|
293
271
|
}
|
|
294
272
|
} catch (e) {
|
|
295
|
-
loadError = e
|
|
273
|
+
loadError = e;
|
|
296
274
|
}
|
|
297
|
-
break
|
|
275
|
+
break;
|
|
298
276
|
default:
|
|
299
|
-
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
277
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`);
|
|
300
278
|
}
|
|
301
|
-
break
|
|
279
|
+
break;
|
|
302
280
|
default:
|
|
303
|
-
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
281
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
|
|
304
282
|
}
|
|
305
283
|
|
|
306
284
|
if (!nativeBinding) {
|
|
307
285
|
if (loadError) {
|
|
308
|
-
throw loadError
|
|
286
|
+
throw loadError;
|
|
309
287
|
}
|
|
310
|
-
throw new Error(`Failed to load native binding`)
|
|
288
|
+
throw new Error(`Failed to load native binding`);
|
|
311
289
|
}
|
|
312
290
|
|
|
313
|
-
const { Compiler, linkFile } = nativeBinding
|
|
291
|
+
const { Compiler, linkFile } = nativeBinding;
|
|
314
292
|
|
|
315
|
-
module.exports.Compiler = Compiler
|
|
316
|
-
module.exports.linkFile = linkFile
|
|
293
|
+
module.exports.Compiler = Compiler;
|
|
294
|
+
module.exports.linkFile = linkFile;
|
package/package.json
CHANGED