@flight-framework/flightpack 0.4.2 → 0.4.4

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.
Binary file
package/index.d.ts CHANGED
@@ -1,297 +1,368 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
-
4
- /* auto-generated by NAPI-RS */
5
-
6
- /** FlightPack configuration options */
7
- export interface FlightPackOptions {
8
- /** Entry points */
9
- entry: Array<string>
10
- /** Output directory */
11
- outDir: string
12
- /** Root directory */
13
- root?: string
14
- /** Enable minification */
15
- minify?: boolean
16
- /** Generate source maps */
17
- sourcemap?: boolean
18
- /** Enable RSC support */
19
- rsc?: boolean
20
- // ========== Extended Capabilities ==========
21
- /** Enable tree shaking with InnerGraph (statement-level DCE) */
22
- treeshake?: boolean
23
- /** Enable code splitting (ChunkSplitter) */
24
- splitting?: boolean
25
- /** Enable incremental build caching (TurboCache + ArtifactStore) */
26
- cache?: boolean
27
- /** Persistent cache directory */
28
- cacheDir?: string
29
- /** Platform target: "browser" | "node" | "edge" | "neutral" */
30
- platform?: string
31
- /** External packages (not bundled, resolved at runtime) */
32
- external?: Array<string>
33
- /** Force bundle packages (override auto-external) */
34
- noExternal?: Array<string>
35
- /** Target ES version: "es2020" | "es2022" | "es2024" | "esnext" */
36
- target?: string
37
- }
38
-
39
- /** Build result */
40
- export interface BuildResult {
41
- /** Output directory */
42
- outputDir: string
43
- /** Build duration in milliseconds */
44
- durationMs: number
45
- /** Total output size in bytes */
46
- totalSize: number
47
- /** Generated chunks */
48
- chunks: Array<ChunkInfo>
49
- }
50
-
51
- /** Chunk information */
52
- export interface ChunkInfo {
53
- /** File name */
54
- fileName: string
55
- /** Chunk type (entry, chunk, asset) */
56
- chunkType: string
57
- /** Size in bytes */
58
- size: number
59
- }
60
-
61
- /** Transform result */
62
- export interface TransformResult {
63
- /** Transformed code */
64
- code: string
65
- /** Source map (if generated) */
66
- map?: string | null
67
- /** Whether transformation succeeded */
68
- success: boolean
69
- }
70
-
71
- /** Transform options */
72
- export interface TransformOptions {
73
- /** Generate source maps */
74
- sourcemap?: boolean
75
- /** Enable minification */
76
- minify?: boolean
77
- /** Target environment */
78
- target?: string
79
- /** JSX pragma */
80
- jsxFactory?: string
81
- /** JSX fragment pragma */
82
- jsxFragment?: string
83
- }
84
-
85
- /** Standalone build function */
86
- export declare function build(options: FlightPackOptions): Promise<BuildResult>
87
-
88
- /** Transform a single TypeScript/TSX file */
89
- export declare function transform(code: string, filename: string, options?: TransformOptions | undefined | null): Promise<TransformResult>
90
-
91
- /** FlightPack version */
92
- export declare function version(): string
93
-
94
- /** FlightPack bundler instance */
95
- export declare class FlightPack {
96
- /** Create a new FlightPack instance */
97
- constructor(options?: FlightPackOptions | undefined | null)
98
- /** Run a production build */
99
- build(): Promise<BuildResult>
100
- }
101
-
102
- // ============================================================================
103
- // Dev Server
104
- // ============================================================================
105
-
106
- /** Dev server options */
107
- export interface DevServerOptions {
108
- /** Server port (default: 3000) */
109
- port?: number
110
- /** Public directory for static files */
111
- publicDir?: string
112
- /** Output directory (bundled files) */
113
- outDir?: string
114
- /** Enable HMR (default: true) */
115
- hmr?: boolean
116
- /** Root directory */
117
- root?: string
118
- }
119
-
120
- /** Dev server result */
121
- export interface DevServerResult {
122
- /** Server URL */
123
- url: string
124
- /** Port number */
125
- port: number
126
- /** Whether HMR is enabled */
127
- hmr: boolean
128
- }
129
-
130
- /** Start the FlightPack development server */
131
- export declare function startDevServer(options?: DevServerOptions | undefined | null): Promise<DevServerResult>
132
-
133
- /** Stop the development server */
134
- export declare function stopDevServer(): Promise<boolean>
135
-
136
- /** Check if dev server is running */
137
- export declare function isDevServerRunning(): boolean
138
-
139
- // ============================================================================
140
- // HMR
141
- // ============================================================================
142
-
143
- /** HMR module update info */
144
- export interface HMRModuleUpdate {
145
- /** Module ID */
146
- id: string
147
- /** Module path */
148
- path: string
149
- /** Updated code */
150
- code: string
151
- /** Dependencies */
152
- deps?: Array<string> | null
153
- /** Whether module accepts HMR */
154
- accept: boolean
155
- }
156
-
157
- /** Send HMR update to connected clients */
158
- export declare function sendHmrUpdate(modules: Array<HMRModuleUpdate>): boolean
159
-
160
- /** Send HMR error to connected clients */
161
- export declare function sendHmrError(message: string): boolean
162
-
163
- // ============================================================================
164
- // File Watcher
165
- // ============================================================================
166
-
167
- /** File watcher options */
168
- export interface WatcherOptions {
169
- /** Paths to watch */
170
- paths: Array<string>
171
- /** File extensions to include (e.g., ["ts", "tsx", "js"]) */
172
- extensions?: Array<string> | null
173
- /** Debounce delay in milliseconds */
174
- debounceMs?: number | null
175
- }
176
-
177
- /** Watch event */
178
- export interface WatchEvent {
179
- /** Changed file paths */
180
- paths: Array<string>
181
- /** Event type (change, add, remove) */
182
- eventType: string
183
- }
184
-
185
- /** Watch handle for stopping file watching */
186
- export declare class WatchHandle {
187
- /** Stop watching files */
188
- stop(): boolean
189
- }
190
-
191
- /** Start watching files for changes */
192
- export declare function watchFiles(options: WatcherOptions, callback: (event: WatchEvent) => void): WatchHandle
193
-
194
- // ============================================================================
195
- // CSS Processing
196
- // ============================================================================
197
-
198
- /** CSS transformation options */
199
- export interface CssTransformOptions {
200
- /** Enable minification */
201
- minify?: boolean
202
- /** Enable CSS modules (class name hashing) */
203
- cssModules?: boolean
204
- /** Custom pattern for CSS module class names */
205
- cssModulesPattern?: string
206
- /** Enable dashed ident scoping (CSS variables) */
207
- dashedIdents?: boolean
208
- /** Generate source maps */
209
- sourcemap?: boolean
210
- /** Target browser versions for autoprefixer */
211
- browserTargets?: CssBrowserTargets
212
- }
213
-
214
- /** Browser targets for CSS autoprefixer */
215
- export interface CssBrowserTargets {
216
- chrome?: number
217
- firefox?: number
218
- safari?: number
219
- edge?: number
220
- }
221
-
222
- /** CSS module export information */
223
- export interface CssModuleExport {
224
- /** Original class name */
225
- original: string
226
- /** Hashed class name */
227
- hashed: string
228
- /** Whether it's referenced by other modules */
229
- isReferenced: boolean
230
- /** Composed classes */
231
- composes: Array<string>
232
- }
233
-
234
- /** CSS transformation result */
235
- export interface CssTransformResult {
236
- /** Transformed CSS code */
237
- code: string
238
- /** Source map (if generated) */
239
- map?: string | null
240
- /** CSS module exports (class name mappings) */
241
- exports: Array<CssModuleExport>
242
- /** Whether transformation succeeded */
243
- success: boolean
244
- }
245
-
246
- /** Transform CSS code */
247
- export declare function transformCss(code: string, filename: string, options?: CssTransformOptions | undefined | null): CssTransformResult
248
-
249
- /** Minify CSS quickly */
250
- export declare function minifyCss(code: string, filename: string): string
251
-
252
- /** CSS module result */
253
- export interface CssModuleResult {
254
- /** Minified CSS code with hashed class names */
255
- code: string
256
- /** Mapping of original class names to hashed names */
257
- classMap: Array<CssClassMapping>
258
- }
259
-
260
- /** CSS class name mapping */
261
- export interface CssClassMapping {
262
- /** Original class name */
263
- original: string
264
- /** Hashed class name */
265
- hashed: string
266
- }
267
-
268
- /** Transform CSS module file */
269
- export declare function transformCssModule(code: string, filename: string): CssModuleResult
270
-
271
- // ============================================================================
272
- // Universal / Multi-Environment Support
273
- // ============================================================================
274
-
275
- /** Platform target for builds */
276
- export type Platform = 'Browser' | 'Node' | 'Edge' | 'Neutral'
277
-
278
- /** Check if a module is a Node.js builtin */
279
- export declare function isNodeBuiltin(moduleId: string): boolean
280
-
281
- /** Get list of all Node.js builtin modules */
282
- export declare function getNodeBuiltins(): string[]
283
-
284
- /** Get list of all Node.js builtins with node: prefix */
285
- export declare function getNodeBuiltinsPrefixed(): string[]
286
-
287
- /** Check if a module is a bare import (from node_modules) */
288
- export declare function isBareImport(moduleId: string): boolean
289
-
290
- /** Check if a module is compatible with Edge runtimes */
291
- export declare function isEdgeCompatible(moduleId: string): boolean
292
-
293
- /** Get list of Edge-incompatible modules */
294
- export declare function getEdgeIncompatibleModules(): string[]
295
-
296
- /** Get default resolve conditions for a platform */
297
- export declare function getPlatformConditions(platform: string): string[]
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ /** FlightPack configuration options */
7
+ export interface FlightPackOptions {
8
+ /** Entry points */
9
+ entry: Array<string>
10
+ /** Output directory */
11
+ outDir: string
12
+ /** Root directory */
13
+ root?: string
14
+ /** Enable minification */
15
+ minify?: boolean
16
+ /** Generate source maps */
17
+ sourcemap?: boolean
18
+ /** Enable RSC support */
19
+ rsc?: boolean
20
+ }
21
+ /** Build result */
22
+ export interface BuildResult {
23
+ /** Output directory */
24
+ outputDir: string
25
+ /** Build duration in milliseconds */
26
+ durationMs: number
27
+ /** Total output size in bytes */
28
+ totalSize: number
29
+ /** Generated chunks */
30
+ chunks: Array<ChunkInfo>
31
+ }
32
+ /** Chunk information */
33
+ export interface ChunkInfo {
34
+ /** File name */
35
+ fileName: string
36
+ /** Chunk type (entry, chunk, asset) */
37
+ chunkType: string
38
+ /** Size in bytes */
39
+ size: number
40
+ }
41
+ /** Transform result */
42
+ export interface TransformResult {
43
+ /** Transformed code */
44
+ code: string
45
+ /** Source map (if generated) */
46
+ map?: string | null
47
+ /** Whether transformation succeeded */
48
+ success: boolean
49
+ }
50
+ /** Transform options */
51
+ export interface TransformOptions {
52
+ /** Generate source maps */
53
+ sourcemap?: boolean
54
+ /** Enable minification */
55
+ minify?: boolean
56
+ /** Target environment */
57
+ target?: string
58
+ /** JSX pragma */
59
+ jsxFactory?: string
60
+ /** JSX fragment pragma */
61
+ jsxFragment?: string
62
+ }
63
+ /** Standalone build function */
64
+ export declare function build(options: FlightPackOptions): Promise<BuildResult>
65
+ /** Transform a single TypeScript/TSX file */
66
+ export declare function transform(code: string, filename: string, options?: TransformOptions | undefined | null): Promise<TransformResult>
67
+ /** FlightPack version */
68
+ export declare function version(): string
69
+ /** FlightPack bundler instance */
70
+ export declare class FlightPack {
71
+ /** Create a new FlightPack instance */
72
+ constructor(options?: FlightPackOptions | undefined | null)
73
+ /** Run a production build */
74
+ build(): Promise<BuildResult>
75
+ }
76
+
77
+ // ============================================================================
78
+ // Dev Server
79
+ // ============================================================================
80
+
81
+ /** Dev server options */
82
+ export interface DevServerOptions {
83
+ /** Server port (default: 3000) */
84
+ port?: number
85
+ /** Public directory for static files */
86
+ publicDir?: string
87
+ /** Output directory (bundled files) */
88
+ outDir?: string
89
+ /** Enable HMR (default: true) */
90
+ hmr?: boolean
91
+ /** Root directory */
92
+ root?: string
93
+ }
94
+
95
+ /** Dev server result */
96
+ export interface DevServerResult {
97
+ /** Server URL */
98
+ url: string
99
+ /** Port number */
100
+ port: number
101
+ /** Whether HMR is enabled */
102
+ hmr: boolean
103
+ }
104
+
105
+ /** Start the FlightPack development server */
106
+ export declare function startDevServer(options?: DevServerOptions | undefined | null): Promise<DevServerResult>
107
+
108
+ /** Stop the development server */
109
+ export declare function stopDevServer(): Promise<boolean>
110
+
111
+ /** Check if dev server is running */
112
+ export declare function isDevServerRunning(): boolean
113
+
114
+ // ============================================================================
115
+ // HMR
116
+ // ============================================================================
117
+
118
+ /** HMR module update info */
119
+ export interface HMRModuleUpdate {
120
+ /** Module ID */
121
+ id: string
122
+ /** Module path */
123
+ path: string
124
+ /** Updated code */
125
+ code: string
126
+ /** Dependencies */
127
+ deps?: Array<string> | null
128
+ /** Whether module accepts HMR */
129
+ accept: boolean
130
+ }
131
+
132
+ /** Send HMR update to connected clients */
133
+ export declare function sendHmrUpdate(modules: Array<HMRModuleUpdate>): boolean
134
+
135
+ /** Send HMR error to connected clients */
136
+ export declare function sendHmrError(message: string): boolean
137
+
138
+ // ============================================================================
139
+ // File Watcher
140
+ // ============================================================================
141
+
142
+ /** File watcher options */
143
+ export interface WatcherOptions {
144
+ /** Paths to watch */
145
+ paths: Array<string>
146
+ /** File extensions to include (e.g., ["ts", "tsx", "js"]) */
147
+ extensions?: Array<string> | null
148
+ /** Debounce delay in milliseconds */
149
+ debounceMs?: number | null
150
+ }
151
+
152
+ /** Watch event */
153
+ export interface WatchEvent {
154
+ /** Changed file paths */
155
+ paths: Array<string>
156
+ /** Event type (change, add, remove) */
157
+ eventType: string
158
+ }
159
+
160
+ /** Watch handle for stopping file watching */
161
+ export declare class WatchHandle {
162
+ /** Stop watching files */
163
+ stop(): boolean
164
+ }
165
+
166
+ /** Start watching files for changes */
167
+ export declare function watchFiles(options: WatcherOptions, callback: (event: WatchEvent) => void): WatchHandle
168
+
169
+ // ============================================================================
170
+ // CSS Processing
171
+ // ============================================================================
172
+
173
+ /** CSS transformation options */
174
+ export interface CssTransformOptions {
175
+ /** Enable minification */
176
+ minify?: boolean
177
+ /** Enable CSS modules (class name hashing) */
178
+ cssModules?: boolean
179
+ /** Custom pattern for CSS module class names */
180
+ cssModulesPattern?: string
181
+ /** Enable dashed ident scoping (CSS variables) */
182
+ dashedIdents?: boolean
183
+ /** Generate source maps */
184
+ sourcemap?: boolean
185
+ /** Target browser versions for autoprefixer */
186
+ browserTargets?: CssBrowserTargets
187
+ }
188
+
189
+ /** Browser targets for CSS autoprefixer */
190
+ export interface CssBrowserTargets {
191
+ chrome?: number
192
+ firefox?: number
193
+ safari?: number
194
+ edge?: number
195
+ }
196
+
197
+ /** CSS module export information */
198
+ export interface CssModuleExport {
199
+ /** Original class name */
200
+ original: string
201
+ /** Hashed class name */
202
+ hashed: string
203
+ /** Whether it's referenced by other modules */
204
+ isReferenced: boolean
205
+ /** Composed classes */
206
+ composes: Array<string>
207
+ }
208
+
209
+ /** CSS transformation result */
210
+ export interface CssTransformResult {
211
+ /** Transformed CSS code */
212
+ code: string
213
+ /** Source map (if generated) */
214
+ map?: string | null
215
+ /** CSS module exports (class name mappings) */
216
+ exports: Array<CssModuleExport>
217
+ /** Whether transformation succeeded */
218
+ success: boolean
219
+ }
220
+
221
+ /** Transform CSS code */
222
+ export declare function transformCss(code: string, filename: string, options?: CssTransformOptions | undefined | null): CssTransformResult
223
+
224
+ /** Minify CSS quickly */
225
+ export declare function minifyCss(code: string, filename: string): string
226
+
227
+ /** CSS module result */
228
+ export interface CssModuleResult {
229
+ /** Minified CSS code with hashed class names */
230
+ code: string
231
+ /** Mapping of original class names to hashed names */
232
+ classMap: Array<CssClassMapping>
233
+ }
234
+
235
+ /** CSS class name mapping */
236
+ export interface CssClassMapping {
237
+ /** Original class name */
238
+ original: string
239
+ /** Hashed class name */
240
+ hashed: string
241
+ }
242
+
243
+ /** Transform CSS module file */
244
+ export declare function transformCssModule(code: string, filename: string): CssModuleResult
245
+
246
+ // ============================================================================
247
+ // Universal / Multi-Environment Support
248
+ // ============================================================================
249
+
250
+ /** Platform target for builds */
251
+ export type Platform = 'Browser' | 'Node' | 'Edge' | 'Neutral'
252
+
253
+ /** Environment configuration options */
254
+ export interface EnvironmentOptions {
255
+ /** Platform: "browser", "node", "edge", "neutral" */
256
+ platform?: string
257
+ /** Node.js target version (e.g., "node22") */
258
+ nodeTarget?: string
259
+ /** Resolve conditions */
260
+ conditions?: string[]
261
+ /** External packages (not bundled) */
262
+ external?: string[]
263
+ /** Force bundle packages (override auto-external) */
264
+ noExternal?: string[]
265
+ /** Output directory */
266
+ outDir?: string
267
+ /** Entry points for this environment */
268
+ entry?: string[]
269
+ /** Enable minification */
270
+ minify?: boolean
271
+ /** Generate source maps */
272
+ sourcemap?: boolean
273
+ }
274
+
275
+ /** Multi-environment build result */
276
+ export interface MultiEnvironmentResult {
277
+ /** Client build result */
278
+ client: BuildResult
279
+ /** SSR build result (if configured) */
280
+ ssr?: BuildResult | null
281
+ /** Edge build result (if configured) */
282
+ edge?: BuildResult | null
283
+ /** Total duration in milliseconds */
284
+ totalDurationMs: number
285
+ }
286
+
287
+ // ============================================================================
288
+ // Externals Detection
289
+ // ============================================================================
290
+
291
+ /** Check if a module is a Node.js builtin */
292
+ export declare function isNodeBuiltin(moduleId: string): boolean
293
+
294
+ /** Get list of all Node.js builtin modules */
295
+ export declare function getNodeBuiltins(): string[]
296
+
297
+ /** Get list of all Node.js builtins with node: prefix */
298
+ export declare function getNodeBuiltinsPrefixed(): string[]
299
+
300
+ /** Check if a module is a bare import (from node_modules) */
301
+ export declare function isBareImport(moduleId: string): boolean
302
+
303
+ /** Check if a module is compatible with Edge runtimes */
304
+ export declare function isEdgeCompatible(moduleId: string): boolean
305
+
306
+ /** Get list of Edge-incompatible modules */
307
+ export declare function getEdgeIncompatibleModules(): string[]
308
+
309
+ /** Get default resolve conditions for a platform */
310
+ export declare function getPlatformConditions(platform: string): string[]
311
+
312
+ // ============================================================================
313
+ // SSG (Static Site Generation)
314
+ // ============================================================================
315
+
316
+ /** SSG page configuration */
317
+ export interface SSGPageConfig {
318
+ /** Route path pattern */
319
+ path: string
320
+ /** Static params for dynamic routes */
321
+ params?: Array<Record<string, string>>
322
+ /** Fallback behavior: "false", "true", "blocking" */
323
+ fallback?: string
324
+ /** Revalidation time in seconds (ISR) */
325
+ revalidate?: number
326
+ }
327
+
328
+ /** SSG configuration */
329
+ export interface SSGOptions {
330
+ /** Pages to pre-render */
331
+ pages: SSGPageConfig[]
332
+ /** Output directory */
333
+ outDir?: string
334
+ /** SSR bundle path */
335
+ ssrBundle?: string
336
+ /** Default revalidation time */
337
+ defaultRevalidate?: number
338
+ /** Maximum concurrency */
339
+ concurrency?: number
340
+ /** Generate trailing slashes */
341
+ trailingSlash?: boolean
342
+ }
343
+
344
+ /** SSG generated page result */
345
+ export interface SSGGeneratedPage {
346
+ /** Route path */
347
+ path: string
348
+ /** Output file path */
349
+ filePath: string
350
+ /** Revalidation time (for ISR) */
351
+ revalidate?: number | null
352
+ /** Page size in bytes */
353
+ size: number
354
+ }
355
+
356
+ /** SSG generation result */
357
+ export interface SSGResult {
358
+ /** All generated pages */
359
+ pages: SSGGeneratedPage[]
360
+ /** Total duration in milliseconds */
361
+ durationMs: number
362
+ /** Total size of all pages */
363
+ totalSize: number
364
+ /** Pages that require ISR */
365
+ isrPages: string[]
366
+ /** Errors encountered */
367
+ errors: string[]
368
+ }
package/index.js CHANGED
@@ -1,181 +1,367 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
-
4
- /* auto-generated by NAPI-RS */
5
-
6
- const { existsSync, readFileSync } = require('fs')
7
- const { join } = require('path')
8
-
9
- const { platform, arch } = process
10
-
11
- let nativeBinding = null
12
- let localFileExisted = false
13
- let loadError = null
14
-
15
- function isMusl() {
16
- // For Node 10
17
- if (!process.report || typeof process.report.getReport !== 'function') {
18
- try {
19
- const lddPath = require('child_process').execSync('which ldd').toString().trim()
20
- return readFileSync(lddPath, 'utf8').includes('musl')
21
- } catch (e) {
22
- return true
23
- }
24
- } else {
25
- const { glibcVersionRuntime } = process.report.getReport().header
26
- return !glibcVersionRuntime
27
- }
28
- }
29
-
30
- switch (platform) {
31
- case 'win32':
32
- switch (arch) {
33
- case 'x64':
34
- localFileExisted = existsSync(
35
- join(__dirname, 'flightpack.win32-x64-msvc.node')
36
- )
37
- try {
38
- if (localFileExisted) {
39
- nativeBinding = require('./flightpack.win32-x64-msvc.node')
40
- } else {
41
- nativeBinding = require('@flight-framework/flightpack-win32-x64-msvc')
42
- }
43
- } catch (e) {
44
- loadError = e
45
- }
46
- break
47
- default:
48
- throw new Error(`Unsupported architecture on Windows: ${arch}`)
49
- }
50
- break
51
- case 'darwin':
52
- switch (arch) {
53
- case 'x64':
54
- localFileExisted = existsSync(
55
- join(__dirname, 'flightpack.darwin-x64.node')
56
- )
57
- try {
58
- if (localFileExisted) {
59
- nativeBinding = require('./flightpack.darwin-x64.node')
60
- } else {
61
- nativeBinding = require('@flight-framework/flightpack-darwin-x64')
62
- }
63
- } catch (e) {
64
- loadError = e
65
- }
66
- break
67
- case 'arm64':
68
- localFileExisted = existsSync(
69
- join(__dirname, 'flightpack.darwin-arm64.node')
70
- )
71
- try {
72
- if (localFileExisted) {
73
- nativeBinding = require('./flightpack.darwin-arm64.node')
74
- } else {
75
- nativeBinding = require('@flight-framework/flightpack-darwin-arm64')
76
- }
77
- } catch (e) {
78
- loadError = e
79
- }
80
- break
81
- default:
82
- throw new Error(`Unsupported architecture on macOS: ${arch}`)
83
- }
84
- break
85
- case 'linux':
86
- switch (arch) {
87
- case 'x64':
88
- if (isMusl()) {
89
- localFileExisted = existsSync(
90
- join(__dirname, 'flightpack.linux-x64-musl.node')
91
- )
92
- try {
93
- if (localFileExisted) {
94
- nativeBinding = require('./flightpack.linux-x64-musl.node')
95
- } else {
96
- nativeBinding = require('@flight-framework/flightpack-linux-x64-musl')
97
- }
98
- } catch (e) {
99
- loadError = e
100
- }
101
- } else {
102
- localFileExisted = existsSync(
103
- join(__dirname, 'flightpack.linux-x64-gnu.node')
104
- )
105
- try {
106
- if (localFileExisted) {
107
- nativeBinding = require('./flightpack.linux-x64-gnu.node')
108
- } else {
109
- nativeBinding = require('@flight-framework/flightpack-linux-x64-gnu')
110
- }
111
- } catch (e) {
112
- loadError = e
113
- }
114
- }
115
- break
116
- case 'arm64':
117
- if (isMusl()) {
118
- localFileExisted = existsSync(
119
- join(__dirname, 'flightpack.linux-arm64-musl.node')
120
- )
121
- try {
122
- if (localFileExisted) {
123
- nativeBinding = require('./flightpack.linux-arm64-musl.node')
124
- } else {
125
- nativeBinding = require('@flight-framework/flightpack-linux-arm64-musl')
126
- }
127
- } catch (e) {
128
- loadError = e
129
- }
130
- } else {
131
- localFileExisted = existsSync(
132
- join(__dirname, 'flightpack.linux-arm64-gnu.node')
133
- )
134
- try {
135
- if (localFileExisted) {
136
- nativeBinding = require('./flightpack.linux-arm64-gnu.node')
137
- } else {
138
- nativeBinding = require('@flight-framework/flightpack-linux-arm64-gnu')
139
- }
140
- } catch (e) {
141
- loadError = e
142
- }
143
- }
144
- break
145
- default:
146
- throw new Error(`Unsupported architecture on Linux: ${arch}`)
147
- }
148
- break
149
- default:
150
- throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
151
- }
152
-
153
- if (!nativeBinding) {
154
- if (loadError) {
155
- throw loadError
156
- }
157
- throw new Error(`Failed to load native binding`)
158
- }
159
-
160
- const { FlightPack, build, transform, version, startDevServer, stopDevServer, isDevServerRunning, sendHmrUpdate, sendHmrError, watchFiles, transformCss, minifyCss, transformCssModule, isNodeBuiltin, getNodeBuiltins, getNodeBuiltinsPrefixed, isBareImport, isEdgeCompatible, getEdgeIncompatibleModules, getPlatformConditions } = nativeBinding
161
-
162
- module.exports.FlightPack = FlightPack
163
- module.exports.build = build
164
- module.exports.transform = transform
165
- module.exports.version = version
166
- module.exports.startDevServer = startDevServer
167
- module.exports.stopDevServer = stopDevServer
168
- module.exports.isDevServerRunning = isDevServerRunning
169
- module.exports.sendHmrUpdate = sendHmrUpdate
170
- module.exports.sendHmrError = sendHmrError
171
- module.exports.watchFiles = watchFiles
172
- module.exports.transformCss = transformCss
173
- module.exports.minifyCss = minifyCss
174
- module.exports.transformCssModule = transformCssModule
175
- module.exports.isNodeBuiltin = isNodeBuiltin
176
- module.exports.getNodeBuiltins = getNodeBuiltins
177
- module.exports.getNodeBuiltinsPrefixed = getNodeBuiltinsPrefixed
178
- module.exports.isBareImport = isBareImport
179
- module.exports.isEdgeCompatible = isEdgeCompatible
180
- module.exports.getEdgeIncompatibleModules = getEdgeIncompatibleModules
181
- module.exports.getPlatformConditions = getPlatformConditions
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /* prettier-ignore */
4
+
5
+ /* auto-generated by NAPI-RS */
6
+
7
+ const { existsSync, readFileSync } = require('fs')
8
+ const { join } = require('path')
9
+
10
+ const { platform, arch } = process
11
+
12
+ let nativeBinding = null
13
+ let localFileExisted = false
14
+ let loadError = null
15
+
16
+ function isMusl() {
17
+ // For Node 10
18
+ if (!process.report || typeof process.report.getReport !== 'function') {
19
+ try {
20
+ const lddPath = require('child_process').execSync('which ldd').toString().trim()
21
+ return readFileSync(lddPath, 'utf8').includes('musl')
22
+ } catch (e) {
23
+ return true
24
+ }
25
+ } else {
26
+ const { glibcVersionRuntime } = process.report.getReport().header
27
+ return !glibcVersionRuntime
28
+ }
29
+ }
30
+
31
+ switch (platform) {
32
+ case 'android':
33
+ switch (arch) {
34
+ case 'arm64':
35
+ localFileExisted = existsSync(join(__dirname, 'flightpack.android-arm64.node'))
36
+ try {
37
+ if (localFileExisted) {
38
+ nativeBinding = require('./flightpack.android-arm64.node')
39
+ } else {
40
+ nativeBinding = require('@flight-framework/flightpack-android-arm64')
41
+ }
42
+ } catch (e) {
43
+ loadError = e
44
+ }
45
+ break
46
+ case 'arm':
47
+ localFileExisted = existsSync(join(__dirname, 'flightpack.android-arm-eabi.node'))
48
+ try {
49
+ if (localFileExisted) {
50
+ nativeBinding = require('./flightpack.android-arm-eabi.node')
51
+ } else {
52
+ nativeBinding = require('@flight-framework/flightpack-android-arm-eabi')
53
+ }
54
+ } catch (e) {
55
+ loadError = e
56
+ }
57
+ break
58
+ default:
59
+ throw new Error(`Unsupported architecture on Android ${arch}`)
60
+ }
61
+ break
62
+ case 'win32':
63
+ switch (arch) {
64
+ case 'x64':
65
+ localFileExisted = existsSync(
66
+ join(__dirname, 'flightpack.win32-x64-msvc.node')
67
+ )
68
+ try {
69
+ if (localFileExisted) {
70
+ nativeBinding = require('./flightpack.win32-x64-msvc.node')
71
+ } else {
72
+ nativeBinding = require('@flight-framework/flightpack-win32-x64-msvc')
73
+ }
74
+ } catch (e) {
75
+ loadError = e
76
+ }
77
+ break
78
+ case 'ia32':
79
+ localFileExisted = existsSync(
80
+ join(__dirname, 'flightpack.win32-ia32-msvc.node')
81
+ )
82
+ try {
83
+ if (localFileExisted) {
84
+ nativeBinding = require('./flightpack.win32-ia32-msvc.node')
85
+ } else {
86
+ nativeBinding = require('@flight-framework/flightpack-win32-ia32-msvc')
87
+ }
88
+ } catch (e) {
89
+ loadError = e
90
+ }
91
+ break
92
+ case 'arm64':
93
+ localFileExisted = existsSync(
94
+ join(__dirname, 'flightpack.win32-arm64-msvc.node')
95
+ )
96
+ try {
97
+ if (localFileExisted) {
98
+ nativeBinding = require('./flightpack.win32-arm64-msvc.node')
99
+ } else {
100
+ nativeBinding = require('@flight-framework/flightpack-win32-arm64-msvc')
101
+ }
102
+ } catch (e) {
103
+ loadError = e
104
+ }
105
+ break
106
+ default:
107
+ throw new Error(`Unsupported architecture on Windows: ${arch}`)
108
+ }
109
+ break
110
+ case 'darwin':
111
+ localFileExisted = existsSync(join(__dirname, 'flightpack.darwin-universal.node'))
112
+ try {
113
+ if (localFileExisted) {
114
+ nativeBinding = require('./flightpack.darwin-universal.node')
115
+ } else {
116
+ nativeBinding = require('@flight-framework/flightpack-darwin-universal')
117
+ }
118
+ break
119
+ } catch { }
120
+ switch (arch) {
121
+ case 'x64':
122
+ localFileExisted = existsSync(join(__dirname, 'flightpack.darwin-x64.node'))
123
+ try {
124
+ if (localFileExisted) {
125
+ nativeBinding = require('./flightpack.darwin-x64.node')
126
+ } else {
127
+ nativeBinding = require('@flight-framework/flightpack-darwin-x64')
128
+ }
129
+ } catch (e) {
130
+ loadError = e
131
+ }
132
+ break
133
+ case 'arm64':
134
+ localFileExisted = existsSync(
135
+ join(__dirname, 'flightpack.darwin-arm64.node')
136
+ )
137
+ try {
138
+ if (localFileExisted) {
139
+ nativeBinding = require('./flightpack.darwin-arm64.node')
140
+ } else {
141
+ nativeBinding = require('@flight-framework/flightpack-darwin-arm64')
142
+ }
143
+ } catch (e) {
144
+ loadError = e
145
+ }
146
+ break
147
+ default:
148
+ throw new Error(`Unsupported architecture on macOS: ${arch}`)
149
+ }
150
+ break
151
+ case 'freebsd':
152
+ if (arch !== 'x64') {
153
+ throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
154
+ }
155
+ localFileExisted = existsSync(join(__dirname, 'flightpack.freebsd-x64.node'))
156
+ try {
157
+ if (localFileExisted) {
158
+ nativeBinding = require('./flightpack.freebsd-x64.node')
159
+ } else {
160
+ nativeBinding = require('@flight-framework/flightpack-freebsd-x64')
161
+ }
162
+ } catch (e) {
163
+ loadError = e
164
+ }
165
+ break
166
+ case 'linux':
167
+ switch (arch) {
168
+ case 'x64':
169
+ if (isMusl()) {
170
+ localFileExisted = existsSync(
171
+ join(__dirname, 'flightpack.linux-x64-musl.node')
172
+ )
173
+ try {
174
+ if (localFileExisted) {
175
+ nativeBinding = require('./flightpack.linux-x64-musl.node')
176
+ } else {
177
+ nativeBinding = require('@flight-framework/flightpack-linux-x64-musl')
178
+ }
179
+ } catch (e) {
180
+ loadError = e
181
+ }
182
+ } else {
183
+ localFileExisted = existsSync(
184
+ join(__dirname, 'flightpack.linux-x64-gnu.node')
185
+ )
186
+ try {
187
+ if (localFileExisted) {
188
+ nativeBinding = require('./flightpack.linux-x64-gnu.node')
189
+ } else {
190
+ nativeBinding = require('@flight-framework/flightpack-linux-x64-gnu')
191
+ }
192
+ } catch (e) {
193
+ loadError = e
194
+ }
195
+ }
196
+ break
197
+ case 'arm64':
198
+ if (isMusl()) {
199
+ localFileExisted = existsSync(
200
+ join(__dirname, 'flightpack.linux-arm64-musl.node')
201
+ )
202
+ try {
203
+ if (localFileExisted) {
204
+ nativeBinding = require('./flightpack.linux-arm64-musl.node')
205
+ } else {
206
+ nativeBinding = require('@flight-framework/flightpack-linux-arm64-musl')
207
+ }
208
+ } catch (e) {
209
+ loadError = e
210
+ }
211
+ } else {
212
+ localFileExisted = existsSync(
213
+ join(__dirname, 'flightpack.linux-arm64-gnu.node')
214
+ )
215
+ try {
216
+ if (localFileExisted) {
217
+ nativeBinding = require('./flightpack.linux-arm64-gnu.node')
218
+ } else {
219
+ nativeBinding = require('@flight-framework/flightpack-linux-arm64-gnu')
220
+ }
221
+ } catch (e) {
222
+ loadError = e
223
+ }
224
+ }
225
+ break
226
+ case 'arm':
227
+ if (isMusl()) {
228
+ localFileExisted = existsSync(
229
+ join(__dirname, 'flightpack.linux-arm-musleabihf.node')
230
+ )
231
+ try {
232
+ if (localFileExisted) {
233
+ nativeBinding = require('./flightpack.linux-arm-musleabihf.node')
234
+ } else {
235
+ nativeBinding = require('@flight-framework/flightpack-linux-arm-musleabihf')
236
+ }
237
+ } catch (e) {
238
+ loadError = e
239
+ }
240
+ } else {
241
+ localFileExisted = existsSync(
242
+ join(__dirname, 'flightpack.linux-arm-gnueabihf.node')
243
+ )
244
+ try {
245
+ if (localFileExisted) {
246
+ nativeBinding = require('./flightpack.linux-arm-gnueabihf.node')
247
+ } else {
248
+ nativeBinding = require('@flight-framework/flightpack-linux-arm-gnueabihf')
249
+ }
250
+ } catch (e) {
251
+ loadError = e
252
+ }
253
+ }
254
+ break
255
+ case 'riscv64':
256
+ if (isMusl()) {
257
+ localFileExisted = existsSync(
258
+ join(__dirname, 'flightpack.linux-riscv64-musl.node')
259
+ )
260
+ try {
261
+ if (localFileExisted) {
262
+ nativeBinding = require('./flightpack.linux-riscv64-musl.node')
263
+ } else {
264
+ nativeBinding = require('@flight-framework/flightpack-linux-riscv64-musl')
265
+ }
266
+ } catch (e) {
267
+ loadError = e
268
+ }
269
+ } else {
270
+ localFileExisted = existsSync(
271
+ join(__dirname, 'flightpack.linux-riscv64-gnu.node')
272
+ )
273
+ try {
274
+ if (localFileExisted) {
275
+ nativeBinding = require('./flightpack.linux-riscv64-gnu.node')
276
+ } else {
277
+ nativeBinding = require('@flight-framework/flightpack-linux-riscv64-gnu')
278
+ }
279
+ } catch (e) {
280
+ loadError = e
281
+ }
282
+ }
283
+ break
284
+ case 's390x':
285
+ localFileExisted = existsSync(
286
+ join(__dirname, 'flightpack.linux-s390x-gnu.node')
287
+ )
288
+ try {
289
+ if (localFileExisted) {
290
+ nativeBinding = require('./flightpack.linux-s390x-gnu.node')
291
+ } else {
292
+ nativeBinding = require('@flight-framework/flightpack-linux-s390x-gnu')
293
+ }
294
+ } catch (e) {
295
+ loadError = e
296
+ }
297
+ break
298
+ default:
299
+ throw new Error(`Unsupported architecture on Linux: ${arch}`)
300
+ }
301
+ break
302
+ default:
303
+ throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
304
+ }
305
+
306
+ if (!nativeBinding) {
307
+ if (loadError) {
308
+ throw loadError
309
+ }
310
+ throw new Error(`Failed to load native binding`)
311
+ }
312
+
313
+ const {
314
+ FlightPack,
315
+ build,
316
+ transform,
317
+ version,
318
+ // Dev Server
319
+ startDevServer,
320
+ stopDevServer,
321
+ isDevServerRunning,
322
+ // HMR
323
+ sendHmrUpdate,
324
+ sendHmrError,
325
+ // File Watcher
326
+ watchFiles,
327
+ WatchHandle,
328
+ // CSS Processing
329
+ transformCss,
330
+ minifyCss,
331
+ transformCssModule,
332
+ // Universal / Externals
333
+ isNodeBuiltin,
334
+ getNodeBuiltins,
335
+ getNodeBuiltinsPrefixed,
336
+ isBareImport,
337
+ isEdgeCompatible,
338
+ getEdgeIncompatibleModules,
339
+ getPlatformConditions
340
+ } = nativeBinding
341
+
342
+ module.exports.FlightPack = FlightPack
343
+ module.exports.build = build
344
+ module.exports.transform = transform
345
+ module.exports.version = version
346
+ // Dev Server
347
+ module.exports.startDevServer = startDevServer
348
+ module.exports.stopDevServer = stopDevServer
349
+ module.exports.isDevServerRunning = isDevServerRunning
350
+ // HMR
351
+ module.exports.sendHmrUpdate = sendHmrUpdate
352
+ module.exports.sendHmrError = sendHmrError
353
+ // File Watcher
354
+ module.exports.watchFiles = watchFiles
355
+ module.exports.WatchHandle = WatchHandle
356
+ // CSS Processing
357
+ module.exports.transformCss = transformCss
358
+ module.exports.minifyCss = minifyCss
359
+ module.exports.transformCssModule = transformCssModule
360
+ // Universal / Externals
361
+ module.exports.isNodeBuiltin = isNodeBuiltin
362
+ module.exports.getNodeBuiltins = getNodeBuiltins
363
+ module.exports.getNodeBuiltinsPrefixed = getNodeBuiltinsPrefixed
364
+ module.exports.isBareImport = isBareImport
365
+ module.exports.isEdgeCompatible = isEdgeCompatible
366
+ module.exports.getEdgeIncompatibleModules = getEdgeIncompatibleModules
367
+ module.exports.getPlatformConditions = getPlatformConditions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flight-framework/flightpack",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "FlightPack - Native Rust bundler for Flight Framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -47,6 +47,6 @@
47
47
  "url": "https://github.com/flight-framework/flight/issues"
48
48
  },
49
49
  "optionalDependencies": {
50
- "@flight-framework/flightpack-win32-x64-msvc": "0.4.2"
50
+ "@flight-framework/flightpack-win32-x64-msvc": "0.4.4"
51
51
  }
52
52
  }