@player-ui/async-node-plugin 0.13.0 → 0.14.0-next.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/dist/AsyncNodePlugin.native.js +467 -279
- package/dist/AsyncNodePlugin.native.js.map +1 -1
- package/dist/cjs/index.cjs +217 -20
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +217 -18
- package/dist/index.mjs +217 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/transform.test.ts.snap +1 -0
- package/src/__tests__/createAsyncTransform.test.ts +405 -0
- package/src/__tests__/index.test.ts +94 -13
- package/src/__tests__/transform.bench.ts +177 -0
- package/src/createAsyncTransform.ts +101 -0
- package/src/index.ts +93 -13
- package/src/transform.ts +5 -2
- package/src/types.ts +1 -0
- package/src/utils/__tests__/extractNodeFromPath.test.ts +181 -0
- package/src/utils/__tests__/requiresAssetWrapper.test.ts +63 -0
- package/src/utils/__tests__/traverseAndReplace.test.ts +182 -0
- package/src/utils/__tests__/unwrapAsset.test.ts +65 -0
- package/src/utils/extractNodeFromPath.ts +56 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/requiresAssetWrapper.ts +14 -0
- package/src/utils/traverseAndReplace.ts +34 -0
- package/src/utils/unwrapAsset.ts +16 -0
- package/types/createAsyncTransform.d.ts +24 -0
- package/types/index.d.ts +16 -1
- package/types/transform.d.ts +2 -1
- package/types/types.d.ts +1 -1
- package/types/utils/extractNodeFromPath.d.ts +4 -0
- package/types/utils/index.d.ts +5 -0
- package/types/utils/requiresAssetWrapper.d.ts +3 -0
- package/types/utils/traverseAndReplace.d.ts +4 -0
- package/types/utils/unwrapAsset.d.ts +3 -0
package/types/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Node } from "@player-ui/player";
|
|
2
2
|
export type AsyncNodeHandler = (node: Node.Node, update: (object: any) => void) => void;
|
|
3
|
-
export type AsyncTransformFunc = (id: string, wrapperAssetType: string, asset?: Node.Node, flatten?: boolean) => Node.Asset;
|
|
3
|
+
export type AsyncTransformFunc = (id: string, wrapperAssetType: string, asset?: Node.Node, flatten?: boolean, path?: string[]) => Node.Asset;
|
|
4
4
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Node } from "@player-ui/player";
|
|
2
|
+
/** Follows the given path and returns the node. If there is no match, returns undefined */
|
|
3
|
+
export declare const extractNodeFromPath: (node: Node.Node, path?: string[]) => Node.Node | undefined;
|
|
4
|
+
//# sourceMappingURL=extractNodeFromPath.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Node } from "@player-ui/player";
|
|
2
|
+
/** Replaces a node using the given replace function. If the node is a multi-node it does this transformation to all of its values. */
|
|
3
|
+
export declare const traverseAndReplace: (node: Node.Node, replaceFn: (node: Node.Node) => Node.Node) => Node.Node;
|
|
4
|
+
//# sourceMappingURL=traverseAndReplace.d.ts.map
|