React package bundling changed
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@trigger.dev/react": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Build fix for "use client" errors
|
||||||
@@ -2,21 +2,15 @@
|
|||||||
"name": "@trigger.dev/react",
|
"name": "@trigger.dev/react",
|
||||||
"version": "1.0.0-next.2",
|
"version": "1.0.0-next.2",
|
||||||
"description": "Trigger.dev React SDK",
|
"description": "Trigger.dev React SDK",
|
||||||
"main": "./dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "./dist/index.d.ts",
|
"module": "dist/index.mjs",
|
||||||
|
"types": "dist/index.d.ts",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"import": "./dist/index.js",
|
|
||||||
"require": "./dist/index.js"
|
|
||||||
},
|
|
||||||
"./package.json": "./package.json"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@trigger.dev/internal": "workspace:*",
|
"@trigger.dev/internal": "workspace:*",
|
||||||
"@trigger.dev/tsconfig": "workspace:*",
|
"@trigger.dev/tsconfig": "workspace:*",
|
||||||
@@ -25,23 +19,20 @@
|
|||||||
"@types/ws": "^8.5.3",
|
"@types/ws": "^8.5.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"tsup": "^6.5.0",
|
"tsup": "^7.1.0",
|
||||||
"tsx": "^3.12.1"
|
"tsx": "^3.12.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
"build": "npm run clean && npm run build:tsup",
|
"build": "npm run clean && npm run build:tsup",
|
||||||
"build:tsup": "tsup"
|
"build:tsup": "tsup src/index.ts"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0 || ^18"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tanstack/react-query": "5.0.0-beta.2",
|
"@tanstack/react-query": "5.0.0-beta.2",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"zod": "3.21.4"
|
"zod": "3.21.4"
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=16.8.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import React from "react";
|
||||||
import { QueryClient } from "@tanstack/react-query";
|
import { QueryClient } from "@tanstack/react-query";
|
||||||
import { createContext, useContext, useState } from "react";
|
import { createContext, useContext, useState } from "react";
|
||||||
|
|
||||||
@@ -18,7 +19,11 @@ const ProviderContext = createContext<ProviderContextValue>(
|
|||||||
|
|
||||||
export function useTriggerProvider() {
|
export function useTriggerProvider() {
|
||||||
const value = useContext(ProviderContext);
|
const value = useContext(ProviderContext);
|
||||||
verifyApiKey(value.publicApiKey);
|
if (!value) {
|
||||||
|
console.error(
|
||||||
|
"You must have a TriggerProvider above where you're using Trigger.dev hooks in your React tree."
|
||||||
|
);
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +44,12 @@ export function TriggerProvider({
|
|||||||
}: TriggerProviderProps) {
|
}: TriggerProviderProps) {
|
||||||
const [queryClient] = useState(() => new QueryClient());
|
const [queryClient] = useState(() => new QueryClient());
|
||||||
|
|
||||||
|
if (!publicApiKey) {
|
||||||
|
throw new Error(
|
||||||
|
"TriggerProvider requires `publicApiKey` to be set with a value."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
verifyApiKey(publicApiKey);
|
verifyApiKey(publicApiKey);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
{
|
{
|
||||||
"extends": "@trigger.dev/tsconfig/node18.json",
|
|
||||||
"include": ["./src/**/*.ts", "./src/**/*.tsx", "tsup.config.ts"],
|
"include": ["./src/**/*.ts", "./src/**/*.tsx", "tsup.config.ts"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"experimentalDecorators": true,
|
"jsx": "react",
|
||||||
"emitDecoratorMetadata": true,
|
"moduleResolution": "node",
|
||||||
"declaration": false,
|
"esModuleInterop": true,
|
||||||
"declarationMap": false,
|
"lib": ["es2015", "dom"],
|
||||||
"jsx": "react-jsx",
|
|
||||||
"lib": ["DOM", "DOM.Iterable"],
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"@trigger.dev/internal": ["../internal/src/index"],
|
"@trigger.dev/internal": ["../internal/src/index"],
|
||||||
"@trigger.dev/internal/*": ["../internal/src/*"]
|
"@trigger.dev/internal/*": ["../internal/src/*"]
|
||||||
|
|||||||
@@ -2,19 +2,16 @@ import { defineConfig } from "tsup";
|
|||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
{
|
{
|
||||||
name: "main",
|
target: "es2018",
|
||||||
entry: ["./src/index.ts"],
|
external: ["react"],
|
||||||
outDir: "./dist",
|
|
||||||
platform: "node",
|
|
||||||
format: ["cjs"],
|
|
||||||
legacyOutput: true,
|
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
clean: true,
|
|
||||||
bundle: true,
|
|
||||||
splitting: false,
|
|
||||||
dts: true,
|
dts: true,
|
||||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
format: ["esm", "cjs"],
|
||||||
noExternal: ["@trigger.dev/internal"],
|
esbuildOptions(options) {
|
||||||
esbuildPlugins: [],
|
options.banner = {
|
||||||
|
js: '"use client";\n',
|
||||||
|
};
|
||||||
|
options.jsx = "automatic";
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
Generated
+37
-2
@@ -801,7 +801,7 @@ importers:
|
|||||||
debug: ^4.3.4
|
debug: ^4.3.4
|
||||||
react: ^18.2.0
|
react: ^18.2.0
|
||||||
rimraf: ^3.0.2
|
rimraf: ^3.0.2
|
||||||
tsup: ^6.5.0
|
tsup: ^7.1.0
|
||||||
tsx: ^3.12.1
|
tsx: ^3.12.1
|
||||||
zod: 3.21.4
|
zod: 3.21.4
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -816,7 +816,7 @@ importers:
|
|||||||
'@types/ws': 8.5.4
|
'@types/ws': 8.5.4
|
||||||
react: 18.2.0
|
react: 18.2.0
|
||||||
rimraf: 3.0.2
|
rimraf: 3.0.2
|
||||||
tsup: 6.6.3
|
tsup: 7.1.0
|
||||||
tsx: 3.12.2
|
tsx: 3.12.2
|
||||||
|
|
||||||
packages/trigger-sdk:
|
packages/trigger-sdk:
|
||||||
@@ -23360,6 +23360,41 @@ packages:
|
|||||||
- ts-node
|
- ts-node
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/tsup/7.1.0:
|
||||||
|
resolution: {integrity: sha512-mazl/GRAk70j8S43/AbSYXGgvRP54oQeX8Un4iZxzATHt0roW0t6HYDVZIXMw0ZQIpvr1nFMniIVnN5186lW7w==}
|
||||||
|
engines: {node: '>=16.14'}
|
||||||
|
hasBin: true
|
||||||
|
peerDependencies:
|
||||||
|
'@swc/core': ^1
|
||||||
|
postcss: ^8.4.12
|
||||||
|
typescript: '>=4.1.0'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@swc/core':
|
||||||
|
optional: true
|
||||||
|
postcss:
|
||||||
|
optional: true
|
||||||
|
typescript:
|
||||||
|
optional: true
|
||||||
|
dependencies:
|
||||||
|
bundle-require: 4.0.1_esbuild@0.18.11
|
||||||
|
cac: 6.7.14
|
||||||
|
chokidar: 3.5.3
|
||||||
|
debug: 4.3.4
|
||||||
|
esbuild: 0.18.11
|
||||||
|
execa: 5.1.1
|
||||||
|
globby: 11.1.0
|
||||||
|
joycon: 3.1.1
|
||||||
|
postcss-load-config: 4.0.1
|
||||||
|
resolve-from: 5.0.0
|
||||||
|
rollup: 3.10.0
|
||||||
|
source-map: 0.8.0-beta.0
|
||||||
|
sucrase: 3.32.0
|
||||||
|
tree-kill: 1.2.2
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
- ts-node
|
||||||
|
dev: true
|
||||||
|
|
||||||
/tsup/7.1.0_typescript@4.9.4:
|
/tsup/7.1.0_typescript@4.9.4:
|
||||||
resolution: {integrity: sha512-mazl/GRAk70j8S43/AbSYXGgvRP54oQeX8Un4iZxzATHt0roW0t6HYDVZIXMw0ZQIpvr1nFMniIVnN5186lW7w==}
|
resolution: {integrity: sha512-mazl/GRAk70j8S43/AbSYXGgvRP54oQeX8Un4iZxzATHt0roW0t6HYDVZIXMw0ZQIpvr1nFMniIVnN5186lW7w==}
|
||||||
engines: {node: '>=16.14'}
|
engines: {node: '>=16.14'}
|
||||||
|
|||||||
Reference in New Issue
Block a user