@flight-framework/flightpack 0.1.1
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/flightpack.win32-x64-msvc.node +0 -0
- package/index.d.ts +368 -0
- package/index.js +367 -0
- package/package.json +52 -0
|
Binary file
|
package/index.d.ts
ADDED
|
@@ -0,0 +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
|
+
}
|
|
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
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flight-framework/flightpack",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "FlightPack - Native Rust bundler for Flight Framework",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"index.js",
|
|
9
|
+
"index.d.ts",
|
|
10
|
+
"*.node"
|
|
11
|
+
],
|
|
12
|
+
"napi": {
|
|
13
|
+
"binaryName": "flightpack",
|
|
14
|
+
"targets": [
|
|
15
|
+
"x86_64-pc-windows-msvc"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "napi build --platform --release",
|
|
20
|
+
"build:debug": "napi build --platform",
|
|
21
|
+
"prepublishOnly": "napi prepublish -t npm"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@napi-rs/cli": "^3.5.1"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/flight-framework/flight.git",
|
|
29
|
+
"directory": "packages/flightpack"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"bundler",
|
|
33
|
+
"rust",
|
|
34
|
+
"flight",
|
|
35
|
+
"build",
|
|
36
|
+
"napi"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">= 20"
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/flight-framework/flight/tree/main/packages/flightpack",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/flight-framework/flight/issues"
|
|
48
|
+
},
|
|
49
|
+
"optionalDependencies": {
|
|
50
|
+
"@flight-framework/flightpack-win32-x64-msvc": "0.1.1"
|
|
51
|
+
}
|
|
52
|
+
}
|