@lowerdeck/serialize 1.0.2 → 1.0.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.
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@lowerdeck/serialize",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
+ "files": [
8
+ "src/**",
9
+ "dist/**",
10
+ "README.md",
11
+ "package.json"
12
+ ],
7
13
  "author": "Tobias Herber",
8
14
  "license": "Apache 2",
9
15
  "type": "module",
@@ -21,14 +27,14 @@
21
27
  "scripts": {
22
28
  "test": "vitest run --passWithNoTests",
23
29
  "lint": "prettier src/**/*.ts --check",
24
- "build": "microbundle"
30
+ "build": "rm -rf ./dist && microbundle"
25
31
  },
26
32
  "dependencies": {
27
33
  "superjson": "^2.2.5"
28
34
  },
29
35
  "devDependencies": {
30
36
  "microbundle": "^0.15.1",
31
- "@lowerdeck/tsconfig": "^1.0.0",
37
+ "@lowerdeck/tsconfig": "^1.0.1",
32
38
  "typescript": "5.8.2",
33
39
  "vitest": "^3.1.2"
34
40
  }
@@ -1,11 +0,0 @@
1
-
2
- $ microbundle
3
- Build "@lowerdeck/serialize" to dist:
4
- 556 B: index.cjs.gz
5
- 475 B: index.cjs.br
6
- 531 B: index.module.js.gz
7
- 453 B: index.module.js.br
8
- 520 B: index.module.js.gz
9
- 440 B: index.module.js.br
10
- 635 B: index.umd.js.gz
11
- 545 B: index.umd.js.br
@@ -1,22 +0,0 @@
1
-
2
- $ vitest run --passWithNoTests
3
- [?25l
4
-  RUN  v3.2.4 /Users/tobias/code/metorial/metorial-enterprise/oss/src/packages/backend/serialize
5
-
6
- [?2026h
7
-  ❯ src/json.test.ts [queued]
8
-
9
-  Test Files 0 passed (1)
10
-  Tests 0 passed (0)
11
-  Start at 10:23:32
12
-  Duration 101ms
13
- [?2026l ✓ src/json.test.ts (2 tests) 2ms
14
- ✓ serialize > encode should return encoded data 1ms
15
- ✓ serialize > decode should return decoded data 0ms
16
-
17
-  Test Files  1 passed (1)
18
-  Tests  2 passed (2)
19
-  Start at  10:23:32
20
-  Duration  222ms (transform 30ms, setup 0ms, collect 32ms, tests 2ms, environment 0ms, prepare 39ms)
21
-
22
- [?25h
package/CHANGELOG.md DELETED
@@ -1,13 +0,0 @@
1
- # @lowerdeck/serialize
2
-
3
- ## 1.0.2
4
-
5
- ### Patch Changes
6
-
7
- - update versions
8
-
9
- ## 1.0.1
10
-
11
- ### Patch Changes
12
-
13
- - Fix exports
@@ -1,2 +0,0 @@
1
- import e from"superjson";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},t.apply(null,arguments)}function r(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}const n=["$$TYPES$$"],o=["__mode"];let a={encode:r=>{var n;let o=e.serialize(r);return null!=(n=o.meta)&&n.referentialEqualities&&delete o.meta.referentialEqualities,JSON.stringify(t({$$TYPES$$:t({__mode:"object"==typeof o.json?"object":"value"},o.meta),data:"object"!=typeof o.json?o.json:void 0},"object"==typeof o.json?o.json:{}))},decode:t=>{if("string"==typeof t&&(t=JSON.parse(t)),"object"!=typeof t)return t;let{$$TYPES$$:a}=t,i=r(t,n);if("object"!=typeof a||!a.__mode)return t;let{__mode:l}=a,f=r(a,o);return e.deserialize({json:"value"==l?i.data:i,meta:f})}};export{a as serialize};
2
- //# sourceMappingURL=index.modern.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.modern.js","sources":["../src/json.ts"],"sourcesContent":["// @ts-ignore\nimport SuperJSON from 'superjson';\n\nexport let serialize = {\n encode: (data: any) => {\n let sup = SuperJSON.serialize(data);\n\n if (sup.meta?.referentialEqualities) {\n delete sup.meta.referentialEqualities;\n }\n\n return JSON.stringify({\n $$TYPES$$: {\n __mode: typeof sup.json == 'object' ? 'object' : 'value',\n ...sup.meta\n },\n\n data: typeof sup.json != 'object' ? sup.json : undefined,\n\n ...(typeof sup.json == 'object' ? sup.json : {})\n });\n },\n\n decode: (data: any) => {\n if (typeof data == 'string') data = JSON.parse(data);\n\n if (typeof data != 'object') return data;\n\n let { $$TYPES$$, ...rest } = data;\n\n if (typeof $$TYPES$$ != 'object' || !$$TYPES$$.__mode) return data;\n\n let { __mode, ...meta } = $$TYPES$$;\n let json = __mode == 'value' ? rest.data : rest;\n\n return SuperJSON.deserialize({ json, meta });\n }\n};\n"],"names":["serialize","encode","data","_sup$meta","sup","SuperJSON","meta","referentialEqualities","JSON","stringify","_extends","$$TYPES$$","__mode","json","undefined","decode","parse","rest","_objectWithoutPropertiesLoose","_excluded","_excluded2","deserialize"],"mappings":"iaAGW,IAAAA,EAAY,CACrBC,OAASC,IAAa,IAAAC,EACpB,IAAIC,EAAMC,EAAUL,UAAUE,GAM9B,OAJIC,OAAJA,EAAIC,EAAIE,OAAJH,EAAUI,8BACLH,EAAIE,KAAKC,sBAGXC,KAAKC,UAASC,EACnBC,CAAAA,UAASD,GACPE,OAA2B,iBAAZR,EAAIS,KAAmB,SAAW,SAC9CT,EAAIE,MAGTJ,KAAyB,iBAAZE,EAAIS,KAAmBT,EAAIS,UAAOC,GAExB,iBAAZV,EAAIS,KAAmBT,EAAIS,KAAO,CAAA,KAIjDE,OAASb,IAGP,GAFmB,iBAARA,IAAkBA,EAAOM,KAAKQ,MAAMd,IAE5B,iBAARA,EAAkB,OAAOA,EAEpC,IAAIS,UAAEA,GAAuBT,EAATe,EAAIC,EAAKhB,EAAIiB,GAEjC,GAAwB,iBAAbR,IAA0BA,EAAUC,OAAQ,OAAOV,EAE9D,IAAIU,OAAEA,GAAoBD,EAATL,EAAIY,EAAKP,EAASS,GAGnC,OAAOf,EAAUgB,YAAY,CAAER,KAFV,SAAVD,EAAoBK,EAAKf,KAAOe,EAENX"}
package/tsconfig.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
- "extends": "@lowerdeck/tsconfig/base.json",
4
- "exclude": ["dist"],
5
- "include": ["src"],
6
- "compilerOptions": {
7
- "outDir": "dist",
8
- "lib": ["es2021"],
9
- "target": "ES2019"
10
- }
11
- }