@aws-amplify/graphql-model-transformer 1.4.0 → 1.5.0-rds.0

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.
Files changed (163) hide show
  1. package/API.md +15 -15
  2. package/CHANGELOG.md +11 -0
  3. package/lib/graphql-types/mutation.d.ts.map +1 -1
  4. package/lib/graphql-types/mutation.js +9 -2
  5. package/lib/graphql-types/mutation.js.map +1 -1
  6. package/lib/rds-lambda.zip +0 -0
  7. package/lib/rds-notification-lambda.zip +0 -0
  8. package/lib/rds-patching-lambda.zip +0 -0
  9. package/lib/resolvers/generators/dynamodb-vtl-generator.d.ts +6 -5
  10. package/lib/resolvers/generators/dynamodb-vtl-generator.d.ts.map +1 -1
  11. package/lib/resolvers/generators/dynamodb-vtl-generator.js +5 -5
  12. package/lib/resolvers/generators/dynamodb-vtl-generator.js.map +1 -1
  13. package/lib/resolvers/generators/rds-vtl-generator.d.ts +6 -5
  14. package/lib/resolvers/generators/rds-vtl-generator.d.ts.map +1 -1
  15. package/lib/resolvers/generators/rds-vtl-generator.js +10 -10
  16. package/lib/resolvers/generators/rds-vtl-generator.js.map +1 -1
  17. package/lib/resolvers/generators/vtl-generator.d.ts +6 -5
  18. package/lib/resolvers/generators/vtl-generator.d.ts.map +1 -1
  19. package/lib/resolvers/rds/mutation.d.ts +4 -3
  20. package/lib/resolvers/rds/mutation.d.ts.map +1 -1
  21. package/lib/resolvers/rds/mutation.js +7 -3
  22. package/lib/resolvers/rds/mutation.js.map +1 -1
  23. package/lib/resolvers/rds/query.d.ts +2 -1
  24. package/lib/resolvers/rds/query.d.ts.map +1 -1
  25. package/lib/resolvers/rds/query.js +3 -1
  26. package/lib/resolvers/rds/query.js.map +1 -1
  27. package/lib/resolvers/rds/resolver.d.ts +6 -2
  28. package/lib/resolvers/rds/resolver.d.ts.map +1 -1
  29. package/lib/resolvers/rds/resolver.js +39 -25
  30. package/lib/resolvers/rds/resolver.js.map +1 -1
  31. package/lib/resources/model-resource-generator.js +5 -5
  32. package/lib/resources/model-resource-generator.js.map +1 -1
  33. package/package.json +4 -4
  34. package/publish-notification-lambda/node_modules/.package-lock.json +13 -13
  35. package/publish-notification-lambda/node_modules/@smithy/protocol-http/package.json +2 -2
  36. package/publish-notification-lambda/node_modules/@smithy/types/README.md +37 -0
  37. package/publish-notification-lambda/node_modules/@smithy/types/package.json +3 -2
  38. package/publish-notification-lambda/node_modules/@types/node/README.md +2 -2
  39. package/publish-notification-lambda/node_modules/@types/node/package.json +2 -7
  40. package/publish-notification-lambda/node_modules/tslib/package.json +1 -1
  41. package/publish-notification-lambda/node_modules/tslib/tslib.es6.mjs +1 -1
  42. package/publish-notification-lambda/package-lock.json +13 -13
  43. package/rds-lambda/handler.ts +2 -1
  44. package/rds-lambda/node_modules/.package-lock.json +370 -345
  45. package/rds-lambda/node_modules/@babel/code-frame/README.md +1 -1
  46. package/rds-lambda/node_modules/@babel/code-frame/package.json +3 -2
  47. package/rds-lambda/node_modules/@babel/core/cjs-proxy.cjs +3 -1
  48. package/rds-lambda/node_modules/@babel/core/package.json +10 -10
  49. package/rds-lambda/node_modules/@babel/generator/package.json +3 -3
  50. package/rds-lambda/node_modules/@babel/helper-compilation-targets/package.json +1 -5
  51. package/rds-lambda/node_modules/@babel/helpers/package.json +6 -6
  52. package/rds-lambda/node_modules/@babel/highlight/README.md +1 -1
  53. package/rds-lambda/node_modules/@babel/highlight/package.json +2 -3
  54. package/rds-lambda/node_modules/@babel/parser/package.json +3 -3
  55. package/rds-lambda/node_modules/@babel/traverse/package.json +6 -5
  56. package/rds-lambda/node_modules/@babel/types/README.md +1 -1
  57. package/rds-lambda/node_modules/@babel/types/package.json +3 -4
  58. package/rds-lambda/node_modules/@jest/console/package.json +5 -5
  59. package/rds-lambda/node_modules/@jest/core/package.json +20 -20
  60. package/rds-lambda/node_modules/@jest/environment/package.json +4 -4
  61. package/rds-lambda/node_modules/@jest/expect/package.json +4 -4
  62. package/rds-lambda/node_modules/@jest/expect-utils/package.json +3 -3
  63. package/rds-lambda/node_modules/@jest/fake-timers/package.json +6 -6
  64. package/rds-lambda/node_modules/@jest/globals/package.json +5 -5
  65. package/rds-lambda/node_modules/@jest/reporters/package.json +10 -10
  66. package/rds-lambda/node_modules/@jest/test-result/package.json +5 -5
  67. package/rds-lambda/node_modules/@jest/test-sequencer/package.json +5 -5
  68. package/rds-lambda/node_modules/@jest/transform/package.json +6 -6
  69. package/rds-lambda/node_modules/@jridgewell/resolve-uri/package.json +2 -2
  70. package/rds-lambda/node_modules/@jridgewell/trace-mapping/package.json +3 -3
  71. package/rds-lambda/node_modules/@smithy/protocol-http/package.json +2 -2
  72. package/rds-lambda/node_modules/@smithy/types/README.md +37 -0
  73. package/rds-lambda/node_modules/@smithy/types/package.json +3 -2
  74. package/rds-lambda/node_modules/@types/node/README.md +2 -2
  75. package/rds-lambda/node_modules/@types/node/package.json +2 -7
  76. package/rds-lambda/node_modules/babel-jest/package.json +4 -4
  77. package/rds-lambda/node_modules/browserslist/package.json +4 -4
  78. package/rds-lambda/node_modules/caniuse-lite/package.json +1 -1
  79. package/rds-lambda/node_modules/dedent/README.md +56 -0
  80. package/rds-lambda/node_modules/dedent/dist/dedent.d.mts +17 -0
  81. package/rds-lambda/node_modules/dedent/dist/dedent.mjs +59 -0
  82. package/rds-lambda/node_modules/dedent/package.json +54 -10
  83. package/rds-lambda/node_modules/electron-to-chromium/full-chromium-versions.json +1 -1
  84. package/rds-lambda/node_modules/electron-to-chromium/full-versions.json +1 -1
  85. package/rds-lambda/node_modules/electron-to-chromium/package.json +1 -1
  86. package/rds-lambda/node_modules/electron-to-chromium/versions.json +1 -1
  87. package/rds-lambda/node_modules/expect/package.json +7 -7
  88. package/rds-lambda/node_modules/is-core-module/CHANGELOG.md +7 -0
  89. package/rds-lambda/node_modules/is-core-module/core.json +3 -3
  90. package/rds-lambda/node_modules/is-core-module/package.json +5 -5
  91. package/rds-lambda/node_modules/istanbul-lib-report/CHANGELOG.md +7 -0
  92. package/rds-lambda/node_modules/istanbul-lib-report/package.json +5 -6
  93. package/rds-lambda/node_modules/istanbul-reports/CHANGELOG.md +7 -0
  94. package/rds-lambda/node_modules/istanbul-reports/package.json +1 -1
  95. package/rds-lambda/node_modules/jest/package.json +4 -4
  96. package/rds-lambda/node_modules/jest-circus/package.json +13 -14
  97. package/rds-lambda/node_modules/jest-cli/package.json +7 -7
  98. package/rds-lambda/node_modules/jest-config/package.json +11 -11
  99. package/rds-lambda/node_modules/jest-diff/package.json +4 -4
  100. package/rds-lambda/node_modules/jest-each/package.json +4 -4
  101. package/rds-lambda/node_modules/jest-environment-node/package.json +7 -7
  102. package/rds-lambda/node_modules/jest-haste-map/package.json +4 -4
  103. package/rds-lambda/node_modules/jest-leak-detector/package.json +3 -3
  104. package/rds-lambda/node_modules/jest-matcher-utils/package.json +5 -5
  105. package/rds-lambda/node_modules/jest-message-util/package.json +3 -3
  106. package/rds-lambda/node_modules/jest-mock/package.json +3 -3
  107. package/rds-lambda/node_modules/jest-resolve/package.json +5 -5
  108. package/rds-lambda/node_modules/jest-resolve-dependencies/package.json +7 -7
  109. package/rds-lambda/node_modules/jest-runner/package.json +17 -17
  110. package/rds-lambda/node_modules/jest-runtime/package.json +15 -15
  111. package/rds-lambda/node_modules/jest-snapshot/package.json +12 -12
  112. package/rds-lambda/node_modules/jest-util/package.json +2 -2
  113. package/rds-lambda/node_modules/jest-validate/package.json +3 -3
  114. package/rds-lambda/node_modules/jest-watcher/package.json +4 -4
  115. package/rds-lambda/node_modules/jest-worker/package.json +4 -4
  116. package/rds-lambda/node_modules/make-dir/license +1 -1
  117. package/rds-lambda/node_modules/make-dir/node_modules/lru-cache/LICENSE +15 -0
  118. package/rds-lambda/node_modules/make-dir/node_modules/lru-cache/README.md +166 -0
  119. package/rds-lambda/node_modules/make-dir/node_modules/lru-cache/package.json +34 -0
  120. package/rds-lambda/node_modules/make-dir/node_modules/semver/LICENSE +15 -0
  121. package/rds-lambda/node_modules/make-dir/node_modules/semver/README.md +637 -0
  122. package/rds-lambda/node_modules/make-dir/node_modules/semver/package.json +87 -0
  123. package/rds-lambda/node_modules/make-dir/node_modules/semver/range.bnf +16 -0
  124. package/rds-lambda/node_modules/make-dir/node_modules/yallist/LICENSE +15 -0
  125. package/rds-lambda/node_modules/make-dir/node_modules/yallist/README.md +204 -0
  126. package/rds-lambda/node_modules/make-dir/node_modules/yallist/package.json +29 -0
  127. package/rds-lambda/node_modules/make-dir/package.json +15 -11
  128. package/rds-lambda/node_modules/make-dir/readme.md +1 -1
  129. package/rds-lambda/node_modules/pretty-format/package.json +3 -3
  130. package/rds-lambda/node_modules/resolve/lib/core.json +4 -1
  131. package/rds-lambda/node_modules/resolve/package.json +6 -6
  132. package/rds-lambda/node_modules/tslib/package.json +1 -1
  133. package/rds-lambda/node_modules/tslib/tslib.es6.mjs +1 -1
  134. package/rds-lambda/package-lock.json +370 -345
  135. package/rds-patching-lambda/node_modules/.package-lock.json +13 -13
  136. package/rds-patching-lambda/node_modules/@smithy/protocol-http/package.json +2 -2
  137. package/rds-patching-lambda/node_modules/@smithy/types/README.md +37 -0
  138. package/rds-patching-lambda/node_modules/@smithy/types/package.json +3 -2
  139. package/rds-patching-lambda/node_modules/@types/node/README.md +2 -2
  140. package/rds-patching-lambda/node_modules/@types/node/package.json +2 -7
  141. package/rds-patching-lambda/node_modules/tslib/package.json +1 -1
  142. package/rds-patching-lambda/node_modules/tslib/tslib.es6.mjs +1 -1
  143. package/rds-patching-lambda/package-lock.json +13 -13
  144. package/src/__tests__/__snapshots__/model-transformer.test.ts.snap +688 -0
  145. package/src/__tests__/model-transformer.test.ts +58 -1
  146. package/src/graphql-types/mutation.ts +11 -3
  147. package/src/resolvers/generators/dynamodb-vtl-generator.ts +7 -5
  148. package/src/resolvers/generators/rds-vtl-generator.ts +12 -10
  149. package/src/resolvers/generators/vtl-generator.ts +6 -5
  150. package/src/resolvers/rds/mutation.ts +18 -3
  151. package/src/resolvers/rds/query.ts +9 -1
  152. package/src/resolvers/rds/resolver.ts +45 -26
  153. package/src/resources/model-resource-generator.ts +5 -5
  154. package/tsconfig.tsbuildinfo +1 -1
  155. package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/LICENSE +0 -21
  156. package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/README.md +0 -200
  157. package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -164
  158. package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -1
  159. package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/package.json +0 -75
  160. package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +0 -198
  161. package/rds-lambda/node_modules/@types/prettier/LICENSE +0 -21
  162. package/rds-lambda/node_modules/@types/prettier/README.md +0 -16
  163. package/rds-lambda/node_modules/@types/prettier/package.json +0 -65
@@ -1,21 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (c) 2015 Rich Harris
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,200 +0,0 @@
1
- # sourcemap-codec
2
-
3
- Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit).
4
-
5
-
6
- ## Why?
7
-
8
- Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap.
9
-
10
- This package makes the process slightly easier.
11
-
12
-
13
- ## Installation
14
-
15
- ```bash
16
- npm install sourcemap-codec
17
- ```
18
-
19
-
20
- ## Usage
21
-
22
- ```js
23
- import { encode, decode } from 'sourcemap-codec';
24
-
25
- var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
26
-
27
- assert.deepEqual( decoded, [
28
- // the first line (of the generated code) has no mappings,
29
- // as shown by the starting semi-colon (which separates lines)
30
- [],
31
-
32
- // the second line contains four (comma-separated) segments
33
- [
34
- // segments are encoded as you'd expect:
35
- // [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ]
36
-
37
- // i.e. the first segment begins at column 2, and maps back to the second column
38
- // of the second line (both zero-based) of the 0th source, and uses the 0th
39
- // name in the `map.names` array
40
- [ 2, 0, 2, 2, 0 ],
41
-
42
- // the remaining segments are 4-length rather than 5-length,
43
- // because they don't map a name
44
- [ 4, 0, 2, 4 ],
45
- [ 6, 0, 2, 5 ],
46
- [ 7, 0, 2, 7 ]
47
- ],
48
-
49
- // the final line contains two segments
50
- [
51
- [ 2, 1, 10, 19 ],
52
- [ 12, 1, 11, 20 ]
53
- ]
54
- ]);
55
-
56
- var encoded = encode( decoded );
57
- assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
58
- ```
59
-
60
- ## Benchmarks
61
-
62
- ```
63
- node v18.0.0
64
-
65
- amp.js.map - 45120 segments
66
-
67
- Decode Memory Usage:
68
- @jridgewell/sourcemap-codec 5479160 bytes
69
- sourcemap-codec 5659336 bytes
70
- source-map-0.6.1 17144440 bytes
71
- source-map-0.8.0 6867424 bytes
72
- Smallest memory usage is @jridgewell/sourcemap-codec
73
-
74
- Decode speed:
75
- decode: @jridgewell/sourcemap-codec x 502 ops/sec ±1.03% (90 runs sampled)
76
- decode: sourcemap-codec x 445 ops/sec ±0.97% (92 runs sampled)
77
- decode: source-map-0.6.1 x 36.01 ops/sec ±1.64% (49 runs sampled)
78
- decode: source-map-0.8.0 x 367 ops/sec ±0.04% (95 runs sampled)
79
- Fastest is decode: @jridgewell/sourcemap-codec
80
-
81
- Encode Memory Usage:
82
- @jridgewell/sourcemap-codec 1261620 bytes
83
- sourcemap-codec 9119248 bytes
84
- source-map-0.6.1 8968560 bytes
85
- source-map-0.8.0 8952952 bytes
86
- Smallest memory usage is @jridgewell/sourcemap-codec
87
-
88
- Encode speed:
89
- encode: @jridgewell/sourcemap-codec x 738 ops/sec ±0.42% (98 runs sampled)
90
- encode: sourcemap-codec x 238 ops/sec ±0.73% (88 runs sampled)
91
- encode: source-map-0.6.1 x 162 ops/sec ±0.43% (84 runs sampled)
92
- encode: source-map-0.8.0 x 191 ops/sec ±0.34% (90 runs sampled)
93
- Fastest is encode: @jridgewell/sourcemap-codec
94
-
95
-
96
- ***
97
-
98
-
99
- babel.min.js.map - 347793 segments
100
-
101
- Decode Memory Usage:
102
- @jridgewell/sourcemap-codec 35338184 bytes
103
- sourcemap-codec 35922736 bytes
104
- source-map-0.6.1 62366360 bytes
105
- source-map-0.8.0 44337416 bytes
106
- Smallest memory usage is @jridgewell/sourcemap-codec
107
-
108
- Decode speed:
109
- decode: @jridgewell/sourcemap-codec x 40.35 ops/sec ±4.47% (54 runs sampled)
110
- decode: sourcemap-codec x 36.76 ops/sec ±3.67% (51 runs sampled)
111
- decode: source-map-0.6.1 x 4.44 ops/sec ±2.15% (16 runs sampled)
112
- decode: source-map-0.8.0 x 59.35 ops/sec ±0.05% (78 runs sampled)
113
- Fastest is decode: source-map-0.8.0
114
-
115
- Encode Memory Usage:
116
- @jridgewell/sourcemap-codec 7212604 bytes
117
- sourcemap-codec 21421456 bytes
118
- source-map-0.6.1 25286888 bytes
119
- source-map-0.8.0 25498744 bytes
120
- Smallest memory usage is @jridgewell/sourcemap-codec
121
-
122
- Encode speed:
123
- encode: @jridgewell/sourcemap-codec x 112 ops/sec ±0.13% (84 runs sampled)
124
- encode: sourcemap-codec x 30.23 ops/sec ±2.76% (53 runs sampled)
125
- encode: source-map-0.6.1 x 19.43 ops/sec ±3.70% (37 runs sampled)
126
- encode: source-map-0.8.0 x 19.40 ops/sec ±3.26% (37 runs sampled)
127
- Fastest is encode: @jridgewell/sourcemap-codec
128
-
129
-
130
- ***
131
-
132
-
133
- preact.js.map - 1992 segments
134
-
135
- Decode Memory Usage:
136
- @jridgewell/sourcemap-codec 500272 bytes
137
- sourcemap-codec 516864 bytes
138
- source-map-0.6.1 1596672 bytes
139
- source-map-0.8.0 517272 bytes
140
- Smallest memory usage is @jridgewell/sourcemap-codec
141
-
142
- Decode speed:
143
- decode: @jridgewell/sourcemap-codec x 16,137 ops/sec ±0.17% (99 runs sampled)
144
- decode: sourcemap-codec x 12,139 ops/sec ±0.13% (99 runs sampled)
145
- decode: source-map-0.6.1 x 1,264 ops/sec ±0.12% (100 runs sampled)
146
- decode: source-map-0.8.0 x 9,894 ops/sec ±0.08% (101 runs sampled)
147
- Fastest is decode: @jridgewell/sourcemap-codec
148
-
149
- Encode Memory Usage:
150
- @jridgewell/sourcemap-codec 321026 bytes
151
- sourcemap-codec 830832 bytes
152
- source-map-0.6.1 586608 bytes
153
- source-map-0.8.0 586680 bytes
154
- Smallest memory usage is @jridgewell/sourcemap-codec
155
-
156
- Encode speed:
157
- encode: @jridgewell/sourcemap-codec x 19,876 ops/sec ±0.78% (95 runs sampled)
158
- encode: sourcemap-codec x 6,983 ops/sec ±0.15% (100 runs sampled)
159
- encode: source-map-0.6.1 x 5,070 ops/sec ±0.12% (102 runs sampled)
160
- encode: source-map-0.8.0 x 5,641 ops/sec ±0.17% (100 runs sampled)
161
- Fastest is encode: @jridgewell/sourcemap-codec
162
-
163
-
164
- ***
165
-
166
-
167
- react.js.map - 5726 segments
168
-
169
- Decode Memory Usage:
170
- @jridgewell/sourcemap-codec 734848 bytes
171
- sourcemap-codec 954200 bytes
172
- source-map-0.6.1 2276432 bytes
173
- source-map-0.8.0 955488 bytes
174
- Smallest memory usage is @jridgewell/sourcemap-codec
175
-
176
- Decode speed:
177
- decode: @jridgewell/sourcemap-codec x 5,723 ops/sec ±0.12% (98 runs sampled)
178
- decode: sourcemap-codec x 4,555 ops/sec ±0.09% (101 runs sampled)
179
- decode: source-map-0.6.1 x 437 ops/sec ±0.11% (93 runs sampled)
180
- decode: source-map-0.8.0 x 3,441 ops/sec ±0.15% (100 runs sampled)
181
- Fastest is decode: @jridgewell/sourcemap-codec
182
-
183
- Encode Memory Usage:
184
- @jridgewell/sourcemap-codec 638672 bytes
185
- sourcemap-codec 1109840 bytes
186
- source-map-0.6.1 1321224 bytes
187
- source-map-0.8.0 1324448 bytes
188
- Smallest memory usage is @jridgewell/sourcemap-codec
189
-
190
- Encode speed:
191
- encode: @jridgewell/sourcemap-codec x 6,801 ops/sec ±0.48% (98 runs sampled)
192
- encode: sourcemap-codec x 2,533 ops/sec ±0.13% (101 runs sampled)
193
- encode: source-map-0.6.1 x 2,248 ops/sec ±0.08% (100 runs sampled)
194
- encode: source-map-0.8.0 x 2,303 ops/sec ±0.15% (100 runs sampled)
195
- Fastest is encode: @jridgewell/sourcemap-codec
196
- ```
197
-
198
- # License
199
-
200
- MIT
@@ -1,164 +0,0 @@
1
- const comma = ','.charCodeAt(0);
2
- const semicolon = ';'.charCodeAt(0);
3
- const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
4
- const intToChar = new Uint8Array(64); // 64 possible chars.
5
- const charToInt = new Uint8Array(128); // z is 122 in ASCII
6
- for (let i = 0; i < chars.length; i++) {
7
- const c = chars.charCodeAt(i);
8
- intToChar[i] = c;
9
- charToInt[c] = i;
10
- }
11
- // Provide a fallback for older environments.
12
- const td = typeof TextDecoder !== 'undefined'
13
- ? /* #__PURE__ */ new TextDecoder()
14
- : typeof Buffer !== 'undefined'
15
- ? {
16
- decode(buf) {
17
- const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
18
- return out.toString();
19
- },
20
- }
21
- : {
22
- decode(buf) {
23
- let out = '';
24
- for (let i = 0; i < buf.length; i++) {
25
- out += String.fromCharCode(buf[i]);
26
- }
27
- return out;
28
- },
29
- };
30
- function decode(mappings) {
31
- const state = new Int32Array(5);
32
- const decoded = [];
33
- let index = 0;
34
- do {
35
- const semi = indexOf(mappings, index);
36
- const line = [];
37
- let sorted = true;
38
- let lastCol = 0;
39
- state[0] = 0;
40
- for (let i = index; i < semi; i++) {
41
- let seg;
42
- i = decodeInteger(mappings, i, state, 0); // genColumn
43
- const col = state[0];
44
- if (col < lastCol)
45
- sorted = false;
46
- lastCol = col;
47
- if (hasMoreVlq(mappings, i, semi)) {
48
- i = decodeInteger(mappings, i, state, 1); // sourcesIndex
49
- i = decodeInteger(mappings, i, state, 2); // sourceLine
50
- i = decodeInteger(mappings, i, state, 3); // sourceColumn
51
- if (hasMoreVlq(mappings, i, semi)) {
52
- i = decodeInteger(mappings, i, state, 4); // namesIndex
53
- seg = [col, state[1], state[2], state[3], state[4]];
54
- }
55
- else {
56
- seg = [col, state[1], state[2], state[3]];
57
- }
58
- }
59
- else {
60
- seg = [col];
61
- }
62
- line.push(seg);
63
- }
64
- if (!sorted)
65
- sort(line);
66
- decoded.push(line);
67
- index = semi + 1;
68
- } while (index <= mappings.length);
69
- return decoded;
70
- }
71
- function indexOf(mappings, index) {
72
- const idx = mappings.indexOf(';', index);
73
- return idx === -1 ? mappings.length : idx;
74
- }
75
- function decodeInteger(mappings, pos, state, j) {
76
- let value = 0;
77
- let shift = 0;
78
- let integer = 0;
79
- do {
80
- const c = mappings.charCodeAt(pos++);
81
- integer = charToInt[c];
82
- value |= (integer & 31) << shift;
83
- shift += 5;
84
- } while (integer & 32);
85
- const shouldNegate = value & 1;
86
- value >>>= 1;
87
- if (shouldNegate) {
88
- value = -0x80000000 | -value;
89
- }
90
- state[j] += value;
91
- return pos;
92
- }
93
- function hasMoreVlq(mappings, i, length) {
94
- if (i >= length)
95
- return false;
96
- return mappings.charCodeAt(i) !== comma;
97
- }
98
- function sort(line) {
99
- line.sort(sortComparator);
100
- }
101
- function sortComparator(a, b) {
102
- return a[0] - b[0];
103
- }
104
- function encode(decoded) {
105
- const state = new Int32Array(5);
106
- const bufLength = 1024 * 16;
107
- const subLength = bufLength - 36;
108
- const buf = new Uint8Array(bufLength);
109
- const sub = buf.subarray(0, subLength);
110
- let pos = 0;
111
- let out = '';
112
- for (let i = 0; i < decoded.length; i++) {
113
- const line = decoded[i];
114
- if (i > 0) {
115
- if (pos === bufLength) {
116
- out += td.decode(buf);
117
- pos = 0;
118
- }
119
- buf[pos++] = semicolon;
120
- }
121
- if (line.length === 0)
122
- continue;
123
- state[0] = 0;
124
- for (let j = 0; j < line.length; j++) {
125
- const segment = line[j];
126
- // We can push up to 5 ints, each int can take at most 7 chars, and we
127
- // may push a comma.
128
- if (pos > subLength) {
129
- out += td.decode(sub);
130
- buf.copyWithin(0, subLength, pos);
131
- pos -= subLength;
132
- }
133
- if (j > 0)
134
- buf[pos++] = comma;
135
- pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
136
- if (segment.length === 1)
137
- continue;
138
- pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
139
- pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
140
- pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
141
- if (segment.length === 4)
142
- continue;
143
- pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
144
- }
145
- }
146
- return out + td.decode(buf.subarray(0, pos));
147
- }
148
- function encodeInteger(buf, pos, state, segment, j) {
149
- const next = segment[j];
150
- let num = next - state[j];
151
- state[j] = next;
152
- num = num < 0 ? (-num << 1) | 1 : num << 1;
153
- do {
154
- let clamped = num & 0b011111;
155
- num >>>= 5;
156
- if (num > 0)
157
- clamped |= 0b100000;
158
- buf[pos++] = intToChar[clamped];
159
- } while (num > 0);
160
- return pos;
161
- }
162
-
163
- export { decode, encode };
164
- //# sourceMappingURL=sourcemap-codec.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sourcemap-codec.mjs","sources":["../src/sourcemap-codec.ts"],"sourcesContent":[null],"names":[],"mappings":"AAOA,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAChC,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,KAAK,GAAG,kEAAkE,CAAC;AACjF,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACrC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACrC,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9B,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACjB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAClB;AAED;AACA,MAAM,EAAE,GACN,OAAO,WAAW,KAAK,WAAW;sBACd,IAAI,WAAW,EAAE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QACD,IAAI,OAAO,GAAG,GAAG,GAAG,QAAQ,CAAC;QAC7B,GAAG,MAAM,CAAC,CAAC;QACX,IAAI,GAAG,GAAG,CAAC;YAAE,OAAO,IAAI,QAAQ,CAAC;QACjC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;KACjC,QAAQ,GAAG,GAAG,CAAC,EAAE;IAElB,OAAO,GAAG,CAAC;AACb;;;;"}
@@ -1,75 +0,0 @@
1
- {
2
- "name": "@jridgewell/sourcemap-codec",
3
- "version": "1.4.14",
4
- "description": "Encode/decode sourcemap mappings",
5
- "keywords": [
6
- "sourcemap",
7
- "vlq"
8
- ],
9
- "main": "dist/sourcemap-codec.umd.js",
10
- "module": "dist/sourcemap-codec.mjs",
11
- "typings": "dist/types/sourcemap-codec.d.ts",
12
- "files": [
13
- "dist",
14
- "src"
15
- ],
16
- "exports": {
17
- ".": [
18
- {
19
- "types": "./dist/types/sourcemap-codec.d.ts",
20
- "browser": "./dist/sourcemap-codec.umd.js",
21
- "import": "./dist/sourcemap-codec.mjs",
22
- "require": "./dist/sourcemap-codec.umd.js"
23
- },
24
- "./dist/sourcemap-codec.umd.js"
25
- ],
26
- "./package.json": "./package.json"
27
- },
28
- "scripts": {
29
- "benchmark": "run-s build:rollup benchmark:*",
30
- "benchmark:install": "cd benchmark && npm install",
31
- "benchmark:only": "node --expose-gc benchmark/index.js",
32
- "build": "run-s -n build:*",
33
- "build:rollup": "rollup -c rollup.config.js",
34
- "build:ts": "tsc --project tsconfig.build.json",
35
- "lint": "run-s -n lint:*",
36
- "lint:prettier": "npm run test:lint:prettier -- --write",
37
- "lint:ts": "npm run test:lint:ts -- --fix",
38
- "prebuild": "rm -rf dist",
39
- "prepublishOnly": "npm run preversion",
40
- "preversion": "run-s test build",
41
- "pretest": "run-s build:rollup",
42
- "test": "run-s -n test:lint test:only",
43
- "test:debug": "mocha --inspect-brk",
44
- "test:lint": "run-s -n test:lint:*",
45
- "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
46
- "test:lint:ts": "eslint '{src,test}/**/*.ts'",
47
- "test:only": "mocha",
48
- "test:coverage": "c8 mocha",
49
- "test:watch": "mocha --watch"
50
- },
51
- "repository": {
52
- "type": "git",
53
- "url": "git+https://github.com/jridgewell/sourcemap-codec.git"
54
- },
55
- "author": "Rich Harris",
56
- "license": "MIT",
57
- "devDependencies": {
58
- "@rollup/plugin-typescript": "8.3.0",
59
- "@types/node": "17.0.15",
60
- "@typescript-eslint/eslint-plugin": "5.10.0",
61
- "@typescript-eslint/parser": "5.10.0",
62
- "benchmark": "2.1.4",
63
- "c8": "7.11.2",
64
- "eslint": "8.7.0",
65
- "eslint-config-prettier": "8.3.0",
66
- "mocha": "9.2.0",
67
- "npm-run-all": "4.1.5",
68
- "prettier": "2.5.1",
69
- "rollup": "2.64.0",
70
- "source-map": "0.6.1",
71
- "source-map-js": "1.0.2",
72
- "sourcemap-codec": "1.4.8",
73
- "typescript": "4.5.4"
74
- }
75
- }
@@ -1,198 +0,0 @@
1
- export type SourceMapSegment =
2
- | [number]
3
- | [number, number, number, number]
4
- | [number, number, number, number, number];
5
- export type SourceMapLine = SourceMapSegment[];
6
- export type SourceMapMappings = SourceMapLine[];
7
-
8
- const comma = ','.charCodeAt(0);
9
- const semicolon = ';'.charCodeAt(0);
10
- const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
11
- const intToChar = new Uint8Array(64); // 64 possible chars.
12
- const charToInt = new Uint8Array(128); // z is 122 in ASCII
13
-
14
- for (let i = 0; i < chars.length; i++) {
15
- const c = chars.charCodeAt(i);
16
- intToChar[i] = c;
17
- charToInt[c] = i;
18
- }
19
-
20
- // Provide a fallback for older environments.
21
- const td =
22
- typeof TextDecoder !== 'undefined'
23
- ? /* #__PURE__ */ new TextDecoder()
24
- : typeof Buffer !== 'undefined'
25
- ? {
26
- decode(buf: Uint8Array) {
27
- const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
28
- return out.toString();
29
- },
30
- }
31
- : {
32
- decode(buf: Uint8Array) {
33
- let out = '';
34
- for (let i = 0; i < buf.length; i++) {
35
- out += String.fromCharCode(buf[i]);
36
- }
37
- return out;
38
- },
39
- };
40
-
41
- export function decode(mappings: string): SourceMapMappings {
42
- const state: [number, number, number, number, number] = new Int32Array(5) as any;
43
- const decoded: SourceMapMappings = [];
44
-
45
- let index = 0;
46
- do {
47
- const semi = indexOf(mappings, index);
48
- const line: SourceMapLine = [];
49
- let sorted = true;
50
- let lastCol = 0;
51
- state[0] = 0;
52
-
53
- for (let i = index; i < semi; i++) {
54
- let seg: SourceMapSegment;
55
-
56
- i = decodeInteger(mappings, i, state, 0); // genColumn
57
- const col = state[0];
58
- if (col < lastCol) sorted = false;
59
- lastCol = col;
60
-
61
- if (hasMoreVlq(mappings, i, semi)) {
62
- i = decodeInteger(mappings, i, state, 1); // sourcesIndex
63
- i = decodeInteger(mappings, i, state, 2); // sourceLine
64
- i = decodeInteger(mappings, i, state, 3); // sourceColumn
65
-
66
- if (hasMoreVlq(mappings, i, semi)) {
67
- i = decodeInteger(mappings, i, state, 4); // namesIndex
68
- seg = [col, state[1], state[2], state[3], state[4]];
69
- } else {
70
- seg = [col, state[1], state[2], state[3]];
71
- }
72
- } else {
73
- seg = [col];
74
- }
75
-
76
- line.push(seg);
77
- }
78
-
79
- if (!sorted) sort(line);
80
- decoded.push(line);
81
- index = semi + 1;
82
- } while (index <= mappings.length);
83
-
84
- return decoded;
85
- }
86
-
87
- function indexOf(mappings: string, index: number): number {
88
- const idx = mappings.indexOf(';', index);
89
- return idx === -1 ? mappings.length : idx;
90
- }
91
-
92
- function decodeInteger(mappings: string, pos: number, state: SourceMapSegment, j: number): number {
93
- let value = 0;
94
- let shift = 0;
95
- let integer = 0;
96
-
97
- do {
98
- const c = mappings.charCodeAt(pos++);
99
- integer = charToInt[c];
100
- value |= (integer & 31) << shift;
101
- shift += 5;
102
- } while (integer & 32);
103
-
104
- const shouldNegate = value & 1;
105
- value >>>= 1;
106
-
107
- if (shouldNegate) {
108
- value = -0x80000000 | -value;
109
- }
110
-
111
- state[j] += value;
112
- return pos;
113
- }
114
-
115
- function hasMoreVlq(mappings: string, i: number, length: number): boolean {
116
- if (i >= length) return false;
117
- return mappings.charCodeAt(i) !== comma;
118
- }
119
-
120
- function sort(line: SourceMapSegment[]) {
121
- line.sort(sortComparator);
122
- }
123
-
124
- function sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {
125
- return a[0] - b[0];
126
- }
127
-
128
- export function encode(decoded: SourceMapMappings): string;
129
- export function encode(decoded: Readonly<SourceMapMappings>): string;
130
- export function encode(decoded: Readonly<SourceMapMappings>): string {
131
- const state: [number, number, number, number, number] = new Int32Array(5) as any;
132
- const bufLength = 1024 * 16;
133
- const subLength = bufLength - 36;
134
- const buf = new Uint8Array(bufLength);
135
- const sub = buf.subarray(0, subLength);
136
- let pos = 0;
137
- let out = '';
138
-
139
- for (let i = 0; i < decoded.length; i++) {
140
- const line = decoded[i];
141
- if (i > 0) {
142
- if (pos === bufLength) {
143
- out += td.decode(buf);
144
- pos = 0;
145
- }
146
- buf[pos++] = semicolon;
147
- }
148
- if (line.length === 0) continue;
149
-
150
- state[0] = 0;
151
-
152
- for (let j = 0; j < line.length; j++) {
153
- const segment = line[j];
154
- // We can push up to 5 ints, each int can take at most 7 chars, and we
155
- // may push a comma.
156
- if (pos > subLength) {
157
- out += td.decode(sub);
158
- buf.copyWithin(0, subLength, pos);
159
- pos -= subLength;
160
- }
161
- if (j > 0) buf[pos++] = comma;
162
-
163
- pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
164
-
165
- if (segment.length === 1) continue;
166
- pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
167
- pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
168
- pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
169
-
170
- if (segment.length === 4) continue;
171
- pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
172
- }
173
- }
174
-
175
- return out + td.decode(buf.subarray(0, pos));
176
- }
177
-
178
- function encodeInteger(
179
- buf: Uint8Array,
180
- pos: number,
181
- state: SourceMapSegment,
182
- segment: SourceMapSegment,
183
- j: number,
184
- ): number {
185
- const next = segment[j];
186
- let num = next - state[j];
187
- state[j] = next;
188
-
189
- num = num < 0 ? (-num << 1) | 1 : num << 1;
190
- do {
191
- let clamped = num & 0b011111;
192
- num >>>= 5;
193
- if (num > 0) clamped |= 0b100000;
194
- buf[pos++] = intToChar[clamped];
195
- } while (num > 0);
196
-
197
- return pos;
198
- }
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Microsoft Corporation.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE