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",
|
||||
"version": "1.0.0-next.2",
|
||||
"description": "Trigger.dev React SDK",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@trigger.dev/internal": "workspace:*",
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
@@ -25,23 +19,20 @@
|
||||
"@types/ws": "^8.5.3",
|
||||
"react": "^18.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "^6.5.0",
|
||||
"tsup": "^7.1.0",
|
||||
"tsx": "^3.12.1"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"build": "npm run clean && npm run build:tsup",
|
||||
"build:tsup": "tsup"
|
||||
"build:tsup": "tsup src/index.ts"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/react-query": "5.0.0-beta.2",
|
||||
"debug": "^4.3.4",
|
||||
"zod": "3.21.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { QueryClient } from "@tanstack/react-query";
|
||||
import { createContext, useContext, useState } from "react";
|
||||
|
||||
@@ -18,7 +19,11 @@ const ProviderContext = createContext<ProviderContextValue>(
|
||||
|
||||
export function useTriggerProvider() {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -39,6 +44,12 @@ export function TriggerProvider({
|
||||
}: TriggerProviderProps) {
|
||||
const [queryClient] = useState(() => new QueryClient());
|
||||
|
||||
if (!publicApiKey) {
|
||||
throw new Error(
|
||||
"TriggerProvider requires `publicApiKey` to be set with a value."
|
||||
);
|
||||
}
|
||||
|
||||
verifyApiKey(publicApiKey);
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
{
|
||||
"extends": "@trigger.dev/tsconfig/node18.json",
|
||||
"include": ["./src/**/*.ts", "./src/**/*.tsx", "tsup.config.ts"],
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"jsx": "react-jsx",
|
||||
"lib": ["DOM", "DOM.Iterable"],
|
||||
"jsx": "react",
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"paths": {
|
||||
"@trigger.dev/internal": ["../internal/src/index"],
|
||||
"@trigger.dev/internal/*": ["../internal/src/*"]
|
||||
|
||||
@@ -2,19 +2,16 @@ import { defineConfig } from "tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
target: "es2018",
|
||||
external: ["react"],
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
noExternal: ["@trigger.dev/internal"],
|
||||
esbuildPlugins: [],
|
||||
format: ["esm", "cjs"],
|
||||
esbuildOptions(options) {
|
||||
options.banner = {
|
||||
js: '"use client";\n',
|
||||
};
|
||||
options.jsx = "automatic";
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
Generated
+37
-2
@@ -801,7 +801,7 @@ importers:
|
||||
debug: ^4.3.4
|
||||
react: ^18.2.0
|
||||
rimraf: ^3.0.2
|
||||
tsup: ^6.5.0
|
||||
tsup: ^7.1.0
|
||||
tsx: ^3.12.1
|
||||
zod: 3.21.4
|
||||
dependencies:
|
||||
@@ -816,7 +816,7 @@ importers:
|
||||
'@types/ws': 8.5.4
|
||||
react: 18.2.0
|
||||
rimraf: 3.0.2
|
||||
tsup: 6.6.3
|
||||
tsup: 7.1.0
|
||||
tsx: 3.12.2
|
||||
|
||||
packages/trigger-sdk:
|
||||
@@ -23360,6 +23360,41 @@ packages:
|
||||
- ts-node
|
||||
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:
|
||||
resolution: {integrity: sha512-mazl/GRAk70j8S43/AbSYXGgvRP54oQeX8Un4iZxzATHt0roW0t6HYDVZIXMw0ZQIpvr1nFMniIVnN5186lW7w==}
|
||||
engines: {node: '>=16.14'}
|
||||
|
||||
Reference in New Issue
Block a user