@nrwl/remix 13.7.1 → 14.7.0
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.
- package/README.md +2 -2
- package/generators.json +25 -0
- package/migrations.json +54 -0
- package/package.json +8 -4
- package/src/generators/action/action.impl.d.ts +3 -0
- package/src/generators/action/action.impl.js +48 -0
- package/src/generators/action/action.impl.js.map +1 -0
- package/src/generators/action/schema.d.ts +4 -0
- package/src/generators/action/schema.json +27 -0
- package/src/generators/application/application.impl.js +13 -11
- package/src/generators/application/application.impl.js.map +1 -1
- package/src/generators/application/files/.gitignore__tmpl__ +4 -0
- package/src/generators/application/files/app/entry.client.tsx__tmpl__ +2 -2
- package/src/generators/application/files/app/entry.server.tsx__tmpl__ +4 -4
- package/src/generators/application/files/app/root.tsx__tmpl__ +10 -156
- package/src/generators/application/files/app/routes/index.tsx__tmpl__ +28 -96
- package/src/generators/application/files/package.json__tmpl__ +4 -5
- package/src/generators/application/files/remix.config.js__tmpl__ +8 -7
- package/src/generators/application/files/tsconfig.json__tmpl__ +5 -4
- package/src/generators/cypress/cypress.impl.js +5 -5
- package/src/generators/cypress/cypress.impl.js.map +1 -1
- package/src/generators/library/library.impl.js +1 -1
- package/src/generators/loader/loader.impl.d.ts +3 -0
- package/src/generators/loader/loader.impl.js +48 -0
- package/src/generators/loader/loader.impl.js.map +1 -0
- package/src/generators/loader/schema.d.ts +4 -0
- package/src/generators/loader/schema.json +27 -0
- package/src/generators/meta/meta.impl.d.ts +3 -0
- package/src/generators/meta/meta.impl.js +29 -0
- package/src/generators/meta/meta.impl.js.map +1 -0
- package/src/generators/meta/schema.d.ts +4 -0
- package/src/generators/meta/schema.json +27 -0
- package/src/generators/preset/preset.impl.js +1 -1
- package/src/generators/resource-route/resource-route.impl.d.ts +3 -0
- package/src/generators/resource-route/resource-route.impl.js +32 -0
- package/src/generators/resource-route/resource-route.impl.js.map +1 -0
- package/src/generators/resource-route/schema.d.ts +6 -0
- package/src/generators/resource-route/schema.json +44 -0
- package/src/generators/route/route.impl.js +38 -62
- package/src/generators/route/route.impl.js.map +1 -1
- package/src/generators/route/schema.d.ts +3 -0
- package/src/generators/route/schema.json +24 -9
- package/src/generators/setup/setup.impl.js +1 -1
- package/src/generators/style/schema.d.ts +4 -0
- package/src/generators/style/schema.json +34 -0
- package/src/generators/style/style.impl.d.ts +3 -0
- package/src/generators/style/style.impl.js +41 -0
- package/src/generators/style/style.impl.js.map +1 -0
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.d.ts +6 -0
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js +45 -0
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js.map +1 -0
- package/src/utils/get-default-export-name.d.ts +2 -0
- package/src/utils/get-default-export-name.js +10 -0
- package/src/utils/get-default-export-name.js.map +1 -0
- package/src/utils/get-default-export.d.ts +2 -0
- package/src/utils/get-default-export.js +16 -0
- package/src/utils/get-default-export.js.map +1 -0
- package/src/utils/insert-import.d.ts +4 -0
- package/src/utils/insert-import.js +55 -0
- package/src/utils/insert-import.js.map +1 -0
- package/src/utils/insert-statement-after-imports.d.ts +5 -0
- package/src/utils/insert-statement-after-imports.js +29 -0
- package/src/utils/insert-statement-after-imports.js.map +1 -0
- package/src/utils/insert-statement-in-default-function.d.ts +2 -0
- package/src/utils/insert-statement-in-default-function.js +24 -0
- package/src/utils/insert-statement-in-default-function.js.map +1 -0
- package/src/utils/remix-route-utils.d.ts +11 -0
- package/src/utils/remix-route-utils.js +53 -0
- package/src/utils/remix-route-utils.js.map +1 -0
- package/src/generators/application/files/app/routes/demos/about/index.tsx__tmpl__ +0 -17
- package/src/generators/application/files/app/routes/demos/about/whoa.tsx__tmpl__ +0 -20
- package/src/generators/application/files/app/routes/demos/about.tsx__tmpl__ +0 -44
- package/src/generators/application/files/app/routes/demos/actions.tsx__tmpl__ +0 -101
- package/src/generators/application/files/app/routes/demos/correct.tsx__tmpl__ +0 -3
- package/src/generators/application/files/app/routes/demos/params/$id.tsx__tmpl__ +0 -110
- package/src/generators/application/files/app/routes/demos/params/index.tsx__tmpl__ +0 -40
- package/src/generators/application/files/app/routes/demos/params.tsx__tmpl__ +0 -43
- package/src/generators/application/files/app/styles/dark.css +0 -7
- package/src/generators/application/files/app/styles/demos/about.css +0 -26
- package/src/generators/application/files/app/styles/global.css +0 -216
package/README.md
CHANGED
|
@@ -111,10 +111,10 @@ npx nx dev demo
|
|
|
111
111
|
|
|
112
112
|
### Running unit tests
|
|
113
113
|
|
|
114
|
-
Run `nx test
|
|
114
|
+
Run `nx test demo` to execute the unit tests via [Jest](https://jestjs.io).
|
|
115
115
|
|
|
116
116
|
### Publishing
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
|
-
nx publish
|
|
119
|
+
nx publish demo --ver=[version]
|
|
120
120
|
```
|
package/generators.json
CHANGED
|
@@ -35,6 +35,31 @@
|
|
|
35
35
|
"schema": "./src/generators/route/schema.json",
|
|
36
36
|
"description": "Generate a new route"
|
|
37
37
|
},
|
|
38
|
+
"resource-route": {
|
|
39
|
+
"implementation": "./src/generators/resource-route/resource-route.impl",
|
|
40
|
+
"schema": "./src/generators/resource-route/schema.json",
|
|
41
|
+
"description": "Generate a new resource route"
|
|
42
|
+
},
|
|
43
|
+
"action": {
|
|
44
|
+
"implementation": "./src/generators/action/action.impl",
|
|
45
|
+
"schema": "./src/generators/action/schema.json",
|
|
46
|
+
"description": "Add an action function to an existing route"
|
|
47
|
+
},
|
|
48
|
+
"loader": {
|
|
49
|
+
"implementation": "./src/generators/loader/loader.impl",
|
|
50
|
+
"schema": "./src/generators/loader/schema.json",
|
|
51
|
+
"description": "Add a loader function to an existing route"
|
|
52
|
+
},
|
|
53
|
+
"style": {
|
|
54
|
+
"implementation": "./src/generators/style/style.impl",
|
|
55
|
+
"schema": "./src/generators/style/schema.json",
|
|
56
|
+
"description": "Generates a new stylesheet and adds it to an existing route"
|
|
57
|
+
},
|
|
58
|
+
"meta": {
|
|
59
|
+
"implementation": "./src/generators/meta/meta.impl",
|
|
60
|
+
"schema": "./src/generators/meta/schema.json",
|
|
61
|
+
"description": "Add a meta function to an existing route"
|
|
62
|
+
},
|
|
38
63
|
"cypress": {
|
|
39
64
|
"implementation": "./src/generators/cypress/cypress.impl",
|
|
40
65
|
"schema": "./src/generators/cypress/schema.json",
|
package/migrations.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schematics": {
|
|
3
|
+
"update-tsconfig-and-remix-config-for-1-6-8": {
|
|
4
|
+
"version": "14.5.4",
|
|
5
|
+
"cli": "nx",
|
|
6
|
+
"description": "Update tsconfig.json and tsconfig.json to enable import of workspace libs",
|
|
7
|
+
"factory": "./src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
},
|
|
11
|
+
"packageJsonUpdates": {
|
|
12
|
+
"14.5.4": {
|
|
13
|
+
"version": "14.5.4",
|
|
14
|
+
"packages": {
|
|
15
|
+
"@remix-run/react": {
|
|
16
|
+
"version": "^1.6.8",
|
|
17
|
+
"alwaysAddToPackageJson": true
|
|
18
|
+
},
|
|
19
|
+
"@remix-run/node": {
|
|
20
|
+
"version": "^1.6.8",
|
|
21
|
+
"alwaysAddToPackageJson": true
|
|
22
|
+
},
|
|
23
|
+
"@remix-run/serve": {
|
|
24
|
+
"version": "^1.6.8",
|
|
25
|
+
"alwaysAddToPackageJson": true
|
|
26
|
+
},
|
|
27
|
+
"@remix-run/dev": {
|
|
28
|
+
"version": "^1.6.8",
|
|
29
|
+
"alwaysAddToPackageJson": true
|
|
30
|
+
},
|
|
31
|
+
"@remix-run/eslint-config": {
|
|
32
|
+
"version": "^1.6.8",
|
|
33
|
+
"alwaysAddToPackageJson": true
|
|
34
|
+
},
|
|
35
|
+
"react": {
|
|
36
|
+
"version": "^18.2.0",
|
|
37
|
+
"alwaysAddToPackageJson": true
|
|
38
|
+
},
|
|
39
|
+
"react-dom": {
|
|
40
|
+
"version": "^18.2.0",
|
|
41
|
+
"alwaysAddToPackageJson": true
|
|
42
|
+
},
|
|
43
|
+
"@types/react-dom": {
|
|
44
|
+
"version": "^18.0.6",
|
|
45
|
+
"alwaysAddToPackageJson": true
|
|
46
|
+
},
|
|
47
|
+
"@types/react": {
|
|
48
|
+
"version": "^18.0.15",
|
|
49
|
+
"alwaysAddToPackageJson": true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/remix",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.7.0",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"generators": "./generators.json",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@nrwl/devkit": "^
|
|
8
|
-
"@nrwl/js": "^
|
|
9
|
-
"@nrwl/react": "^
|
|
7
|
+
"@nrwl/devkit": "^14.5.0",
|
|
8
|
+
"@nrwl/js": "^14.5.0",
|
|
9
|
+
"@nrwl/react": "^14.5.0",
|
|
10
10
|
"tslib": "^2.3.1"
|
|
11
11
|
},
|
|
12
|
+
"ng-update": {
|
|
13
|
+
"requirements": {},
|
|
14
|
+
"migrations": "./migrations.json"
|
|
15
|
+
},
|
|
12
16
|
"typings": "./src/index.d.ts"
|
|
13
17
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const insert_import_1 = require("../../utils/insert-import");
|
|
6
|
+
const insert_statement_after_imports_1 = require("../../utils/insert-statement-after-imports");
|
|
7
|
+
const get_default_export_name_1 = require("../../utils/get-default-export-name");
|
|
8
|
+
const insert_statement_in_default_function_1 = require("../../utils/insert-statement-in-default-function");
|
|
9
|
+
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
10
|
+
function default_1(tree, schema) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
const routeFilePath = (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
|
|
13
|
+
if (!tree.exists(routeFilePath)) {
|
|
14
|
+
throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
|
|
15
|
+
}
|
|
16
|
+
(0, insert_import_1.insertImport)(tree, routeFilePath, 'ActionFunction', '@remix-run/node', {
|
|
17
|
+
typeOnly: true,
|
|
18
|
+
});
|
|
19
|
+
(0, insert_import_1.insertImport)(tree, routeFilePath, 'json', '@remix-run/node');
|
|
20
|
+
(0, insert_import_1.insertImport)(tree, routeFilePath, 'useActionData', '@remix-run/react');
|
|
21
|
+
const defaultExportName = (0, get_default_export_name_1.getDefaultExportName)(tree, routeFilePath);
|
|
22
|
+
const actionTypeName = `${defaultExportName}ActionData`;
|
|
23
|
+
(0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
|
|
24
|
+
type ${actionTypeName} = {
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export let action: ActionFunction = async ({ request }) => {
|
|
29
|
+
let formData = await request.formData();
|
|
30
|
+
|
|
31
|
+
return json({message: formData.toString()}, { status: 200 });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
`);
|
|
35
|
+
const statement = `\nconst actionMessage = useActionData<${actionTypeName}>();`;
|
|
36
|
+
try {
|
|
37
|
+
(0, insert_statement_in_default_function_1.insertStatementInDefaultFunction)(tree, routeFilePath, statement);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
// eslint-disable-next-line no-empty
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.default = default_1;
|
|
48
|
+
//# sourceMappingURL=action.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/action/action.impl.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAEjD,6DAAyD;AACzD,+FAAyF;AACzF,iFAA2E;AAC3E,2GAAoG;AACpG,qEAAsE;AAEtE,mBAA+B,IAAU,EAAE,MAAoB;;QAC7D,MAAM,aAAa,GAAG,IAAA,yCAAqB,EACzC,IAAI,EACJ,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,OAAO,CACf,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,8BAA8B,aAAa,wCAAwC,CACpF,CAAC;SACH;QAED,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE;YACrE,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;QAC7D,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAC;QAEvE,MAAM,iBAAiB,GAAG,IAAA,8CAAoB,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACpE,MAAM,cAAc,GAAG,GAAG,iBAAiB,YAAY,CAAC;QAExD,IAAA,4DAA2B,EACzB,IAAI,EACJ,aAAa,EACb;WACO,cAAc;;;;;;;;;;KAUpB,CACF,CAAC;QAEF,MAAM,SAAS,GAAG,yCAAyC,cAAc,MAAM,CAAC;QAEhF,IAAI;YACF,IAAA,uEAAgC,EAAC,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;SAClE;QAAC,OAAO,GAAG,EAAE;YACZ,oCAAoC;SACrC;gBAAS;YACR,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AAhDD,4BAgDC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "action",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"path": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The route path or path to the filename of the route.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What is the path of the route? (e.g. 'foo/bar')"
|
|
15
|
+
},
|
|
16
|
+
"project": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "The name of the project.",
|
|
19
|
+
"$default": {
|
|
20
|
+
"$source": "projectName"
|
|
21
|
+
},
|
|
22
|
+
"x-prompt": "What project is this route for?",
|
|
23
|
+
"pattern": "^[a-zA-Z].*$"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": ["path", "project"]
|
|
27
|
+
}
|
|
@@ -6,7 +6,7 @@ const normalize_options_1 = require("./lib/normalize-options");
|
|
|
6
6
|
const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
function default_1(tree, _options) {
|
|
9
|
-
return
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
10
|
const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
11
11
|
const tasks = [];
|
|
12
12
|
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
@@ -16,19 +16,21 @@ function default_1(tree, _options) {
|
|
|
16
16
|
tags: options.parsedTags,
|
|
17
17
|
});
|
|
18
18
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
19
|
-
'@remix-run/react': '^1.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
'@remix-run/serve': '^1.
|
|
19
|
+
'@remix-run/react': '^1.6.8',
|
|
20
|
+
'@remix-run/node': '^1.6.8',
|
|
21
|
+
react: '^18.2.0',
|
|
22
|
+
'react-dom': '^18.2.0',
|
|
23
|
+
'@remix-run/serve': '^1.6.8',
|
|
24
24
|
}, {
|
|
25
|
-
'@remix-run/dev': '^1.
|
|
26
|
-
'@
|
|
27
|
-
'@types/react
|
|
28
|
-
|
|
25
|
+
'@remix-run/dev': '^1.6.8',
|
|
26
|
+
'@remix-run/eslint-config': '^1.6.8',
|
|
27
|
+
'@types/react': '^18.0.15',
|
|
28
|
+
'@types/react-dom': '^18.0.6',
|
|
29
|
+
eslint: '^8.20.0',
|
|
30
|
+
typescript: '^4.7.4',
|
|
29
31
|
});
|
|
30
32
|
tasks.push(installTask);
|
|
31
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), options.projectRoot, Object.assign(Object.assign({}, options), { tmpl: '' }));
|
|
33
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), options.projectRoot, Object.assign(Object.assign({}, options), { tmpl: '', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot) }));
|
|
32
34
|
const remixSetupCommand = 'remix setup node';
|
|
33
35
|
// update package json with postinstall command
|
|
34
36
|
(0, devkit_1.updateJson)(tree, 'package.json', (pkgJson) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/application/application.impl.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"application.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/application/application.impl.ts"],"names":[],"mappings":";;;AAAA,yCAUsB;AAEtB,+DAA2D;AAC3D,2FAAqF;AACrF,iDAAyC;AAEzC,mBAA+B,IAAU,EAAE,QAAgC;;QACzE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,IAAA,gCAAuB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE;YACjD,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,UAAU,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE;YACpC,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,OAAO,CAAC,UAAU;SACzB,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,IAAA,qCAA4B,EAC9C,IAAI,EACJ;YACE,kBAAkB,EAAE,QAAQ;YAC5B,iBAAiB,EAAE,QAAQ;YAC3B,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,SAAS;YACtB,kBAAkB,EAAE,QAAQ;SAC7B,EACD;YACE,gBAAgB,EAAE,QAAQ;YAC1B,0BAA0B,EAAE,QAAQ;YACpC,cAAc,EAAE,UAAU;YAC1B,kBAAkB,EAAE,SAAS;YAC7B,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE,QAAQ;SACrB,CACF,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExB,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EACrC,OAAO,CAAC,WAAW,kCAEd,OAAO,KACV,IAAI,EAAE,EAAE,EACR,cAAc,EAAE,IAAA,uBAAc,EAAC,OAAO,CAAC,WAAW,CAAC,IAEtD,CAAC;QAEF,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;QAE7C,+CAA+C;QAC/C,IAAA,mBAAU,EAAC,IAAI,EAAE,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE;;YAC3C,OAAO,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,CAAC;YACxC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE;gBAChC,OAAO,CAAC,OAAO,CAAC,WAAW,GAAG,iBAAiB,CAAC;aACjD;iBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;gBACnE,OAAO,CAAC,OAAO,CAAC,WAAW,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,OAAO,iBAAiB,EAAE,CAAC;aACxF;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACd,IAAA,wBAAQ,EAAC,OAAO,iBAAiB,EAAE,EAAE;gBACnC,GAAG,EAAE,OAAO,CAAC,WAAW;gBACxB,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;aACjB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAnED,4BAmEC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { EntryContext } from "@remix-run/node";
|
|
2
|
+
import { RemixServer } from "@remix-run/react";
|
|
1
3
|
import { renderToString } from "react-dom/server";
|
|
2
|
-
import { RemixServer } from "remix";
|
|
3
|
-
import type { EntryContext } from "remix";
|
|
4
4
|
|
|
5
5
|
export default function handleRequest(
|
|
6
6
|
request: Request,
|
|
@@ -16,6 +16,6 @@ export default function handleRequest(
|
|
|
16
16
|
|
|
17
17
|
return new Response("<!DOCTYPE html>" + markup, {
|
|
18
18
|
status: responseStatusCode,
|
|
19
|
-
headers: responseHeaders
|
|
19
|
+
headers: responseHeaders,
|
|
20
20
|
});
|
|
21
|
-
}
|
|
21
|
+
}
|
|
@@ -1,178 +1,32 @@
|
|
|
1
|
+
import type { MetaFunction } from "@remix-run/node";
|
|
1
2
|
import {
|
|
2
|
-
Link,
|
|
3
3
|
Links,
|
|
4
4
|
LiveReload,
|
|
5
5
|
Meta,
|
|
6
6
|
Outlet,
|
|
7
7
|
Scripts,
|
|
8
8
|
ScrollRestoration,
|
|
9
|
-
|
|
10
|
-
} from "remix";
|
|
11
|
-
import type { LinksFunction } from "remix";
|
|
9
|
+
} from "@remix-run/react";
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
export const meta: MetaFunction = () => ({
|
|
12
|
+
charset: "utf-8",
|
|
13
|
+
title: "New Remix App",
|
|
14
|
+
viewport: "width=device-width,initial-scale=1",
|
|
15
|
+
});
|
|
15
16
|
|
|
16
|
-
// https://remix.run/api/app#links
|
|
17
|
-
export let links: LinksFunction = () => {
|
|
18
|
-
return [
|
|
19
|
-
{ rel: "stylesheet", href: globalStylesUrl },
|
|
20
|
-
{
|
|
21
|
-
rel: "stylesheet",
|
|
22
|
-
href: darkStylesUrl,
|
|
23
|
-
media: "(prefers-color-scheme: dark)"
|
|
24
|
-
}
|
|
25
|
-
];
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// https://remix.run/api/conventions#default-export
|
|
29
|
-
// https://remix.run/api/conventions#route-filenames
|
|
30
17
|
export default function App() {
|
|
31
|
-
return (
|
|
32
|
-
<Document>
|
|
33
|
-
<Layout>
|
|
34
|
-
<Outlet />
|
|
35
|
-
</Layout>
|
|
36
|
-
</Document>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// https://remix.run/docs/en/v1/api/conventions#errorboundary
|
|
41
|
-
export function ErrorBoundary({ error }: { error: Error }) {
|
|
42
|
-
console.error(error);
|
|
43
|
-
return (
|
|
44
|
-
<Document title="Error!">
|
|
45
|
-
<Layout>
|
|
46
|
-
<div>
|
|
47
|
-
<h1>There was an error</h1>
|
|
48
|
-
<p>{error.message}</p>
|
|
49
|
-
<hr />
|
|
50
|
-
<p>
|
|
51
|
-
Hey, developer, you should replace this with what you want your
|
|
52
|
-
users to see.
|
|
53
|
-
</p>
|
|
54
|
-
</div>
|
|
55
|
-
</Layout>
|
|
56
|
-
</Document>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// https://remix.run/docs/en/v1/api/conventions#catchboundary
|
|
61
|
-
export function CatchBoundary() {
|
|
62
|
-
let caught = useCatch();
|
|
63
|
-
|
|
64
|
-
let message;
|
|
65
|
-
switch (caught.status) {
|
|
66
|
-
case 401:
|
|
67
|
-
message = (
|
|
68
|
-
<p>
|
|
69
|
-
Oops! Looks like you tried to visit a page that you do not have access
|
|
70
|
-
to.
|
|
71
|
-
</p>
|
|
72
|
-
);
|
|
73
|
-
break;
|
|
74
|
-
case 404:
|
|
75
|
-
message = (
|
|
76
|
-
<p>Oops! Looks like you tried to visit a page that does not exist.</p>
|
|
77
|
-
);
|
|
78
|
-
break;
|
|
79
|
-
|
|
80
|
-
default:
|
|
81
|
-
throw new Error(caught.data || caught.statusText);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<Document title={`${caught.status} ${caught.statusText}`}>
|
|
86
|
-
<Layout>
|
|
87
|
-
<h1>
|
|
88
|
-
{caught.status}: {caught.statusText}
|
|
89
|
-
</h1>
|
|
90
|
-
{message}
|
|
91
|
-
</Layout>
|
|
92
|
-
</Document>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function Document({
|
|
97
|
-
children,
|
|
98
|
-
title
|
|
99
|
-
}: {
|
|
100
|
-
children: React.ReactNode;
|
|
101
|
-
title?: string;
|
|
102
|
-
}) {
|
|
103
18
|
return (
|
|
104
19
|
<html lang="en">
|
|
105
20
|
<head>
|
|
106
|
-
<meta charSet="utf-8" />
|
|
107
|
-
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
108
|
-
{title ? <title>{title}</title> : null}
|
|
109
21
|
<Meta />
|
|
110
22
|
<Links />
|
|
111
23
|
</head>
|
|
112
24
|
<body>
|
|
113
|
-
|
|
25
|
+
<Outlet />
|
|
114
26
|
<ScrollRestoration />
|
|
115
27
|
<Scripts />
|
|
116
|
-
|
|
28
|
+
<LiveReload />
|
|
117
29
|
</body>
|
|
118
30
|
</html>
|
|
119
31
|
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function Layout({ children }: { children: React.ReactNode }) {
|
|
123
|
-
return (
|
|
124
|
-
<div className="remix-app">
|
|
125
|
-
<header className="remix-app__header">
|
|
126
|
-
<div className="container remix-app__header-content">
|
|
127
|
-
<Link to="/" title="Remix" className="remix-app__header-home-link">
|
|
128
|
-
<RemixLogo />
|
|
129
|
-
</Link>
|
|
130
|
-
<nav aria-label="Main navigation" className="remix-app__header-nav">
|
|
131
|
-
<ul>
|
|
132
|
-
<li>
|
|
133
|
-
<Link to="/">Home</Link>
|
|
134
|
-
</li>
|
|
135
|
-
<li>
|
|
136
|
-
<a href="https://remix.run/docs">Remix Docs</a>
|
|
137
|
-
</li>
|
|
138
|
-
<li>
|
|
139
|
-
<a href="https://github.com/remix-run/remix">GitHub</a>
|
|
140
|
-
</li>
|
|
141
|
-
</ul>
|
|
142
|
-
</nav>
|
|
143
|
-
</div>
|
|
144
|
-
</header>
|
|
145
|
-
<div className="remix-app__main">
|
|
146
|
-
<div className="container remix-app__main-content">{children}</div>
|
|
147
|
-
</div>
|
|
148
|
-
<footer className="remix-app__footer">
|
|
149
|
-
<div className="container remix-app__footer-content">
|
|
150
|
-
<p>© You!</p>
|
|
151
|
-
</div>
|
|
152
|
-
</footer>
|
|
153
|
-
</div>
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function RemixLogo() {
|
|
158
|
-
return (
|
|
159
|
-
<svg
|
|
160
|
-
viewBox="0 0 659 165"
|
|
161
|
-
version="1.1"
|
|
162
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
163
|
-
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
164
|
-
aria-labelledby="remix-run-logo-title"
|
|
165
|
-
role="img"
|
|
166
|
-
width="106"
|
|
167
|
-
height="30"
|
|
168
|
-
fill="currentColor"
|
|
169
|
-
>
|
|
170
|
-
<title id="remix-run-logo-title">Remix Logo</title>
|
|
171
|
-
<path d="M0 161V136H45.5416C53.1486 136 54.8003 141.638 54.8003 145V161H0Z M133.85 124.16C135.3 142.762 135.3 151.482 135.3 161H92.2283C92.2283 158.927 92.2653 157.03 92.3028 155.107C92.4195 149.128 92.5411 142.894 91.5717 130.304C90.2905 111.872 82.3473 107.776 67.7419 107.776H54.8021H0V74.24H69.7918C88.2407 74.24 97.4651 68.632 97.4651 53.784C97.4651 40.728 88.2407 32.816 69.7918 32.816H0V0H77.4788C119.245 0 140 19.712 140 51.2C140 74.752 125.395 90.112 105.665 92.672C122.32 96 132.057 105.472 133.85 124.16Z" />
|
|
172
|
-
<path d="M229.43 120.576C225.59 129.536 218.422 133.376 207.158 133.376C194.614 133.376 184.374 126.72 183.35 112.64H263.478V101.12C263.478 70.1437 243.254 44.0317 205.11 44.0317C169.526 44.0317 142.902 69.8877 142.902 105.984C142.902 142.336 169.014 164.352 205.622 164.352C235.83 164.352 256.822 149.76 262.71 123.648L229.43 120.576ZM183.862 92.6717C185.398 81.9197 191.286 73.7277 204.598 73.7277C216.886 73.7277 223.542 82.4317 224.054 92.6717H183.862Z" />
|
|
173
|
-
<path d="M385.256 66.5597C380.392 53.2477 369.896 44.0317 349.672 44.0317C332.52 44.0317 320.232 51.7117 314.088 64.2557V47.1037H272.616V161.28H314.088V105.216C314.088 88.0638 318.952 76.7997 332.52 76.7997C345.064 76.7997 348.136 84.9917 348.136 100.608V161.28H389.608V105.216C389.608 88.0638 394.216 76.7997 408.04 76.7997C420.584 76.7997 423.4 84.9917 423.4 100.608V161.28H464.872V89.5997C464.872 65.7917 455.656 44.0317 424.168 44.0317C404.968 44.0317 391.4 53.7597 385.256 66.5597Z" />
|
|
174
|
-
<path d="M478.436 47.104V161.28H519.908V47.104H478.436ZM478.18 36.352H520.164V0H478.18V36.352Z" />
|
|
175
|
-
<path d="M654.54 47.1035H611.788L592.332 74.2395L573.388 47.1035H527.564L568.78 103.168L523.98 161.28H566.732L589.516 130.304L612.3 161.28H658.124L613.068 101.376L654.54 47.1035Z" />
|
|
176
|
-
</svg>
|
|
177
|
-
);
|
|
178
|
-
}
|
|
32
|
+
}
|
|
@@ -1,100 +1,32 @@
|
|
|
1
|
-
import type { MetaFunction, LoaderFunction } from "remix";
|
|
2
|
-
import { useLoaderData, json, Link } from "remix";
|
|
3
|
-
|
|
4
|
-
type IndexData = {
|
|
5
|
-
resources: Array<{ name: string; url: string }>;
|
|
6
|
-
demos: Array<{ name: string; to: string }>;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// Loaders provide data to components and are only ever called on the server, so
|
|
10
|
-
// you can connect to a database or run any server side code you want right next
|
|
11
|
-
// to the component that renders it.
|
|
12
|
-
// https://remix.run/api/conventions#loader
|
|
13
|
-
export let loader: LoaderFunction = () => {
|
|
14
|
-
let data: IndexData = {
|
|
15
|
-
resources: [
|
|
16
|
-
{
|
|
17
|
-
name: "Remix Docs",
|
|
18
|
-
url: "https://remix.run/docs"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: "React Router Docs",
|
|
22
|
-
url: "https://reactrouter.com/docs"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "Remix Discord",
|
|
26
|
-
url: "https://discord.gg/VBePs6d"
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
demos: [
|
|
30
|
-
{
|
|
31
|
-
to: "demos/actions",
|
|
32
|
-
name: "Actions"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
to: "demos/about",
|
|
36
|
-
name: "Nested Routes, CSS loading/unloading"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
to: "demos/params",
|
|
40
|
-
name: "URL Params and Error Boundaries"
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// https://remix.run/api/remix#json
|
|
46
|
-
return json(data);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// https://remix.run/api/conventions#meta
|
|
50
|
-
export let meta: MetaFunction = () => {
|
|
51
|
-
return {
|
|
52
|
-
title: "Remix Starter",
|
|
53
|
-
description: "Welcome to remix!"
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// https://remix.run/guides/routing#index-routes
|
|
58
1
|
export default function Index() {
|
|
59
|
-
let data = useLoaderData<IndexData>();
|
|
60
|
-
|
|
61
2
|
return (
|
|
62
|
-
<div
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<h2>Resources</h2>
|
|
90
|
-
<ul>
|
|
91
|
-
{data.resources.map(resource => (
|
|
92
|
-
<li key={resource.url} className="remix__page__resource">
|
|
93
|
-
<a href={resource.url}>{resource.name}</a>
|
|
94
|
-
</li>
|
|
95
|
-
))}
|
|
96
|
-
</ul>
|
|
97
|
-
</aside>
|
|
3
|
+
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
|
|
4
|
+
<h1>Welcome to Remix</h1>
|
|
5
|
+
<ul>
|
|
6
|
+
<li>
|
|
7
|
+
<a
|
|
8
|
+
target="_blank"
|
|
9
|
+
href="https://remix.run/tutorials/blog"
|
|
10
|
+
rel="noreferrer"
|
|
11
|
+
>
|
|
12
|
+
15m Quickstart Blog Tutorial
|
|
13
|
+
</a>
|
|
14
|
+
</li>
|
|
15
|
+
<li>
|
|
16
|
+
<a
|
|
17
|
+
target="_blank"
|
|
18
|
+
href="https://remix.run/tutorials/jokes"
|
|
19
|
+
rel="noreferrer"
|
|
20
|
+
>
|
|
21
|
+
Deep Dive Jokes App Tutorial
|
|
22
|
+
</a>
|
|
23
|
+
</li>
|
|
24
|
+
<li>
|
|
25
|
+
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
|
|
26
|
+
Remix Docs
|
|
27
|
+
</a>
|
|
28
|
+
</li>
|
|
29
|
+
</ul>
|
|
98
30
|
</div>
|
|
99
31
|
);
|
|
100
|
-
}
|
|
32
|
+
}
|
|
@@ -10,17 +10,16 @@
|
|
|
10
10
|
"start": "npx remix-serve build"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@remix-run/react": "^1.0
|
|
13
|
+
"@remix-run/react": "^1.6.0",
|
|
14
14
|
"react": "^17.0.2",
|
|
15
15
|
"react-dom": "^17.0.2",
|
|
16
|
-
"remix": "^1.0
|
|
17
|
-
"@remix-run/serve": "^1.0.6"
|
|
16
|
+
"@remix-run/serve": "^1.6.0"
|
|
18
17
|
},
|
|
19
18
|
"devDependencies": {
|
|
20
|
-
"@remix-run/dev": "^1.0
|
|
19
|
+
"@remix-run/dev": "^1.6.0",
|
|
21
20
|
"@types/react": "^17.0.24",
|
|
22
21
|
"@types/react-dom": "^17.0.9",
|
|
23
|
-
"typescript": "^4.
|
|
22
|
+
"typescript": "^4.6.4"
|
|
24
23
|
},
|
|
25
24
|
"engines": {
|
|
26
25
|
"node": ">=14"
|