@bigbinary/babel-preset-neeto 1.0.8 → 1.0.10

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.
@@ -14,7 +14,7 @@ jobs:
14
14
  - name: Setup NodeJS LTS version
15
15
  uses: actions/setup-node@v3
16
16
  with:
17
- node-version: "18.12.0"
17
+ node-version: "22.13"
18
18
 
19
19
  - name: Setup the project
20
20
  run: yarn install
@@ -5,7 +5,7 @@ plan: standard-2
5
5
  global_job_config:
6
6
  setup:
7
7
  - checkout
8
- - neetoci-version node 18.12
8
+ - neetoci-version node 22.13
9
9
  - cache restore
10
10
  - yarn install
11
11
  - cache store
package/.node-version CHANGED
@@ -1 +1 @@
1
- 18.12
1
+ 22.13
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 18.12
1
+ 22.13
@@ -14,7 +14,7 @@ global_job_config:
14
14
  prologue:
15
15
  commands:
16
16
  - checkout
17
- - sem-version node 18.12
17
+ - sem-version node 22.13
18
18
  - yarn install
19
19
  env_vars:
20
20
  - name: ENV
@@ -6,14 +6,13 @@ When we wanted to pick some properties from a zustand store, this is what we
6
6
  need to do:
7
7
 
8
8
  ```js
9
- import { shallow } from "zustand/shallow";
9
+ import { useShallow } from "zustand/shallow";
10
10
 
11
11
  const { order, customer } = useGlobalStore(
12
- store => ({
12
+ useShallow(store => ({
13
13
  order: store[sessionId]?.globals.order,
14
14
  customer: store[sessionId]?.globals.customer,
15
- }),
16
- shallow
15
+ }))
17
16
  );
18
17
  ```
19
18
 
@@ -30,14 +29,14 @@ const { order, customer } = useGlobalStore.pick([sessionId, "globals"]);
30
29
  ```
31
30
 
32
31
  You might also notice that we don't have the
33
- `import { shallow } from "zustand/shallow"` statement in this piece of code. We
34
- don't need that. The plugin will automatically add it for us at the time of
32
+ `import { useShallow } from "zustand/shallow"` statement in this piece of code.
33
+ We don't need that. The plugin will automatically add it for us at the time of
35
34
  transpiling.
36
35
 
37
36
  The plugin detects that `order` and `customer` properties are to be fetched from
38
37
  the `store[sessionId].globals` property from `useGlobalStore` and it generates
39
38
  code for it. Note that the plugin will automatically add
40
- `import { shallow } from "zustand/shallow"` for us. We don't need to add it
39
+ `import { useShallow } from "zustand/shallow"` for us. We don't need to add it
41
40
  ourselves.
42
41
 
43
42
  ## Allowed syntaxes
@@ -170,13 +169,12 @@ const { order, customer } = useGlobalStore.pick([sessionId, "globals"]);
170
169
  Will be transformed to:
171
170
 
172
171
  ```js
173
- import { shallow } from "zustand/shallow";
172
+ import { useShallow } from "zustand/shallow";
174
173
  const { order, customer } = useGlobalStore(
175
- store => ({
174
+ useShallow(store => ({
176
175
  order: store[sessionId]?.["globals"]?.["order"],
177
176
  customer: store[sessionId]?.["globals"]?.["customer"],
178
- }),
179
- shallow
177
+ }))
180
178
  );
181
179
  ```
182
180
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/babel-preset-neeto",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "A babel preset to transform short code to boilerplate at compile time",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -62,13 +62,14 @@ module.exports = function ({ types }) {
62
62
  declarator.init = types.callExpression(
63
63
  types.identifier(declarator.init.callee.object.name),
64
64
  [
65
- types.arrowFunctionExpression(
66
- [types.identifier("store")],
67
- types.objectExpression(
68
- declarator.id.properties.map(toObjectProperty)
69
- )
70
- ),
71
- types.identifier("shallow"),
65
+ types.callExpression(types.identifier("useShallow"), [
66
+ types.arrowFunctionExpression(
67
+ [types.identifier("store")],
68
+ types.objectExpression(
69
+ declarator.id.properties.map(toObjectProperty)
70
+ )
71
+ ),
72
+ ]),
72
73
  ]
73
74
  );
74
75
 
@@ -76,7 +77,7 @@ module.exports = function ({ types }) {
76
77
  path: astPath,
77
78
  types,
78
79
  source: "zustand/shallow",
79
- importName: "shallow",
80
+ importName: "useShallow",
80
81
  });
81
82
  },
82
83
  CallExpression(astPath) {
@@ -1,8 +1,7 @@
1
- import { shallow } from "zustand/shallow";
1
+ import { useShallow } from "zustand/shallow";
2
2
  const { order, customer } = useGlobalStore(
3
- store => ({
3
+ useShallow(store => ({
4
4
  order: store["state"]?.[sessionId]?.["current"]?.[data]?.["order"],
5
5
  customer: store["state"]?.[sessionId]?.["current"]?.[data]?.["customer"],
6
- }),
7
- shallow
6
+ }))
8
7
  );
@@ -1,8 +1,7 @@
1
- import { shallow } from "zustand/shallow";
1
+ import { useShallow } from "zustand/shallow";
2
2
  const { orderId = "#1001", customer = {} } = useGlobalStore(
3
- store => ({
3
+ useShallow(store => ({
4
4
  orderId: store["orderId"],
5
5
  customer: store["customer"],
6
- }),
7
- shallow
6
+ }))
8
7
  );
@@ -1,13 +1,11 @@
1
- import { shallow } from "zustand/shallow";
1
+ import { useShallow } from "zustand/shallow";
2
2
  const { [`customer ${id}`]: customer } = useGlobalStore(
3
- store => ({
3
+ useShallow(store => ({
4
4
  [`customer ${id}`]: store[sessionId]?.[`customer ${id}`],
5
- }),
6
- shallow
5
+ }))
7
6
  );
8
7
  const { [orderId]: order } = useGlobalStore(
9
- store => ({
8
+ useShallow(store => ({
10
9
  [orderId]: store[sessionId]?.["orders"]?.[orderId],
11
- }),
12
- shallow
10
+ }))
13
11
  );
@@ -1,7 +1,6 @@
1
- import { shallow } from "zustand/shallow";
1
+ import { useShallow } from "zustand/shallow";
2
2
  const { customer } = useGlobalStore(
3
- store => ({
3
+ useShallow(store => ({
4
4
  customer: store[sessionId]?.["customer"],
5
- }),
6
- shallow
5
+ }))
7
6
  );
@@ -1,8 +1,7 @@
1
- import { shallow } from "zustand/shallow";
1
+ import { useShallow } from "zustand/shallow";
2
2
  const { order, customer } = useGlobalStore(
3
- store => ({
3
+ useShallow(store => ({
4
4
  order: store["order"],
5
5
  customer: store["customer"],
6
- }),
7
- shallow
6
+ }))
8
7
  );
@@ -1,2 +1,2 @@
1
- import { shallow } from "zustand/shallow";
1
+ import { useShallow } from "zustand/shallow";
2
2
  const { order, customer } = useGlobalStore.pick();
@@ -1,8 +1,7 @@
1
- import { shallow } from "zustand/shallow";
1
+ import { useShallow } from "zustand/shallow";
2
2
  const { order, customer } = useGlobalStore(
3
- store => ({
3
+ useShallow(store => ({
4
4
  order: store["order"],
5
5
  customer: store["customer"],
6
- }),
7
- shallow
6
+ }))
8
7
  );
@@ -1,9 +1,8 @@
1
- import { shallow } from "zustand/shallow";
1
+ import { useShallow } from "zustand/shallow";
2
2
  const { order, customer, address } = useGlobalStore(
3
- store => ({
3
+ useShallow(store => ({
4
4
  order: store["state"]?.["order"],
5
5
  customer: store["state"]?.["customer"],
6
6
  address: store["state"]?.["address"],
7
- }),
8
- shallow
7
+ }))
9
8
  );
@@ -1,8 +1,7 @@
1
- import { shallow } from "zustand/shallow";
1
+ import { useShallow } from "zustand/shallow";
2
2
  const { order, customer } = useStore(
3
- store => ({
3
+ useShallow(store => ({
4
4
  order: store["order"],
5
5
  customer: store["customer"],
6
- }),
7
- shallow
6
+ }))
8
7
  );
@@ -1,10 +1,9 @@
1
- import { shallow } from "zustand/shallow";
1
+ import { useShallow } from "zustand/shallow";
2
2
  import React from "react";
3
3
  import { sample } from "somewhere";
4
4
  const { order, customer } = useGlobalStore(
5
- store => ({
5
+ useShallow(store => ({
6
6
  order: store["order"],
7
7
  customer: store["customer"],
8
- }),
9
- shallow
8
+ }))
10
9
  );
@@ -1 +0,0 @@
1
- * @Amaljith-K