Skip to content

Commit

Permalink
made transforms safer
Browse files Browse the repository at this point in the history
  • Loading branch information
AlemTuzlak committed Nov 12, 2024
1 parent 5ebde1a commit 1664a0d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"jsdom": "^24.0.0",
"prettier": "^3.1.1",
"prettier-plugin-tailwindcss": "^0.5.10",
"react-router-devtools": "https://pkg.pr.new/forge42dev/Remix-Dev-Tools/react-router-devtools@151.tgz",
"react-router-devtools": "https://pkg.pr.new/forge42dev/Remix-Dev-Tools/react-router-devtools@5ebde1a",
"rimraf": "^5.0.5",
"tailwindcss": "^3.4.0",
"tsx": "^4.7.0",
Expand Down
5 changes: 4 additions & 1 deletion docs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import tsconfigPaths from 'vite-tsconfig-paths'
export default defineConfig({
plugins: [
reactRouterDevTools({
includeInProd: true,
includeInProd: {
client: true,
server: true
},
client: { position: 'middle-right' },
server: { silent: true },
}),
Expand Down
12 changes: 8 additions & 4 deletions src/vite/utils/data-functions-augment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,14 @@ function toFunctionExpression(decl: Babel.FunctionDeclaration) {
}

export function augmentDataFetchingFunctions(code: string, routeId: string) {
const ast = parse(code, { sourceType: "module" })
const didTransform = transform(ast, routeId)
if (!didTransform) {
try {
const ast = parse(code, { sourceType: "module" })
const didTransform = transform(ast, routeId)
if (!didTransform) {
return code
}
return gen(ast).code
} catch (e) {
return code
}
return gen(ast).code
}
5 changes: 4 additions & 1 deletion test-apps/remix-vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ const config = defineRdtConfig({
}],
},
pluginDir: "./plugins",
includeInProd: true,
includeInProd: {
client: true,
server: true
},
// Set this option to true to suppress deprecation warnings
// suppressDeprecationWarning: true,
server: {
Expand Down

0 comments on commit 1664a0d

Please sign in to comment.