@granite-js/plugin-router 0.1.33 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,276 +1,12 @@
1
1
  # @granite-js/plugin-router
2
2
 
3
- ## 0.1.33
3
+ ## 1.0.0
4
4
 
5
- ### Patch Changes
6
-
7
- - @granite-js/plugin-core@0.1.33
8
-
9
- ## 0.1.32
10
-
11
- ### Patch Changes
12
-
13
- - 7572713: bump version up babel
14
- - Updated dependencies [7572713]
15
- - @granite-js/plugin-core@0.1.32
16
-
17
- ## 0.1.31
18
-
19
- ### Patch Changes
20
-
21
- - 37ae3f3: feat(router): supports standard schema
22
- - Updated dependencies [9bf8b50]
23
- - Updated dependencies [e957833]
24
- - @granite-js/plugin-core@0.1.31
25
-
26
- ## 0.1.30
27
-
28
- ### Patch Changes
29
-
30
- - @granite-js/plugin-core@0.1.30
31
-
32
- ## 0.1.29
33
-
34
- ### Patch Changes
35
-
36
- - Updated dependencies [ed4cdbf]
37
- - @granite-js/plugin-core@0.1.29
38
-
39
- ## 0.1.28
40
-
41
- ### Patch Changes
42
-
43
- - 1d958cc: ci: provenance
44
- - Updated dependencies [1d958cc]
45
- - @granite-js/plugin-core@0.1.28
46
-
47
- ## 0.1.27
48
-
49
- ### Patch Changes
50
-
51
- - e32b020: ci: oidc
52
- - Updated dependencies [e32b020]
53
- - @granite-js/plugin-core@0.1.27
54
-
55
- ## 0.1.26
56
-
57
- ### Patch Changes
58
-
59
- - @granite-js/plugin-core@0.1.26
60
-
61
- ## 0.1.25
62
-
63
- ### Patch Changes
64
-
65
- - @granite-js/plugin-core@0.1.25
66
-
67
- ## 0.1.24
68
-
69
- ### Patch Changes
70
-
71
- - Updated dependencies [6e42c3d]
72
- - @granite-js/plugin-core@0.1.24
73
-
74
- ## 0.1.23
75
-
76
- ### Patch Changes
77
-
78
- - @granite-js/plugin-core@0.1.23
79
-
80
- ## 0.1.22
81
-
82
- ### Patch Changes
83
-
84
- - @granite-js/plugin-core@0.1.22
85
-
86
- ## 0.1.21
87
-
88
- ### Patch Changes
89
-
90
- - @granite-js/plugin-core@0.1.21
91
-
92
- ## 0.1.20
93
-
94
- ### Patch Changes
95
-
96
- - @granite-js/plugin-core@0.1.20
97
-
98
- ## 0.1.19
99
-
100
- ### Patch Changes
101
-
102
- - Updated dependencies [e9a3daf]
103
- - @granite-js/plugin-core@0.1.19
104
-
105
- ## 0.1.18
106
-
107
- ### Patch Changes
108
-
109
- - @granite-js/plugin-core@0.1.18
110
-
111
- ## 0.1.17
112
-
113
- ### Patch Changes
114
-
115
- - Updated dependencies [9c415df]
116
- - @granite-js/plugin-core@0.1.17
117
-
118
- ## 0.1.16
119
-
120
- ### Patch Changes
121
-
122
- - @granite-js/plugin-core@0.1.16
123
-
124
- ## 0.1.15
125
-
126
- ### Patch Changes
127
-
128
- - d16ee87: Add useInitialProps, useInitialSearchParams hook.
129
- - Updated dependencies [d16ee87]
130
- - @granite-js/plugin-core@0.1.15
131
-
132
- ## 0.1.14
133
-
134
- ### Patch Changes
135
-
136
- - @granite-js/plugin-core@0.1.14
137
-
138
- ## 0.1.13
139
-
140
- ### Patch Changes
141
-
142
- - @granite-js/plugin-core@0.1.13
143
-
144
- ## 0.1.12
145
-
146
- ### Patch Changes
147
-
148
- - d1e6585: fix module resolutions
149
- - Updated dependencies [d1e6585]
150
- - Updated dependencies [1e99fe1]
151
- - @granite-js/plugin-core@0.1.12
152
-
153
- ## 0.1.11
154
-
155
- ### Patch Changes
156
-
157
- - Updated dependencies [d3a2b58]
158
- - @granite-js/plugin-core@0.1.11
159
-
160
- ## 0.1.10
161
-
162
- ### Patch Changes
163
-
164
- - Updated dependencies [9438be5]
165
- - @granite-js/plugin-core@0.1.10
166
-
167
- ## 0.1.9
168
-
169
- ### Patch Changes
170
-
171
- - Updated dependencies [935bb36]
172
- - @granite-js/plugin-core@0.1.9
173
-
174
- ## 0.1.8
175
-
176
- ### Patch Changes
177
-
178
- - Updated dependencies [b69366c]
179
- - @granite-js/plugin-core@0.1.8
180
-
181
- ## 0.1.7
182
-
183
- ### Patch Changes
184
-
185
- - @granite-js/plugin-core@0.1.7
186
-
187
- ## 0.1.6
188
-
189
- ### Patch Changes
190
-
191
- - @granite-js/plugin-core@0.1.6
192
-
193
- ## 0.1.5
194
-
195
- ### Patch Changes
196
-
197
- - @granite-js/plugin-core@0.1.5
198
-
199
- ## 0.1.4
200
-
201
- ### Patch Changes
202
-
203
- - @granite-js/plugin-core@0.1.4
204
-
205
- ## 0.1.3
206
-
207
- ### Patch Changes
208
-
209
- - @granite-js/plugin-core@0.1.3
210
-
211
- ## 0.1.2
212
-
213
- ### Patch Changes
214
-
215
- - @granite-js/plugin-core@0.1.2
216
-
217
- ## 0.1.1
218
-
219
- ### Patch Changes
220
-
221
- - d675415: Improve scaffolding to provide a better showcase UI
222
- - 10a5f3f: empty
223
- - Updated dependencies [d675415]
224
- - Updated dependencies [10a5f3f]
225
- - @granite-js/plugin-core@0.1.1
226
-
227
- ## 0.1.0
228
-
229
- ### Minor Changes
230
-
231
- - 561a3ed: fix: docs deadlink
232
-
233
- ### Patch Changes
234
-
235
- - Updated dependencies [561a3ed]
236
- - @granite-js/plugin-core@0.1.0
237
-
238
- ## 0.0.3
239
-
240
- ### Patch Changes
241
-
242
- - ed4d356: changeset
243
- - Updated dependencies [ed4d356]
244
- - @granite-js/plugin-core@0.0.3
245
-
246
- ## 0.0.2
247
-
248
- ### Patch Changes
249
-
250
- - 0ae09b7: deploy guide
251
- - 0ae09b7: type fix
252
- - 0ae09b7: guide
253
- - 0ae09b7: fix comment
254
- - 0ae09b7: showcase
255
- - 0ae09b7: refactor interface names
256
- - 0ae09b7: plugin-router
257
- - 0ae09b7: CanGoBackGuard 수정, typecheck fix, lint fix
258
- - 0ae09b7: counter
259
- - 0ae09b7: licenses
260
- - Updated dependencies [0ae09b7]
261
- - Updated dependencies [0ae09b7]
262
- - Updated dependencies [0ae09b7]
263
- - Updated dependencies [0ae09b7]
264
- - Updated dependencies [0ae09b7]
265
- - Updated dependencies [0ae09b7]
266
- - Updated dependencies [0ae09b7]
267
- - Updated dependencies [0ae09b7]
268
- - Updated dependencies [0ae09b7]
269
- - Updated dependencies [0ae09b7]
270
- - @granite-js/plugin-core@0.0.2
5
+ ### Major Changes
271
6
 
272
- ## 0.0.1
7
+ - 260daab: feat: introduce support react native 0.84
273
8
 
274
9
  ### Patch Changes
275
10
 
276
- - f47ca39: first release
11
+ - Updated dependencies [260daab]
12
+ - @granite-js/plugin-core@1.0.0
package/dist/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
- //#region rolldown:runtime
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -6,12 +7,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
9
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
15
20
  }
16
21
  return to;
17
22
  };
@@ -23,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
28
  //#endregion
24
29
  let fs = require("fs");
25
30
  let path = require("path");
26
- let __swc_core = require("@swc/core");
31
+ let _swc_core = require("@swc/core");
27
32
  let es_toolkit = require("es-toolkit");
28
33
  let fs_promises = require("fs/promises");
29
34
  let chokidar = require("chokidar");
@@ -33,9 +38,9 @@ chokidar = __toESM(chokidar);
33
38
  /**
34
39
  * Checks if Route is exported from the file.
35
40
  */
36
- function checkExportRoute(path$1) {
41
+ function checkExportRoute(path) {
37
42
  try {
38
- const ast = (0, __swc_core.parseFileSync)(path$1, {
43
+ const ast = (0, _swc_core.parseFileSync)(path, {
39
44
  syntax: "typescript",
40
45
  tsx: true
41
46
  });
@@ -67,10 +72,10 @@ function getComponentName(filePath) {
67
72
  //#endregion
68
73
  //#region src/getPath.ts
69
74
  function getPath(filePath) {
70
- let path$1 = filePath.replace(/^pages\//, "").replace(/\.[^/.]+$/, "");
71
- if (path$1.endsWith("/index")) path$1 = path$1.replace(/\/index$/, "");
72
- else if (path$1 === "index") path$1 = "";
73
- return `/${path$1}`;
75
+ let path = filePath.replace(/^pages\//, "").replace(/\.[^/.]+$/, "");
76
+ if (path.endsWith("/index")) path = path.replace(/\/index$/, "");
77
+ else if (path === "index") path = "";
78
+ return `/${path}`;
74
79
  }
75
80
 
76
81
  //#endregion
@@ -198,14 +203,14 @@ function getPageName(filePath) {
198
203
 
199
204
  //#endregion
200
205
  //#region src/transformNewRouteFile.ts
201
- async function transformNewRouteFile(path$1) {
206
+ async function transformNewRouteFile(path) {
202
207
  return transformTemplate(NEW_ROUTE_FILE_TEMPLATE, {
203
- path: getPath(path$1),
204
- componentName: getComponentName(path$1)
208
+ path: getPath(path),
209
+ componentName: getComponentName(path)
205
210
  });
206
211
  }
207
- async function transformNewLayoutFile(path$1) {
208
- return transformTemplate(NEW_LAYOUT_FILE_TEMPLATE, { componentName: getPageName(path$1) });
212
+ async function transformNewLayoutFile(path) {
213
+ return transformTemplate(NEW_LAYOUT_FILE_TEMPLATE, { componentName: getPageName(path) });
209
214
  }
210
215
 
211
216
  //#endregion
@@ -219,13 +224,13 @@ function watchRouter() {
219
224
  persistent: true,
220
225
  cwd: process.cwd()
221
226
  });
222
- const handleAdd = async (path$1) => {
223
- if (await (0, fs_promises.readFile)((0, path.join)(process.cwd(), path$1), "utf8") !== "") return;
224
- const filename = (0, path.parse)(path$1).name;
227
+ const handleAdd = async (path$2) => {
228
+ if (await (0, fs_promises.readFile)((0, path.join)(process.cwd(), path$2), "utf8") !== "") return;
229
+ const filename = (0, path.parse)(path$2).name;
225
230
  if (filename.startsWith("_")) switch (filename) {
226
231
  case "_layout":
227
232
  console.log("👀 Layout file has been added");
228
- await (0, fs_promises.writeFile)(path$1, await transformNewLayoutFile(path$1));
233
+ await (0, fs_promises.writeFile)(path$2, await transformNewLayoutFile(path$2));
229
234
  return;
230
235
  default: return;
231
236
  }
@@ -234,8 +239,8 @@ function watchRouter() {
234
239
  console.log(`❌ File name should be in kebab-case format. Would you like to rename ${filename} to ${componentName}?`);
235
240
  return;
236
241
  }
237
- console.log(`👀 File ${path$1} has been added`);
238
- await (0, fs_promises.writeFile)(path$1, await transformNewRouteFile(path$1));
242
+ console.log(`👀 File ${path$2} has been added`);
243
+ await (0, fs_promises.writeFile)(path$2, await transformNewRouteFile(path$2));
239
244
  await generateRouterFile();
240
245
  };
241
246
  watcher.on("add", handleAdd);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@granite-js/plugin-router",
3
3
  "type": "module",
4
- "version": "0.1.33",
4
+ "version": "1.0.0",
5
5
  "description": "A Route Generator for Granite project",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
@@ -34,15 +34,15 @@
34
34
  "dist"
35
35
  ],
36
36
  "devDependencies": {
37
- "@types/node": "^22.10.2",
37
+ "@types/node": "24.10.12",
38
38
  "@vitest/coverage-v8": "^4.0.12",
39
- "tsdown": "^0.16.5",
40
- "typescript": "5.8.3",
39
+ "tsdown": "0.20.3",
40
+ "typescript": "5.9.3",
41
41
  "vitest": "^4.0.12"
42
42
  },
43
43
  "dependencies": {
44
- "@granite-js/plugin-core": "0.1.33",
45
- "@swc/core": "1.5.24",
44
+ "@granite-js/plugin-core": "1.0.0",
45
+ "@swc/core": "1.15.8",
46
46
  "chokidar": "4.0.1",
47
47
  "es-toolkit": "^1.39.8"
48
48
  },