@remix-run/fs-routes 0.0.0-experimental-eab1c4d1e
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/LICENSE.md +22 -0
- package/README.md +13 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +46 -0
- package/package.json +43 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Remix Software Inc. 2020-2021
|
|
4
|
+
Copyright (c) Shopify Inc. 2022-2024
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Welcome to Remix!
|
|
2
|
+
|
|
3
|
+
[Remix](https://remix.run) is a web framework that helps you build better websites with React.
|
|
4
|
+
|
|
5
|
+
To get started, open a new shell and run:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npx create-remix@latest
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Then follow the prompts you see in your terminal.
|
|
12
|
+
|
|
13
|
+
For more information about Remix, [visit remix.run](https://remix.run)!
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type RouteConfigEntry } from "@remix-run/route-config";
|
|
2
|
+
/**
|
|
3
|
+
* Creates route config from the file system that matches [Remix's default file
|
|
4
|
+
* conventions](https://remix.run/docs/en/v2/file-conventions/routes), for
|
|
5
|
+
* use within `routes.ts`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function flatRoutes(options?: {
|
|
8
|
+
/**
|
|
9
|
+
* An array of [minimatch](https://www.npmjs.com/package/minimatch) globs that match files to ignore.
|
|
10
|
+
* Defaults to `[]`.
|
|
11
|
+
*/
|
|
12
|
+
ignoredRouteFiles?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* The directory containing file system routes, relative to the app directory.
|
|
15
|
+
* Defaults to `"./routes"`.
|
|
16
|
+
*/
|
|
17
|
+
rootDirectory?: string;
|
|
18
|
+
}): Promise<RouteConfigEntry[]>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @remix-run/fs-routes v0.0.0-experimental-eab1c4d1e
|
|
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 fs = require('node:fs');
|
|
16
|
+
var path = require('node:path');
|
|
17
|
+
var dev = require('@remix-run/dev');
|
|
18
|
+
var routeConfig = require('@remix-run/route-config');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
+
|
|
22
|
+
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
23
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creates route config from the file system that matches [Remix's default file
|
|
27
|
+
* conventions](https://remix.run/docs/en/v2/file-conventions/routes), for
|
|
28
|
+
* use within `routes.ts`.
|
|
29
|
+
*/
|
|
30
|
+
async function flatRoutes(options = {}) {
|
|
31
|
+
let {
|
|
32
|
+
ignoredRouteFiles = [],
|
|
33
|
+
rootDirectory: userRootDirectory = "routes"
|
|
34
|
+
} = options;
|
|
35
|
+
let appDirectory = routeConfig.getAppDirectory();
|
|
36
|
+
let rootDirectory = path__default["default"].resolve(appDirectory, userRootDirectory);
|
|
37
|
+
let relativeRootDirectory = path__default["default"].relative(appDirectory, rootDirectory);
|
|
38
|
+
let prefix = normalizeSlashes(relativeRootDirectory);
|
|
39
|
+
let routes = fs__default["default"].existsSync(rootDirectory) ? dev.UNSAFE_flatRoutes(appDirectory, ignoredRouteFiles, prefix) : {};
|
|
40
|
+
return dev.UNSAFE_routeManifestToRouteConfig(routes);
|
|
41
|
+
}
|
|
42
|
+
function normalizeSlashes(file) {
|
|
43
|
+
return file.split(path__default["default"].win32.sep).join("/");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.flatRoutes = flatRoutes;
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@remix-run/fs-routes",
|
|
3
|
+
"version": "0.0.0-experimental-eab1c4d1e",
|
|
4
|
+
"description": "Config-based file system routing conventions, for use within routes.ts",
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/remix-run/remix/issues"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/remix-run/remix",
|
|
11
|
+
"directory": "packages/remix-fs-routes"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"typings": "dist/index.d.ts",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@remix-run/dev": "0.0.0-experimental-eab1c4d1e",
|
|
18
|
+
"@remix-run/route-config": "0.0.0-experimental-eab1c4d1e",
|
|
19
|
+
"typescript": "^5.1.6"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@remix-run/dev": "^0.0.0-experimental-eab1c4d1e",
|
|
23
|
+
"@remix-run/route-config": "^0.0.0-experimental-eab1c4d1e",
|
|
24
|
+
"typescript": "^5.1.0"
|
|
25
|
+
},
|
|
26
|
+
"peerDependenciesMeta": {
|
|
27
|
+
"typescript": {
|
|
28
|
+
"optional": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18.0.0"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist/",
|
|
36
|
+
"CHANGELOG.md",
|
|
37
|
+
"LICENSE.md",
|
|
38
|
+
"README.md"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"tsc": "tsc"
|
|
42
|
+
}
|
|
43
|
+
}
|