@react-router/dev 0.0.0-experimental-7c6c0664d → 0.0.0-experimental-9f7fdccd4

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 (66) hide show
  1. package/dist/cli/index.d.ts +2 -1
  2. package/dist/cli/index.js +1402 -8
  3. package/dist/{config/routes.d.ts → routes-C14jcF98.d.ts} +15 -21
  4. package/dist/routes.d.ts +2 -2
  5. package/dist/routes.js +181 -11
  6. package/dist/vite/cloudflare.d.ts +23 -1
  7. package/dist/vite/cloudflare.js +171 -5
  8. package/dist/vite.d.ts +169 -2
  9. package/dist/vite.js +2394 -5
  10. package/package.json +29 -10
  11. package/dist/cli/commands.d.ts +0 -13
  12. package/dist/cli/commands.js +0 -179
  13. package/dist/cli/detectPackageManager.d.ts +0 -10
  14. package/dist/cli/detectPackageManager.js +0 -39
  15. package/dist/cli/run.d.ts +0 -5
  16. package/dist/cli/run.js +0 -188
  17. package/dist/cli/useJavascript.d.ts +0 -4
  18. package/dist/cli/useJavascript.js +0 -66
  19. package/dist/colors.d.ts +0 -17
  20. package/dist/colors.js +0 -49
  21. package/dist/config/format.d.ts +0 -5
  22. package/dist/config/format.js +0 -68
  23. package/dist/config/routes.js +0 -253
  24. package/dist/config/serverModes.d.ts +0 -9
  25. package/dist/invariant.d.ts +0 -2
  26. package/dist/invariant.js +0 -20
  27. package/dist/manifest.d.ts +0 -28
  28. package/dist/typescript/plugin.d.ts +0 -4
  29. package/dist/typescript/plugin.js +0 -52
  30. package/dist/typescript/typegen.d.ts +0 -10
  31. package/dist/typescript/typegen.js +0 -190
  32. package/dist/vite/babel.d.ts +0 -20
  33. package/dist/vite/babel.js +0 -49
  34. package/dist/vite/build.d.ts +0 -15
  35. package/dist/vite/build.js +0 -249
  36. package/dist/vite/cloudflare-dev-proxy.d.ts +0 -21
  37. package/dist/vite/cloudflare-dev-proxy.js +0 -89
  38. package/dist/vite/combine-urls-test.d.ts +0 -1
  39. package/dist/vite/combine-urls.d.ts +0 -1
  40. package/dist/vite/combine-urls.js +0 -20
  41. package/dist/vite/config.d.ts +0 -234
  42. package/dist/vite/config.js +0 -282
  43. package/dist/vite/dev.d.ts +0 -15
  44. package/dist/vite/dev.js +0 -81
  45. package/dist/vite/import-vite-esm-sync.d.ts +0 -4
  46. package/dist/vite/import-vite-esm-sync.js +0 -28
  47. package/dist/vite/node-adapter.d.ts +0 -6
  48. package/dist/vite/node-adapter.js +0 -90
  49. package/dist/vite/plugin.d.ts +0 -75
  50. package/dist/vite/plugin.js +0 -1301
  51. package/dist/vite/profiler.d.ts +0 -5
  52. package/dist/vite/profiler.js +0 -55
  53. package/dist/vite/remove-exports-test.d.ts +0 -1
  54. package/dist/vite/remove-exports.d.ts +0 -2
  55. package/dist/vite/remove-exports.js +0 -148
  56. package/dist/vite/resolve-file-url.d.ts +0 -3
  57. package/dist/vite/resolve-file-url.js +0 -53
  58. package/dist/vite/styles.d.ts +0 -14
  59. package/dist/vite/styles.js +0 -199
  60. package/dist/vite/vite-node.d.ts +0 -9
  61. package/dist/vite/vite-node.js +0 -57
  62. package/dist/vite/vmod.d.ts +0 -3
  63. package/dist/vite/vmod.js +0 -21
  64. package/dist/vite/with-props.d.ts +0 -4
  65. package/dist/vite/with-props.js +0 -151
  66. /package/dist/{vite/static → static}/refresh-utils.cjs +0 -0
@@ -1,151 +0,0 @@
1
- /**
2
- * @react-router/dev v0.0.0-experimental-7c6c0664d
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- 'use strict';
12
-
13
- Object.defineProperty(exports, '__esModule', { value: true });
14
-
15
- var dedent = require('dedent');
16
- var babel = require('./babel.js');
17
- var vmod = require('./vmod.js');
18
- var t = require('@babel/types');
19
-
20
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
-
22
- function _interopNamespace(e) {
23
- if (e && e.__esModule) return e;
24
- var n = Object.create(null);
25
- if (e) {
26
- Object.keys(e).forEach(function (k) {
27
- if (k !== 'default') {
28
- var d = Object.getOwnPropertyDescriptor(e, k);
29
- Object.defineProperty(n, k, d.get ? d : {
30
- enumerable: true,
31
- get: function () { return e[k]; }
32
- });
33
- }
34
- });
35
- }
36
- n["default"] = e;
37
- return Object.freeze(n);
38
- }
39
-
40
- var dedent__default = /*#__PURE__*/_interopDefaultLegacy(dedent);
41
- var t__namespace = /*#__PURE__*/_interopNamespace(t);
42
-
43
- const vmodId = vmod.id("with-props");
44
- const NAMED_COMPONENT_EXPORTS = ["HydrateFallback", "ErrorBoundary"];
45
- const plugin = {
46
- name: "react-router-with-props",
47
- enforce: "pre",
48
- resolveId(id) {
49
- if (id === vmodId) return vmod.resolve(vmodId);
50
- },
51
- async load(id) {
52
- if (id !== vmod.resolve(vmodId)) return;
53
- return dedent__default["default"]`
54
- import { createElement as h } from "react";
55
- import { useActionData, useLoaderData, useParams } from "react-router";
56
-
57
- export function withComponentProps(Component) {
58
- return function Wrapped() {
59
- const props = {
60
- params: useParams(),
61
- loaderData: useLoaderData(),
62
- actionData: useActionData(),
63
- };
64
- return h(Component, props);
65
- };
66
- }
67
-
68
- export function withHydrateFallbackProps(HydrateFallback) {
69
- return function Wrapped() {
70
- const props = {
71
- params: useParams(),
72
- };
73
- return h(HydrateFallback, props);
74
- };
75
- }
76
-
77
- export function withErrorBoundaryProps(ErrorBoundary) {
78
- return function Wrapped() {
79
- const props = {
80
- params: useParams(),
81
- loaderData: useLoaderData(),
82
- actionData: useActionData(),
83
- };
84
- return h(ErrorBoundary, props);
85
- };
86
- }
87
- `;
88
- }
89
- };
90
- const transform = ast => {
91
- const hocs = [];
92
- function getHocUid(path, hocName) {
93
- const uid = path.scope.generateUidIdentifier(hocName);
94
- hocs.push([hocName, uid]);
95
- return uid;
96
- }
97
- babel.traverse(ast, {
98
- ExportDeclaration(path) {
99
- if (path.isExportDefaultDeclaration()) {
100
- const declaration = path.get("declaration");
101
- // prettier-ignore
102
- const expr = declaration.isExpression() ? declaration.node : declaration.isFunctionDeclaration() ? toFunctionExpression(declaration.node) : undefined;
103
- if (expr) {
104
- const uid = getHocUid(path, "withComponentProps");
105
- declaration.replaceWith(t__namespace.callExpression(uid, [expr]));
106
- }
107
- return;
108
- }
109
- if (path.isExportNamedDeclaration()) {
110
- const decl = path.get("declaration");
111
- if (decl.isVariableDeclaration()) {
112
- decl.get("declarations").forEach(varDeclarator => {
113
- const id = varDeclarator.get("id");
114
- const init = varDeclarator.get("init");
115
- const expr = init.node;
116
- if (!expr) return;
117
- if (!id.isIdentifier()) return;
118
- const {
119
- name
120
- } = id.node;
121
- if (!NAMED_COMPONENT_EXPORTS.includes(name)) return;
122
- const uid = getHocUid(path, `with${name}Props`);
123
- init.replaceWith(t__namespace.callExpression(uid, [expr]));
124
- });
125
- return;
126
- }
127
- if (decl.isFunctionDeclaration()) {
128
- const {
129
- id
130
- } = decl.node;
131
- if (!id) return;
132
- const {
133
- name
134
- } = id;
135
- if (!NAMED_COMPONENT_EXPORTS.includes(name)) return;
136
- const uid = getHocUid(path, `with${name}Props`);
137
- decl.replaceWith(t__namespace.variableDeclaration("const", [t__namespace.variableDeclarator(t__namespace.identifier(name), t__namespace.callExpression(uid, [toFunctionExpression(decl.node)]))]));
138
- }
139
- }
140
- }
141
- });
142
- if (hocs.length > 0) {
143
- ast.program.body.unshift(t__namespace.importDeclaration(hocs.map(([name, identifier]) => t__namespace.importSpecifier(identifier, t__namespace.identifier(name))), t__namespace.stringLiteral(vmodId)));
144
- }
145
- };
146
- function toFunctionExpression(decl) {
147
- return t__namespace.functionExpression(decl.id, decl.params, decl.body, decl.generator, decl.async);
148
- }
149
-
150
- exports.plugin = plugin;
151
- exports.transform = transform;
File without changes