tempo-sdk 0.0.99 → 0.0.102

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 (170) hide show
  1. package/README.md +3 -403
  2. package/dist/assets/editor.d.ts +43 -65
  3. package/dist/assets/editor.js +1 -573
  4. package/dist/assets/index.d.ts +11 -61
  5. package/dist/assets/index.js +1 -338
  6. package/dist/assets/parser.d.ts +68 -78
  7. package/dist/assets/parser.js +1 -33
  8. package/dist/astro/asset-preview-client.d.ts +3 -2
  9. package/dist/astro/asset-preview-client.js +1 -93
  10. package/dist/astro/controls.d.ts +1 -3
  11. package/dist/astro/controls.js +1 -7
  12. package/dist/astro/document-client.d.ts +5 -6
  13. package/dist/astro/document-client.js +1 -78
  14. package/dist/astro/runtime.d.ts +23 -11
  15. package/dist/astro/runtime.js +1 -86
  16. package/dist/astro.d.ts +19 -13
  17. package/dist/astro.js +1 -818
  18. package/dist/canvas/astro-contract.d.ts +0 -3
  19. package/dist/canvas/astro-contract.js +1 -9
  20. package/dist/canvas/astro.d.ts +3 -4
  21. package/dist/canvas/astro.js +1 -42
  22. package/dist/canvas/editor.d.ts +187 -183
  23. package/dist/canvas/editor.js +1 -1094
  24. package/dist/canvas/flutter-preview.d.ts +0 -1
  25. package/dist/canvas/flutter-preview.js +1 -9
  26. package/dist/canvas/index.d.ts +46 -100
  27. package/dist/canvas/index.js +1 -3926
  28. package/dist/canvas/interact-projection.d.ts +7 -5
  29. package/dist/canvas/interact-projection.js +1 -12
  30. package/dist/canvas/parser.d.ts +10 -303
  31. package/dist/canvas/parser.js +1 -30
  32. package/dist/canvas/svelte.d.ts +6 -7
  33. package/dist/canvas/svelte.js +1 -91
  34. package/dist/canvas/vue.d.ts +9 -49
  35. package/dist/canvas/vue.js +1 -264
  36. package/dist/chunk-CXCUJCXD.js +1 -0
  37. package/dist/chunk-FH6TMWFA.js +1 -0
  38. package/dist/chunk-FL7FSJSL.js +1 -0
  39. package/dist/chunk-GQIOB5SV.js +1 -0
  40. package/dist/chunk-HBQ7FFH7.js +1 -0
  41. package/dist/chunk-JRJOWLCN.js +1 -0
  42. package/dist/chunk-LJCBFTMP.js +1 -0
  43. package/dist/chunk-M3GN2KUH.js +1 -0
  44. package/dist/chunk-MPIHFFML.js +1 -0
  45. package/dist/chunk-T5TY3U2H.js +1 -0
  46. package/dist/chunk-XO2BSHWM.js +1 -0
  47. package/dist/chunk-XUSV3KOD.js +1 -0
  48. package/dist/chunk-ZXBMP6RV.js +1 -0
  49. package/dist/{controls-uCaQ3CNX.d.ts → controls-DKslABtM.d.ts} +0 -3
  50. package/dist/expo/plugin.cjs +1 -1928
  51. package/dist/expo/plugin.js +1 -8
  52. package/dist/expo-babel-plugin.cjs +1 -1928
  53. package/dist/expo-babel-plugin.d.cts +46 -40
  54. package/dist/expo-babel-plugin.d.ts +46 -40
  55. package/dist/expo-babel-plugin.js +1 -8
  56. package/dist/flutter-preview-path.d.ts +23 -7
  57. package/dist/flutter-preview-path.js +1 -16
  58. package/dist/index.d.ts +33 -45
  59. package/dist/index.js +1 -20
  60. package/dist/nextjs/plugin.cjs +1 -413
  61. package/dist/nextjs/plugin.js +1 -7
  62. package/dist/nextjs-loader.cjs +1 -2277
  63. package/dist/nextjs.cjs +1 -484
  64. package/dist/nextjs.d.cts +2 -58
  65. package/dist/nextjs.d.ts +2 -58
  66. package/dist/nextjs.js +1 -17
  67. package/dist/nuxt/runtime/identity.d.ts +2 -4
  68. package/dist/nuxt/runtime/identity.js +1 -18
  69. package/dist/nuxt.d.ts +31 -92
  70. package/dist/nuxt.js +1 -5854
  71. package/dist/{page-DwLnOM5d.d.ts → page-Bc8PekIX.d.ts} +1 -5
  72. package/dist/parser.d-MO5ciJ5n.d.ts +236 -0
  73. package/dist/{storyboard-CMJVBSXn.d.ts → storyboard.contract.d-UQ4MUYN5.d.ts} +3 -25
  74. package/dist/svelte.d.ts +8 -18
  75. package/dist/svelte.js +1 -917
  76. package/dist/types-CfUgM2w4.d.ts +57 -0
  77. package/dist/v1-client-compat-n0E0XxuX.d.ts +5 -0
  78. package/dist/vue.d.ts +17 -58
  79. package/dist/vue.js +1 -1501
  80. package/package.json +12 -62
  81. package/dist/assets/editor.js.map +0 -1
  82. package/dist/assets/index.js.map +0 -1
  83. package/dist/assets/parser.js.map +0 -1
  84. package/dist/astro/asset-preview-client.js.map +0 -1
  85. package/dist/astro/controls.js.map +0 -1
  86. package/dist/astro/document-client.js.map +0 -1
  87. package/dist/astro/runtime.js.map +0 -1
  88. package/dist/astro.js.map +0 -1
  89. package/dist/canvas/astro-contract.js.map +0 -1
  90. package/dist/canvas/astro.js.map +0 -1
  91. package/dist/canvas/editor.js.map +0 -1
  92. package/dist/canvas/flutter-preview.js.map +0 -1
  93. package/dist/canvas/index.js.map +0 -1
  94. package/dist/canvas/interact-projection.js.map +0 -1
  95. package/dist/canvas/parser.js.map +0 -1
  96. package/dist/canvas/svelte.js.map +0 -1
  97. package/dist/canvas/vue.js.map +0 -1
  98. package/dist/chunk-27WT3XUG.js +0 -455
  99. package/dist/chunk-27WT3XUG.js.map +0 -1
  100. package/dist/chunk-5HIIF354.js +0 -67
  101. package/dist/chunk-5HIIF354.js.map +0 -1
  102. package/dist/chunk-65B52AR7.js +0 -11
  103. package/dist/chunk-65B52AR7.js.map +0 -1
  104. package/dist/chunk-6HYKKP5N.js +0 -2658
  105. package/dist/chunk-6HYKKP5N.js.map +0 -1
  106. package/dist/chunk-6SOP4XU6.js +0 -1891
  107. package/dist/chunk-6SOP4XU6.js.map +0 -1
  108. package/dist/chunk-AFXE462X.js +0 -1253
  109. package/dist/chunk-AFXE462X.js.map +0 -1
  110. package/dist/chunk-BQPKOVI5.js +0 -115
  111. package/dist/chunk-BQPKOVI5.js.map +0 -1
  112. package/dist/chunk-CYDF4LYJ.js +0 -342
  113. package/dist/chunk-CYDF4LYJ.js.map +0 -1
  114. package/dist/chunk-CYQE3TLC.js +0 -37
  115. package/dist/chunk-CYQE3TLC.js.map +0 -1
  116. package/dist/chunk-DI2ZFAWL.js +0 -14
  117. package/dist/chunk-DI2ZFAWL.js.map +0 -1
  118. package/dist/chunk-EGRHWZRV.js +0 -1
  119. package/dist/chunk-EGRHWZRV.js.map +0 -1
  120. package/dist/chunk-FGWGY3G3.js +0 -157
  121. package/dist/chunk-FGWGY3G3.js.map +0 -1
  122. package/dist/chunk-HOBTDB6G.js +0 -112
  123. package/dist/chunk-HOBTDB6G.js.map +0 -1
  124. package/dist/chunk-I7VF4ZOV.js +0 -630
  125. package/dist/chunk-I7VF4ZOV.js.map +0 -1
  126. package/dist/chunk-JVVHU3A7.js +0 -1077
  127. package/dist/chunk-JVVHU3A7.js.map +0 -1
  128. package/dist/chunk-MIXQVPDH.js +0 -8606
  129. package/dist/chunk-MIXQVPDH.js.map +0 -1
  130. package/dist/chunk-MU7S7NU7.js +0 -183
  131. package/dist/chunk-MU7S7NU7.js.map +0 -1
  132. package/dist/chunk-OX2YKYSL.js +0 -13
  133. package/dist/chunk-OX2YKYSL.js.map +0 -1
  134. package/dist/chunk-PYAJHLXO.js +0 -903
  135. package/dist/chunk-PYAJHLXO.js.map +0 -1
  136. package/dist/chunk-SGN7BDRE.js +0 -16
  137. package/dist/chunk-SGN7BDRE.js.map +0 -1
  138. package/dist/chunk-SGTGDLOX.js +0 -285
  139. package/dist/chunk-SGTGDLOX.js.map +0 -1
  140. package/dist/chunk-T364NBR3.js +0 -1440
  141. package/dist/chunk-T364NBR3.js.map +0 -1
  142. package/dist/chunk-U66QI3EN.js +0 -1524
  143. package/dist/chunk-U66QI3EN.js.map +0 -1
  144. package/dist/chunk-WTXOWQ7N.js +0 -47
  145. package/dist/chunk-WTXOWQ7N.js.map +0 -1
  146. package/dist/chunk-X5DJKVBT.js +0 -1308
  147. package/dist/chunk-X5DJKVBT.js.map +0 -1
  148. package/dist/chunk-ZT7HJ6YU.js +0 -38
  149. package/dist/chunk-ZT7HJ6YU.js.map +0 -1
  150. package/dist/chunk-ZW26VZHX.js +0 -3169
  151. package/dist/chunk-ZW26VZHX.js.map +0 -1
  152. package/dist/controls-reader-5MFHYBZZ.js +0 -192
  153. package/dist/controls-reader-5MFHYBZZ.js.map +0 -1
  154. package/dist/expo/plugin.cjs.map +0 -1
  155. package/dist/expo/plugin.js.map +0 -1
  156. package/dist/expo-babel-plugin.cjs.map +0 -1
  157. package/dist/expo-babel-plugin.js.map +0 -1
  158. package/dist/flutter-preview-path.js.map +0 -1
  159. package/dist/index.js.map +0 -1
  160. package/dist/nextjs/plugin.cjs.map +0 -1
  161. package/dist/nextjs/plugin.js.map +0 -1
  162. package/dist/nextjs-loader.cjs.map +0 -1
  163. package/dist/nextjs.cjs.map +0 -1
  164. package/dist/nextjs.js.map +0 -1
  165. package/dist/nuxt/runtime/identity.js.map +0 -1
  166. package/dist/nuxt.js.map +0 -1
  167. package/dist/svelte.js.map +0 -1
  168. package/dist/types-C8OIU-kc.d.ts +0 -106
  169. package/dist/v1-client-compat-qxaXEDm_.d.ts +0 -23
  170. package/dist/vue.js.map +0 -1
@@ -1,414 +1,2 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // nextjs/plugin.ts
21
- var plugin_exports = {};
22
- __export(plugin_exports, {
23
- default: () => tempoNextjsPlugin
24
- });
25
- module.exports = __toCommonJS(plugin_exports);
26
-
27
- // nextjs.ts
28
- var import_node_fs2 = require("fs");
29
- var import_node_module = require("module");
30
- var import_node_path2 = require("path");
31
-
32
- // host-identity.ts
33
- var import_node_fs = require("fs");
34
- var import_node_path = require("path");
35
-
36
- // package.json
37
- var package_default = {
38
- name: "tempo-sdk",
39
- version: "0.0.99",
40
- publishConfig: {
41
- tag: "sdk-v2-latest"
42
- },
43
- type: "module",
44
- description: "Tempo SDK \u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types",
45
- repository: {
46
- type: "git",
47
- url: "git+https://github.com/TempoLabsAI/tempo-monorepo.git",
48
- directory: "tempo-modules/tempo-sdk"
49
- },
50
- exports: {
51
- "./astro/controls": {
52
- types: "./dist/astro/controls.d.ts",
53
- import: "./dist/astro/controls.js",
54
- default: "./dist/astro/controls.js"
55
- },
56
- "./astro": {
57
- types: "./dist/astro.d.ts",
58
- import: "./dist/astro.js"
59
- },
60
- "./astro/client": {
61
- types: "./astro/client.d.ts"
62
- },
63
- "./canvas/astro": {
64
- types: "./dist/canvas/astro.d.ts",
65
- import: "./dist/canvas/astro.js"
66
- },
67
- "./canvas/astro-contract": {
68
- types: "./dist/canvas/astro-contract.d.ts",
69
- import: "./dist/canvas/astro-contract.js"
70
- },
71
- ".": {
72
- types: "./dist/index.d.ts",
73
- import: "./dist/index.js"
74
- },
75
- "./canvas": {
76
- types: "./dist/canvas/index.d.ts",
77
- import: "./dist/canvas/index.js"
78
- },
79
- "./canvas/svelte": {
80
- types: "./dist/canvas/svelte.d.ts",
81
- import: "./dist/canvas/svelte.js"
82
- },
83
- "./canvas/vue": {
84
- types: "./dist/canvas/vue.d.ts",
85
- import: "./dist/canvas/vue.js"
86
- },
87
- "./canvas/interact-projection": {
88
- types: "./dist/canvas/interact-projection.d.ts",
89
- import: "./dist/canvas/interact-projection.js"
90
- },
91
- "./canvas/parser": {
92
- types: "./dist/canvas/parser.d.ts",
93
- import: "./dist/canvas/parser.js"
94
- },
95
- "./canvas/editor": {
96
- types: "./dist/canvas/editor.d.ts",
97
- import: "./dist/canvas/editor.js"
98
- },
99
- "./assets": {
100
- types: "./dist/assets/index.d.ts",
101
- import: "./dist/assets/index.js"
102
- },
103
- "./assets/parser": {
104
- types: "./dist/assets/parser.d.ts",
105
- import: "./dist/assets/parser.js"
106
- },
107
- "./assets/editor": {
108
- types: "./dist/assets/editor.d.ts",
109
- import: "./dist/assets/editor.js"
110
- },
111
- "./nextjs": {
112
- types: "./dist/nextjs.d.ts",
113
- import: "./dist/nextjs.js",
114
- require: "./dist/nextjs.cjs"
115
- },
116
- "./nextjs/plugin": {
117
- types: "./dist/nextjs/plugin.d.ts",
118
- import: "./dist/nextjs/plugin.js"
119
- },
120
- "./nuxt": {
121
- types: "./dist/nuxt.d.ts",
122
- import: "./dist/nuxt.js"
123
- },
124
- "./expo": {
125
- types: "./dist/expo-babel-plugin.d.ts",
126
- import: "./dist/expo-babel-plugin.js",
127
- require: "./dist/expo-babel-plugin.cjs"
128
- },
129
- "./expo/plugin": {
130
- types: "./dist/expo/plugin.d.ts",
131
- import: "./dist/expo/plugin.js",
132
- require: "./dist/expo/plugin.cjs"
133
- },
134
- "./svelte": {
135
- types: "./dist/svelte.d.ts",
136
- import: "./dist/svelte.js"
137
- },
138
- "./vue": {
139
- types: "./dist/vue.d.ts",
140
- import: "./dist/vue.js"
141
- },
142
- "./astro/asset-preview-client": {
143
- types: "./dist/astro/asset-preview-client.d.ts",
144
- import: "./dist/astro/asset-preview-client.js"
145
- },
146
- "./flutter-preview-path": {
147
- types: "./dist/flutter-preview-path.d.ts",
148
- import: "./dist/flutter-preview-path.js"
149
- },
150
- "./canvas/flutter-preview": {
151
- types: "./dist/canvas/flutter-preview.d.ts",
152
- import: "./dist/canvas/flutter-preview.js"
153
- }
154
- },
155
- files: [
156
- "dist",
157
- "astro/client.d.ts"
158
- ],
159
- scripts: {
160
- clean: "rm -rf dist",
161
- build: "pnpm run clean && tsup",
162
- "build:if-missing": "test -f dist/index.js || pnpm run build",
163
- prepare: "pnpm run build",
164
- prepublishOnly: "pnpm build",
165
- demo: "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
166
- "demo:nextjs": "TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev",
167
- "demo:nuxt": "pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev",
168
- test: "vitest run",
169
- "test:browser": "vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts",
170
- "test:watch": "vitest",
171
- "test:nextjs:unit": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts",
172
- "test:nextjs:integration": "vitest run nextjs-e2e-correctness.test.ts",
173
- "test:nextjs:production": "vitest run nextjs-production.test.ts",
174
- "test:nextjs": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts"
175
- },
176
- dependencies: {
177
- "@rollup/pluginutils": "^5.1.0",
178
- "oxc-parser": "^0.110.0"
179
- },
180
- optionalDependencies: {
181
- "@astrojs/compiler-rs": "0.5.1"
182
- },
183
- peerDependencies: {
184
- astro: "^7.0.0",
185
- "@babel/core": "^7.0.0",
186
- h3: "^1.12.0",
187
- next: "^13 || ^14 || ^15 || ^16",
188
- nuxt: "^3.18.0 || ^4.0.0",
189
- react: "^18 || ^19",
190
- svelte: "^5.0.0",
191
- vite: "^5 || ^6 || ^7 || ^8",
192
- vue: "^3.3.0"
193
- },
194
- peerDependenciesMeta: {
195
- astro: {
196
- optional: true
197
- },
198
- react: {
199
- optional: true
200
- },
201
- "@babel/core": {
202
- optional: true
203
- },
204
- h3: {
205
- optional: true
206
- },
207
- next: {
208
- optional: true
209
- },
210
- nuxt: {
211
- optional: true
212
- },
213
- svelte: {
214
- optional: true
215
- },
216
- vite: {
217
- optional: true
218
- },
219
- vue: {
220
- optional: true
221
- }
222
- },
223
- devDependencies: {
224
- "@astrojs/react": "7.0.1",
225
- "@babel/core": "^7.29.0",
226
- "@babel/types": "^7.29.0",
227
- "@modules/annotation": "workspace:*",
228
- "@modules/astro-editor": "workspace:*",
229
- "@modules/file-parser": "workspace:*",
230
- "@modules/frame-pool": "workspace:*",
231
- "@modules/iframe-projection": "workspace:*",
232
- "@modules/svelte-editor": "workspace:*",
233
- "@modules/vue-editor": "workspace:*",
234
- "@nuxt/kit": "^4.6.2",
235
- "@types/babel__core": "^7.20.5",
236
- "@types/node": "^25.0.8",
237
- "@types/react": "catalog:",
238
- "@types/react-dom": "catalog:",
239
- "@vitejs/plugin-react": "catalog:",
240
- "@vitejs/plugin-vue": "6.0.10",
241
- astro: "7.3.8",
242
- h3: "^1.15.11",
243
- "magic-string": "^0.30.21",
244
- nuxt: "^4.6.2",
245
- playwright: "^1.58.2",
246
- "react-dom": "catalog:",
247
- "react-dom18": "npm:react-dom@18.3.1",
248
- react18: "npm:react@18.3.1",
249
- svelte: "5.56.9",
250
- tsup: "^8.5.1",
251
- typescript: "catalog:",
252
- vite: "catalog:",
253
- vitest: "catalog:",
254
- vue: "3.5.44"
255
- }
256
- };
257
-
258
- // release-channel.ts
259
- var TEMPO_SDK_CHANNEL = package_default.publishConfig.tag;
260
- function sdkChannelGeneration(channel) {
261
- if (typeof channel !== "string") return null;
262
- const match = /^sdk-v([1-9]\d*)-latest$/.exec(channel);
263
- return match ? Number(match[1]) : null;
264
- }
265
- if (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {
266
- throw new Error("tempo-sdk publishConfig.tag must be sdk-v<N>-latest");
267
- }
268
-
269
- // nextjs.ts
270
- var import_meta = {};
271
- var TURBOPACK_RULE_KEY = "*.{tsx,jsx}";
272
- var requireFromHere = (0, import_node_module.createRequire)(
273
- typeof import_meta.url === "string" && import_meta.url.length > 0 ? import_meta.url : __filename
274
- );
275
- function resolveLoaderPath() {
276
- for (const candidate of ["./nextjs-loader.cjs", "./dist/nextjs-loader.cjs"]) {
277
- try {
278
- return requireFromHere.resolve(candidate);
279
- } catch {
280
- }
281
- }
282
- throw new Error(
283
- "tempo-sdk/nextjs: could not resolve nextjs-loader.cjs. Run `pnpm build` in the tempo-sdk package to produce the dist/ output."
284
- );
285
- }
286
- function detectNextVersion() {
287
- try {
288
- const pkg = requireFromHere("next/package.json");
289
- const m = /^(\d+)\.(\d+)/.exec(pkg.version);
290
- if (!m) return null;
291
- return { major: Number(m[1]), minor: Number(m[2]) };
292
- } catch {
293
- return null;
294
- }
295
- }
296
- function useExperimentalTurbo(version) {
297
- if (!version) return false;
298
- if (version.major < 15) return true;
299
- if (version.major === 15 && version.minor < 3) return true;
300
- return false;
301
- }
302
- function shouldOmitTurbopack(version) {
303
- if (!version) return false;
304
- return version.major < 13;
305
- }
306
- function buildTurbopackRule(loaderPath, options) {
307
- const loaderOptions = {};
308
- if (options.computeAnnotatedPropsModule !== void 0) {
309
- loaderOptions.computeAnnotatedPropsModule = options.computeAnnotatedPropsModule;
310
- }
311
- if (options.autoInjectRootMeta !== void 0) {
312
- loaderOptions.autoInjectRootMeta = options.autoInjectRootMeta;
313
- }
314
- const condition = options.productionBuild ? { not: "foreign" } : { all: [{ not: "foreign" }, "development"] };
315
- return {
316
- condition,
317
- loaders: [{ loader: loaderPath, options: loaderOptions }]
318
- };
319
- }
320
- function mergeTurbopackRules(existing, newRule) {
321
- const existingRule = existing?.rules?.[TURBOPACK_RULE_KEY];
322
- let mergedRule;
323
- if (!existingRule) {
324
- mergedRule = newRule;
325
- } else if (Array.isArray(existingRule)) {
326
- mergedRule = [...existingRule, newRule];
327
- } else {
328
- mergedRule = [existingRule, newRule];
329
- }
330
- return {
331
- ...existing,
332
- rules: {
333
- ...existing?.rules,
334
- [TURBOPACK_RULE_KEY]: mergedRule
335
- }
336
- };
337
- }
338
- function buildWebpackHook(loaderPath, options, userWebpack) {
339
- const loaderOptions = {};
340
- if (options.computeAnnotatedPropsModule !== void 0) {
341
- loaderOptions.computeAnnotatedPropsModule = options.computeAnnotatedPropsModule;
342
- }
343
- if (options.autoInjectRootMeta !== void 0) {
344
- loaderOptions.autoInjectRootMeta = options.autoInjectRootMeta;
345
- }
346
- const allowProduction = options.productionBuild === true;
347
- return (configIn, context) => {
348
- var _a;
349
- const config = configIn;
350
- const ctx = context;
351
- if (ctx.dev || allowProduction) {
352
- config.module ?? (config.module = {});
353
- (_a = config.module).rules ?? (_a.rules = []);
354
- config.module.rules.push({
355
- test: /\.(tsx|jsx)$/,
356
- exclude: /node_modules/,
357
- enforce: "pre",
358
- use: [{ loader: loaderPath, options: loaderOptions }]
359
- });
360
- }
361
- if (typeof userWebpack === "function") {
362
- return userWebpack(config, context);
363
- }
364
- return config;
365
- };
366
- }
367
- function tempoNextjsPlugin(pluginOptions = {}) {
368
- return (inputConfigArg) => {
369
- const inputConfig = inputConfigArg ?? {};
370
- if (!process.env.TEMPO) return inputConfig;
371
- const loaderPath = _internal.resolveLoaderPath();
372
- const version = _internal.detectNextVersion();
373
- const omitTurbopack = _internal.shouldOmitTurbopack(version);
374
- const useExperimental = _internal.useExperimentalTurbo(version);
375
- const newRule = buildTurbopackRule(loaderPath, pluginOptions);
376
- const existingTurbo = useExperimental ? inputConfig.experimental?.turbo : inputConfig.turbopack;
377
- const mergedTurbo = mergeTurbopackRules(existingTurbo, newRule);
378
- const webpackHook = buildWebpackHook(
379
- loaderPath,
380
- pluginOptions,
381
- inputConfig.webpack ?? null
382
- );
383
- const next = {
384
- ...inputConfig,
385
- webpack: webpackHook
386
- };
387
- const distDirOverride = process.env.TEMPO_NEXT_DIST_DIR;
388
- if (distDirOverride) {
389
- next.distDir = distDirOverride;
390
- }
391
- if (!omitTurbopack) {
392
- if (useExperimental) {
393
- next.experimental = {
394
- ...inputConfig.experimental,
395
- turbo: mergedTurbo
396
- };
397
- } else {
398
- next.turbopack = mergedTurbo;
399
- }
400
- }
401
- return next;
402
- };
403
- }
404
- var _internal = {
405
- buildTurbopackRule,
406
- mergeTurbopackRules,
407
- buildWebpackHook,
408
- detectNextVersion,
409
- useExperimentalTurbo,
410
- shouldOmitTurbopack,
411
- resolveLoaderPath
412
- };
1
+ "use strict";var k=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var s=(e,t)=>k(e,"name",{value:t,configurable:!0});var D=(e,t)=>{for(var n in t)k(e,n,{get:t[n],enumerable:!0})},F=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of L(t))!V.call(e,r)&&r!==n&&k(e,r,{get:()=>t[r],enumerable:!(o=$(t,r))||o.enumerable});return e};var W=e=>F(k({},"__esModule",{value:!0}),e);var Z={};D(Z,{default:()=>H});module.exports=W(Z);var T=require("crypto"),l=require("fs"),h=require("module"),i=require("path"),b=require("url");var K=require("fs"),U=require("path");var C={};var E=1,R="TEMPO_SDK_RUNTIME_PATH",B=typeof C.url=="string"?C.url:(0,b.pathToFileURL)(__filename).href,st=(0,h.createRequire)(B);var j=new Map;function p(e){return new Error(`Tempo SDK runtime unavailable: ${e}. Start this project with an updated Tempo host, or provision its matching runtime and set ${R}.`)}s(p,"runtimeError");function J(){let e=process.env[R];if(!e||!(0,i.isAbsolute)(e))throw p("an absolute runtime directory was not supplied");let t=(0,i.resolve)(e),n;try{n=JSON.parse((0,l.readFileSync)((0,i.resolve)(t,"runtime.json"),"utf8"))}catch{throw p("runtime.json could not be read")}if(n?.tempoRuntimeContract!==E)throw p(`contract ${n?.tempoRuntimeContract} does not match ${E}`);return{root:t,manifest:n}}s(J,"readRuntimeManifest");function _(e,t,n){if(!n||typeof n.file!="string"||!/^[a-f0-9]{64}$/.test(n.sha256))throw p(`the ${t} entry is missing or invalid`);let o=(0,i.resolve)(e,n.file),r=(0,i.relative)(e,o);if((0,i.isAbsolute)(r)||r===".."||r.startsWith(`..${i.sep}`))throw p(`the ${t} entry escapes its runtime directory`);let u;try{let a=(0,i.relative)((0,l.realpathSync)(e),(0,l.realpathSync)(o));if((0,i.isAbsolute)(a)||a===".."||a.startsWith(`..${i.sep}`))throw p(`the ${t} entry escapes its runtime directory`);u=(0,l.readFileSync)(o)}catch{throw p(`the ${t} artifact could not be read`)}if((0,T.createHash)("sha256").update(u).digest("hex")!==n.sha256)throw p(`the ${t} artifact failed its integrity check`);return o}s(_,"verifyArtifact");function y(e){let t=process.env[R];if(!t||!(0,i.isAbsolute)(t))throw p("an absolute runtime directory was not supplied");let n=(0,i.resolve)(t),o=`${n}\0${e}`,r=j.get(o);if(r)return r;let{manifest:u}=J(),a=u.node?.[e],c=_(n,e,a),d=u.browser,m=d&&_(n,"browser",d),f={sha256:d?(0,T.createHash)("sha256").update(a.sha256).update(d.sha256).digest("hex"):a.sha256,dependencies:[(0,i.resolve)(n,"runtime.json"),c,...m?[m]:[]]};return j.set(o,f),f}s(y,"nodeRuntimeIdentity");var P=require("fs"),I=require("module"),O=require("path");var w={};var Y=["*.{tsx,jsx}","*.{js,mjs}"],A=(0,I.createRequire)(typeof w.url=="string"&&w.url.length>0?w.url:__filename);function G(){for(let e of["./nextjs-loader.cjs","./dist/nextjs-loader.cjs"])try{return A.resolve(e)}catch{}throw new Error("tempo-sdk/nextjs: could not resolve nextjs-loader.cjs. Run `pnpm build` in the tempo-sdk package to produce the dist/ output.")}s(G,"resolveLoaderPath");function X(){try{let e=A("next/package.json"),t=/^(\d+)\.(\d+)/.exec(e.version);return t?{major:Number(t[1]),minor:Number(t[2])}:null}catch{return null}}s(X,"detectNextVersion");function z(e){return e?e.major<15||e.major===15&&e.minor<3:!1}s(z,"useExperimentalTurbo");function Q(e){return e?e.major<13:!1}s(Q,"shouldOmitTurbopack");function M(e,t){let n={tempoRuntimeHash:y("nextjs-loader").sha256};return t.computeAnnotatedPropsModule!==void 0&&(n.computeAnnotatedPropsModule=t.computeAnnotatedPropsModule),t.autoInjectRootMeta!==void 0&&(n.autoInjectRootMeta=t.autoInjectRootMeta),{condition:t.productionBuild?{not:"foreign"}:{all:[{not:"foreign"},"development"]},loaders:[{loader:e,options:n}]}}s(M,"buildTurbopackRule");function v(e,t){let n={...e?.rules};for(let o of Y){let r=n[o];r?Array.isArray(r)?n[o]=[...r,t]:n[o]=[r,t]:n[o]=t}return{...e,rules:n}}s(v,"mergeTurbopackRules");function S(e,t,n){let o={tempoRuntimeHash:y("nextjs-loader").sha256};t.computeAnnotatedPropsModule!==void 0&&(o.computeAnnotatedPropsModule=t.computeAnnotatedPropsModule),t.autoInjectRootMeta!==void 0&&(o.autoInjectRootMeta=t.autoInjectRootMeta);let r=t.productionBuild===!0;return(u,a)=>{var m;let c=u;return(a.dev||r)&&(c.module??(c.module={}),(m=c.module).rules??(m.rules=[]),c.module.rules.push({test:/\.(tsx|jsx|m?js)$/,exclude:/node_modules/,enforce:"pre",use:[{loader:e,options:o}]})),typeof n=="function"?n(c,a):c}}s(S,"buildWebpackHook");function H(e={}){return t=>{let n=t??{};if(!process.env.TEMPO)return n;let o=x.resolveLoaderPath(),r=x.detectNextVersion(),u=x.shouldOmitTurbopack(r),a=x.useExperimentalTurbo(r),c=M(o,e),d=a?n.experimental?.turbo:n.turbopack,m=v(d,c),f=S(o,e,n.webpack??null),g={...n,webpack:f},N=process.env.TEMPO_NEXT_DIST_DIR;return N&&(g.distDir=N),u||(a?g.experimental={...n.experimental,turbo:m}:g.turbopack=m),g}}s(H,"tempoNextjsPlugin");var x={buildTurbopackRule:M,mergeTurbopackRules:v,buildWebpackHook:S,detectNextVersion:X,useExperimentalTurbo:z,shouldOmitTurbopack:Q,resolveLoaderPath:G};
413
2
  module.exports = Object.assign(module.exports.default, module.exports);
414
- //# sourceMappingURL=plugin.cjs.map
@@ -1,7 +1 @@
1
- import {
2
- tempoNextjsPlugin
3
- } from "../chunk-27WT3XUG.js";
4
- export {
5
- tempoNextjsPlugin as default
6
- };
7
- //# sourceMappingURL=plugin.js.map
1
+ import{d as e}from"../chunk-FL7FSJSL.js";export{e as default};