@parcel/rust 2.14.4 → 2.14.5-canary.3441

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/index.d.ts CHANGED
@@ -13,6 +13,13 @@ export declare function findNodeModule(module: string, from: string): string | n
13
13
  export declare function hashString(s: string): string
14
14
  export declare function hashBuffer(buf: Buffer): string
15
15
  export declare function optimizeImage(kind: string, buf: Buffer): Buffer
16
+ export declare function transformHtml(opts: object): unknown
17
+ export declare function packageHtml(opts: object): unknown
18
+ export declare function optimizeHtml(opts: object): unknown
19
+ export declare function transformSvg(opts: object): unknown
20
+ export declare function packageSvg(opts: object): unknown
21
+ export declare function optimizeSvg(opts: object): unknown
22
+ export declare function svgReact(opts: object): unknown
16
23
  export interface JsFileSystemOptions {
17
24
  read: (...args: any[]) => any
18
25
  readLink: (...args: any[]) => any
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, Resolver, transform, transformAsync } = nativeBinding
313
+ const { findAncestorFile, findFirstFile, findNodeModule, hashString, hashBuffer, Hash, optimizeImage, transformHtml, packageHtml, optimizeHtml, transformSvg, packageSvg, optimizeSvg, svgReact, Resolver, transform, transformAsync } = nativeBinding
314
314
 
315
315
  module.exports.findAncestorFile = findAncestorFile
316
316
  module.exports.findFirstFile = findFirstFile
@@ -319,6 +319,13 @@ module.exports.hashString = hashString
319
319
  module.exports.hashBuffer = hashBuffer
320
320
  module.exports.Hash = Hash
321
321
  module.exports.optimizeImage = optimizeImage
322
+ module.exports.transformHtml = transformHtml
323
+ module.exports.packageHtml = packageHtml
324
+ module.exports.optimizeHtml = optimizeHtml
325
+ module.exports.transformSvg = transformSvg
326
+ module.exports.packageSvg = packageSvg
327
+ module.exports.optimizeSvg = optimizeSvg
328
+ module.exports.svgReact = svgReact
322
329
  module.exports.Resolver = Resolver
323
330
  module.exports.transform = transform
324
331
  module.exports.transformAsync = transformAsync
package/index.js.flow CHANGED
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import type {FileCreateInvalidation} from '@parcel/types';
2
+ import type {FileCreateInvalidation, DependencyPriority, JSONObject} from '@parcel/types';
3
3
 
4
4
  declare export var init: void | (() => void);
5
5
 
@@ -16,6 +16,13 @@ declare export function findNodeModule(
16
16
  declare export function hashString(s: string): string;
17
17
  declare export function hashBuffer(buf: Buffer): string;
18
18
  declare export function optimizeImage(kind: string, buf: Buffer): Buffer;
19
+ declare export function transformHtml(opts: TransformHtmlOpts): TransformHtmlResult;
20
+ declare export function packageHtml(opts: PackageHtmlOpts): PackageHtmlResult;
21
+ declare export function optimizeHtml(opts: OptimizeHtmlOpts): PackageHtmlResult;
22
+ declare export function transformSvg(opts: TransformHtmlOpts): TransformHtmlResult;
23
+ declare export function packageSvg(opts: PackageHtmlOpts): PackageHtmlResult;
24
+ declare export function optimizeSvg(opts: OptimizeHtmlOpts): PackageHtmlResult;
25
+ declare export function svgReact(opts: OptimizeHtmlOpts): PackageHtmlResult;
19
26
  export interface JsFileSystemOptions {
20
27
  readLink: string => string;
21
28
  read: string => Buffer;
@@ -40,7 +47,7 @@ export interface ResolveOptions {
40
47
  }
41
48
  export type Resolution =
42
49
  | {|type: 'Path', value: string|}
43
- | {|type: 'Builtin', value: string|}
50
+ | {|type: 'Builtin', value: {|scheme: string, module: string|}|}
44
51
  | {|type: 'External'|}
45
52
  | {|type: 'Empty'|}
46
53
  | {|type: 'Global', value: string|};
@@ -81,3 +88,69 @@ declare export class Resolver {
81
88
  resolveAsync(options: ResolveOptions): Promise<ResolveResult>;
82
89
  getInvalidations(path: string): JsInvalidations;
83
90
  }
91
+
92
+ export interface TransformHtmlOpts {
93
+ code: Buffer,
94
+ scope_hoist: boolean,
95
+ supports_esm: boolean,
96
+ hmr: boolean
97
+ }
98
+
99
+ export interface TransformHtmlResult {
100
+ code: Buffer,
101
+ dependencies: HtmlDependency[],
102
+ assets: HtmlAsset[],
103
+ errors: HtmlError[]
104
+ }
105
+
106
+ export interface HtmlDependency {
107
+ href: string,
108
+ needsStableName: boolean,
109
+ priority: DependencyPriority,
110
+ outputFormat: 'none' | 'global' | 'esmodule',
111
+ sourceType: 'none' | 'module' | 'script',
112
+ bundleBehavior: 'none' | 'isolated' | 'inline',
113
+ placeholder: string,
114
+ line: number
115
+ }
116
+
117
+ export interface HtmlAsset {
118
+ type: string,
119
+ content: Buffer,
120
+ key: string,
121
+ isAttr: boolean,
122
+ outputFormat: 'none' | 'global' | 'esmodule',
123
+ sourceType: 'none' | 'module' | 'script',
124
+ bundleBehavior: 'none' | 'isolated' | 'inline',
125
+ line: number
126
+ }
127
+
128
+ export interface HtmlError {
129
+ message: string,
130
+ line: number
131
+ }
132
+
133
+ export interface PackageHtmlOpts {
134
+ code: Buffer,
135
+ bundles: HtmlBundleReference[],
136
+ inlineBundles: {[string]: HtmlInlineBundle},
137
+ importMap: JSONObject
138
+ }
139
+
140
+ export type HtmlBundleReference =
141
+ | {|type: 'StyleSheet', value: {|href: string|}|}
142
+ | {|type: 'Script', value: {|src: string, module: boolean, nomodule: boolean|}|};
143
+
144
+ export interface HtmlInlineBundle {
145
+ contents: string,
146
+ module: boolean
147
+ }
148
+
149
+ export interface PackageHtmlResult {
150
+ code: Buffer
151
+ }
152
+
153
+ export interface OptimizeHtmlOpts {
154
+ code: Buffer,
155
+ config: any,
156
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/rust",
3
- "version": "2.14.4",
3
+ "version": "2.14.5-canary.3441+d0c8ddd99",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -48,5 +48,5 @@
48
48
  "wasm:build": "cargo build -p parcel-node-bindings --target wasm32-unknown-unknown && cp ../../../target/wasm32-unknown-unknown/debug/parcel_node_bindings.wasm .",
49
49
  "wasm:build-release": "CARGO_PROFILE_RELEASE_LTO=true cargo build -p parcel-node-bindings --target wasm32-unknown-unknown --release && wasm-opt --strip-debug -O ../../../target/wasm32-unknown-unknown/release/parcel_node_bindings.wasm -o parcel_node_bindings.wasm"
50
50
  },
51
- "gitHead": "c09fee751b61e2f9d52164f88248b9c668614134"
51
+ "gitHead": "d0c8ddd99d1937e8e1d13043684a8a10617187a6"
52
52
  }