@granite-js/plugin-router 0.1.34 → 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,284 +1,12 @@
1
1
  # @granite-js/plugin-router
2
2
 
3
- ## 0.1.34
3
+ ## 1.0.0
4
4
 
5
- ### Patch Changes
6
-
7
- - 9c39997: bump version up `@swc/core`
8
- - Updated dependencies [9c39997]
9
- - @granite-js/plugin-core@0.1.34
10
-
11
- ## 0.1.33
12
-
13
- ### Patch Changes
14
-
15
- - @granite-js/plugin-core@0.1.33
16
-
17
- ## 0.1.32
18
-
19
- ### Patch Changes
20
-
21
- - 7572713: bump version up babel
22
- - Updated dependencies [7572713]
23
- - @granite-js/plugin-core@0.1.32
24
-
25
- ## 0.1.31
26
-
27
- ### Patch Changes
28
-
29
- - 37ae3f3: feat(router): supports standard schema
30
- - Updated dependencies [9bf8b50]
31
- - Updated dependencies [e957833]
32
- - @granite-js/plugin-core@0.1.31
33
-
34
- ## 0.1.30
35
-
36
- ### Patch Changes
37
-
38
- - @granite-js/plugin-core@0.1.30
39
-
40
- ## 0.1.29
41
-
42
- ### Patch Changes
43
-
44
- - Updated dependencies [ed4cdbf]
45
- - @granite-js/plugin-core@0.1.29
46
-
47
- ## 0.1.28
48
-
49
- ### Patch Changes
50
-
51
- - 1d958cc: ci: provenance
52
- - Updated dependencies [1d958cc]
53
- - @granite-js/plugin-core@0.1.28
54
-
55
- ## 0.1.27
56
-
57
- ### Patch Changes
58
-
59
- - e32b020: ci: oidc
60
- - Updated dependencies [e32b020]
61
- - @granite-js/plugin-core@0.1.27
62
-
63
- ## 0.1.26
64
-
65
- ### Patch Changes
66
-
67
- - @granite-js/plugin-core@0.1.26
68
-
69
- ## 0.1.25
70
-
71
- ### Patch Changes
72
-
73
- - @granite-js/plugin-core@0.1.25
74
-
75
- ## 0.1.24
76
-
77
- ### Patch Changes
78
-
79
- - Updated dependencies [6e42c3d]
80
- - @granite-js/plugin-core@0.1.24
81
-
82
- ## 0.1.23
83
-
84
- ### Patch Changes
85
-
86
- - @granite-js/plugin-core@0.1.23
87
-
88
- ## 0.1.22
89
-
90
- ### Patch Changes
91
-
92
- - @granite-js/plugin-core@0.1.22
93
-
94
- ## 0.1.21
95
-
96
- ### Patch Changes
97
-
98
- - @granite-js/plugin-core@0.1.21
99
-
100
- ## 0.1.20
101
-
102
- ### Patch Changes
103
-
104
- - @granite-js/plugin-core@0.1.20
105
-
106
- ## 0.1.19
107
-
108
- ### Patch Changes
109
-
110
- - Updated dependencies [e9a3daf]
111
- - @granite-js/plugin-core@0.1.19
112
-
113
- ## 0.1.18
114
-
115
- ### Patch Changes
116
-
117
- - @granite-js/plugin-core@0.1.18
118
-
119
- ## 0.1.17
120
-
121
- ### Patch Changes
122
-
123
- - Updated dependencies [9c415df]
124
- - @granite-js/plugin-core@0.1.17
125
-
126
- ## 0.1.16
127
-
128
- ### Patch Changes
129
-
130
- - @granite-js/plugin-core@0.1.16
131
-
132
- ## 0.1.15
133
-
134
- ### Patch Changes
135
-
136
- - d16ee87: Add useInitialProps, useInitialSearchParams hook.
137
- - Updated dependencies [d16ee87]
138
- - @granite-js/plugin-core@0.1.15
139
-
140
- ## 0.1.14
141
-
142
- ### Patch Changes
143
-
144
- - @granite-js/plugin-core@0.1.14
145
-
146
- ## 0.1.13
147
-
148
- ### Patch Changes
149
-
150
- - @granite-js/plugin-core@0.1.13
151
-
152
- ## 0.1.12
153
-
154
- ### Patch Changes
155
-
156
- - d1e6585: fix module resolutions
157
- - Updated dependencies [d1e6585]
158
- - Updated dependencies [1e99fe1]
159
- - @granite-js/plugin-core@0.1.12
160
-
161
- ## 0.1.11
162
-
163
- ### Patch Changes
164
-
165
- - Updated dependencies [d3a2b58]
166
- - @granite-js/plugin-core@0.1.11
167
-
168
- ## 0.1.10
169
-
170
- ### Patch Changes
171
-
172
- - Updated dependencies [9438be5]
173
- - @granite-js/plugin-core@0.1.10
174
-
175
- ## 0.1.9
176
-
177
- ### Patch Changes
178
-
179
- - Updated dependencies [935bb36]
180
- - @granite-js/plugin-core@0.1.9
181
-
182
- ## 0.1.8
183
-
184
- ### Patch Changes
185
-
186
- - Updated dependencies [b69366c]
187
- - @granite-js/plugin-core@0.1.8
188
-
189
- ## 0.1.7
190
-
191
- ### Patch Changes
192
-
193
- - @granite-js/plugin-core@0.1.7
194
-
195
- ## 0.1.6
196
-
197
- ### Patch Changes
198
-
199
- - @granite-js/plugin-core@0.1.6
200
-
201
- ## 0.1.5
202
-
203
- ### Patch Changes
204
-
205
- - @granite-js/plugin-core@0.1.5
206
-
207
- ## 0.1.4
208
-
209
- ### Patch Changes
210
-
211
- - @granite-js/plugin-core@0.1.4
212
-
213
- ## 0.1.3
214
-
215
- ### Patch Changes
216
-
217
- - @granite-js/plugin-core@0.1.3
218
-
219
- ## 0.1.2
220
-
221
- ### Patch Changes
222
-
223
- - @granite-js/plugin-core@0.1.2
224
-
225
- ## 0.1.1
226
-
227
- ### Patch Changes
228
-
229
- - d675415: Improve scaffolding to provide a better showcase UI
230
- - 10a5f3f: empty
231
- - Updated dependencies [d675415]
232
- - Updated dependencies [10a5f3f]
233
- - @granite-js/plugin-core@0.1.1
234
-
235
- ## 0.1.0
236
-
237
- ### Minor Changes
238
-
239
- - 561a3ed: fix: docs deadlink
240
-
241
- ### Patch Changes
242
-
243
- - Updated dependencies [561a3ed]
244
- - @granite-js/plugin-core@0.1.0
245
-
246
- ## 0.0.3
247
-
248
- ### Patch Changes
249
-
250
- - ed4d356: changeset
251
- - Updated dependencies [ed4d356]
252
- - @granite-js/plugin-core@0.0.3
253
-
254
- ## 0.0.2
255
-
256
- ### Patch Changes
257
-
258
- - 0ae09b7: deploy guide
259
- - 0ae09b7: type fix
260
- - 0ae09b7: guide
261
- - 0ae09b7: fix comment
262
- - 0ae09b7: showcase
263
- - 0ae09b7: refactor interface names
264
- - 0ae09b7: plugin-router
265
- - 0ae09b7: CanGoBackGuard 수정, typecheck fix, lint fix
266
- - 0ae09b7: counter
267
- - 0ae09b7: licenses
268
- - Updated dependencies [0ae09b7]
269
- - Updated dependencies [0ae09b7]
270
- - Updated dependencies [0ae09b7]
271
- - Updated dependencies [0ae09b7]
272
- - Updated dependencies [0ae09b7]
273
- - Updated dependencies [0ae09b7]
274
- - Updated dependencies [0ae09b7]
275
- - Updated dependencies [0ae09b7]
276
- - Updated dependencies [0ae09b7]
277
- - Updated dependencies [0ae09b7]
278
- - @granite-js/plugin-core@0.0.2
5
+ ### Major Changes
279
6
 
280
- ## 0.0.1
7
+ - 260daab: feat: introduce support react native 0.84
281
8
 
282
9
  ### Patch Changes
283
10
 
284
- - 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.34",
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.34",
45
- "@swc/core": "^1.15.8",
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
  },