@sepveneto/plugin-mp-router-view 0.4.4 → 0.5.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.
@@ -1,38 +1,14 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- var __accessCheck = (obj, member, msg) => {
8
- if (!member.has(obj))
9
- throw TypeError("Cannot " + msg);
10
- };
11
- var __privateGet = (obj, member, getter) => {
12
- __accessCheck(obj, member, "read from private field");
13
- return getter ? getter.call(obj) : member.get(obj);
14
- };
15
- var __privateAdd = (obj, member, value) => {
16
- if (member.has(obj))
17
- throw TypeError("Cannot add the same private member more than once");
18
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
19
- };
20
- var __privateSet = (obj, member, value, setter) => {
21
- __accessCheck(obj, member, "write to private field");
22
- setter ? setter.call(obj, value) : member.set(obj, value);
23
- return value;
24
- };
25
- var __privateWrapper = (obj, member, setter, getter) => ({
26
- set _(value) {
27
- __privateSet(obj, member, value, setter);
28
- },
29
- get _() {
30
- return __privateGet(obj, member, getter);
31
- }
32
- });
1
+ import {
2
+ PAGE_META,
3
+ __privateAdd,
4
+ __privateGet,
5
+ __privateSet,
6
+ __privateWrapper,
7
+ __publicField
8
+ } from "./chunk-M3QQKYK3.js";
33
9
 
34
10
  // src/index.ts
35
- import path6 from "path";
11
+ import path7 from "path";
36
12
  import { createUnplugin } from "unplugin";
37
13
 
38
14
  // src/util/parse.ts
@@ -5555,17 +5531,17 @@ function withTrailingSlash(input = "", respectQueryAndFragment) {
5555
5531
  if (hasTrailingSlash(input, true)) {
5556
5532
  return input || "/";
5557
5533
  }
5558
- let path7 = input;
5534
+ let path8 = input;
5559
5535
  let fragment = "";
5560
5536
  const fragmentIndex = input.indexOf("#");
5561
5537
  if (fragmentIndex >= 0) {
5562
- path7 = input.slice(0, fragmentIndex);
5538
+ path8 = input.slice(0, fragmentIndex);
5563
5539
  fragment = input.slice(fragmentIndex);
5564
- if (!path7) {
5540
+ if (!path8) {
5565
5541
  return fragment;
5566
5542
  }
5567
5543
  }
5568
- const [s0, ...s] = path7.split("?");
5544
+ const [s0, ...s] = path8.split("?");
5569
5545
  return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
5570
5546
  }
5571
5547
  function isNonEmptyURL(url) {
@@ -5599,8 +5575,8 @@ import path3, { dirname as dirname2 } from "path";
5599
5575
  import v8 from "v8";
5600
5576
  import { format as format2, inspect } from "util";
5601
5577
  var BUILTIN_MODULES = new Set(builtinModules);
5602
- function normalizeSlash(path7) {
5603
- return path7.replace(/\\/g, "/");
5578
+ function normalizeSlash(path8) {
5579
+ return path8.replace(/\\/g, "/");
5604
5580
  }
5605
5581
  var own$1 = {}.hasOwnProperty;
5606
5582
  var classRegExp = /^([A-Z][a-z\d]*)+$/;
@@ -5716,8 +5692,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
5716
5692
  * @param {string} [base]
5717
5693
  * @param {string} [message]
5718
5694
  */
5719
- (path7, base, message) => {
5720
- return `Invalid package config ${path7}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
5695
+ (path8, base, message) => {
5696
+ return `Invalid package config ${path8}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
5721
5697
  },
5722
5698
  Error
5723
5699
  );
@@ -5749,8 +5725,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
5749
5725
  * @param {string} base
5750
5726
  * @param {boolean} [exactUrl]
5751
5727
  */
5752
- (path7, base, exactUrl = false) => {
5753
- return `Cannot find ${exactUrl ? "module" : "package"} '${path7}' imported from ${base}`;
5728
+ (path8, base, exactUrl = false) => {
5729
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path8}' imported from ${base}`;
5754
5730
  },
5755
5731
  Error
5756
5732
  );
@@ -5801,8 +5777,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
5801
5777
  * @param {string} extension
5802
5778
  * @param {string} path
5803
5779
  */
5804
- (extension, path7) => {
5805
- return `Unknown file extension "${extension}" for ${path7}`;
5780
+ (extension, path8) => {
5781
+ return `Unknown file extension "${extension}" for ${path8}`;
5806
5782
  },
5807
5783
  TypeError
5808
5784
  );
@@ -6182,9 +6158,9 @@ Default "index" lookups for the main are deprecated for ES modules.`,
6182
6158
  );
6183
6159
  }
6184
6160
  }
6185
- function tryStatSync(path7) {
6161
+ function tryStatSync(path8) {
6186
6162
  try {
6187
- return statSync(path7);
6163
+ return statSync(path8);
6188
6164
  } catch (e) {
6189
6165
  }
6190
6166
  }
@@ -7038,10 +7014,10 @@ _head = new WeakMap();
7038
7014
  _tail = new WeakMap();
7039
7015
  _size = new WeakMap();
7040
7016
  var findUpStop = Symbol("findUpStop");
7041
- function _resolve2(path7, options = {}) {
7017
+ function _resolve2(path8, options = {}) {
7042
7018
  if (options.platform === "auto" || !options.platform)
7043
7019
  options.platform = process2.platform === "win32" ? "win32" : "posix";
7044
- const modulePath = resolvePathSync(path7, {
7020
+ const modulePath = resolvePathSync(path8, {
7045
7021
  url: options.paths
7046
7022
  });
7047
7023
  if (options.platform === "win32")
@@ -7142,12 +7118,13 @@ function addToHeader(code, header2) {
7142
7118
  function addToFooter(code, footer2) {
7143
7119
  return code.replace(/(\s*)(<\/template>)(?!(([\s\S]*)(<\/template>)))/, (p) => footer2 + p);
7144
7120
  }
7121
+ var pageMap = /* @__PURE__ */ new Map();
7145
7122
  function getPages(collectMode) {
7146
7123
  const jsonStr = fs3.readFileSync(path5.resolve(INPUT_DIR, "pages.json"), "utf-8");
7147
7124
  const pagesJson = parseJson(jsonStr);
7148
7125
  const { pages, subPackages = [] } = pagesJson;
7149
7126
  const entryList = [...collectEntry(collectMode, pages), ...collectEntry(collectMode, subPackages)];
7150
- return entryList;
7127
+ return { entryList, pageMap };
7151
7128
  }
7152
7129
  function collectEntry(collectMode, json, root = "") {
7153
7130
  const entryList = [];
@@ -7160,6 +7137,7 @@ function collectEntry(collectMode, json, root = "") {
7160
7137
  return;
7161
7138
  }
7162
7139
  const _path = path5.resolve(INPUT_DIR, `${root}${root ? "/" : ""}${item.path}`);
7140
+ pageMap.set(_path, item);
7163
7141
  if (collectMode && typeof collectMode === "boolean" && !item["ROUTER_VIEW_EXCLUDE"]) {
7164
7142
  entryList.push(_path);
7165
7143
  } else if (typeof collectMode === "string" && item[collectMode]) {
@@ -7179,9 +7157,9 @@ function combineCode(code, header2, footer2) {
7179
7157
  code = addToFooter(code, footer2);
7180
7158
  return code;
7181
7159
  }
7182
- function transform(path7, code, entryPages, level) {
7160
+ function transform(path8, code, entryPages, level) {
7183
7161
  logLevel = level;
7184
- if (isAppVue(path7)) {
7162
+ if (isAppVue(path8)) {
7185
7163
  log(`\u57FA\u4E8E\u5E73\u53F0${process.env.UNI_PLATFORM}, \u5904\u7406App.vue...`, logLevel);
7186
7164
  const { origin, tpl } = getTemplate(code);
7187
7165
  const { count, before, after } = countRouterView(tpl);
@@ -7193,28 +7171,50 @@ function transform(path7, code, entryPages, level) {
7193
7171
  header = before;
7194
7172
  footer = after;
7195
7173
  return origin;
7196
- } else if (isEntryPage(path7, entryPages)) {
7197
- log(`\u5904\u7406 ${path7} ...`, logLevel);
7174
+ } else if (isEntryPage(path8, entryPages)) {
7175
+ log(`\u5904\u7406 ${path8} ...`, logLevel);
7198
7176
  code = combineCode(code, header, footer);
7199
7177
  }
7200
7178
  return code;
7201
7179
  }
7202
7180
 
7181
+ // src/util/pagemeta.ts
7182
+ import path6 from "path";
7183
+ var scriptRegex = /<script\b[^>]*>/;
7184
+ function injectPageMeta(code, id, pageMap2) {
7185
+ const ext = path6.extname(id);
7186
+ const key = id.replace(new RegExp(`${ext}$`), "");
7187
+ const injection = `
7188
+ var __g =
7189
+ typeof globalThis !== 'undefined' ? globalThis :
7190
+ typeof self !== 'undefined' ? self :
7191
+ typeof window !== 'undefined' ? window :
7192
+ typeof global !== 'undefined' ? global :
7193
+ Function('return this')();
7194
+
7195
+ __g[Symbol.for('${PAGE_META}')] = ${JSON.stringify(pageMap2.get(key))}
7196
+ `;
7197
+ return code.replace(scriptRegex, (match) => match + injection);
7198
+ }
7199
+
7203
7200
  // src/index.ts
7204
7201
  var NAME = "unplugin-mp-router-view";
7205
7202
  var unpluginFactory = (options) => {
7206
7203
  var _a2, _b2;
7207
7204
  const log2 = (_a2 = options == null ? void 0 : options.log) != null ? _a2 : "error";
7208
- const entryPages = getPages((_b2 = options == null ? void 0 : options.collect) != null ? _b2 : true);
7205
+ const { entryList: entryPages, pageMap: pageMap2 } = getPages((_b2 = options == null ? void 0 : options.collect) != null ? _b2 : true);
7209
7206
  return {
7210
7207
  name: NAME,
7211
7208
  enforce: "pre",
7212
7209
  transformInclude(id) {
7213
- const _id = path6.resolve(id);
7210
+ const _id = path7.resolve(id);
7214
7211
  return isAppVue(_id) || isEntryPage(_id, entryPages);
7215
7212
  },
7216
7213
  transform(code, id) {
7217
- const res = transform(path6.resolve(id), code, entryPages, log2);
7214
+ let res = transform(path7.resolve(id), code, entryPages, log2);
7215
+ if (options == null ? void 0 : options.inject) {
7216
+ res = injectPageMeta(code, id, pageMap2);
7217
+ }
7218
7218
  return res;
7219
7219
  }
7220
7220
  };
@@ -7227,6 +7227,7 @@ export {
7227
7227
  isEntryPage,
7228
7228
  getPages,
7229
7229
  transform,
7230
+ injectPageMeta,
7230
7231
  NAME,
7231
7232
  unpluginFactory,
7232
7233
  unplugin,
@@ -0,0 +1,44 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ var __accessCheck = (obj, member, msg) => {
8
+ if (!member.has(obj))
9
+ throw TypeError("Cannot " + msg);
10
+ };
11
+ var __privateGet = (obj, member, getter) => {
12
+ __accessCheck(obj, member, "read from private field");
13
+ return getter ? getter.call(obj) : member.get(obj);
14
+ };
15
+ var __privateAdd = (obj, member, value) => {
16
+ if (member.has(obj))
17
+ throw TypeError("Cannot add the same private member more than once");
18
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
19
+ };
20
+ var __privateSet = (obj, member, value, setter) => {
21
+ __accessCheck(obj, member, "write to private field");
22
+ setter ? setter.call(obj, value) : member.set(obj, value);
23
+ return value;
24
+ };
25
+ var __privateWrapper = (obj, member, setter, getter) => ({
26
+ set _(value) {
27
+ __privateSet(obj, member, value, setter);
28
+ },
29
+ get _() {
30
+ return __privateGet(obj, member, getter);
31
+ }
32
+ });
33
+
34
+ // src/util/constant.ts
35
+ var PAGE_META = "$$__PageMeta";
36
+
37
+ export {
38
+ __publicField,
39
+ __privateGet,
40
+ __privateAdd,
41
+ __privateSet,
42
+ __privateWrapper,
43
+ PAGE_META
44
+ };
package/dist/esbuild.cjs CHANGED
@@ -67,7 +67,7 @@ module.exports = __toCommonJS(esbuild_exports);
67
67
  var import_unplugin2 = require("unplugin");
68
68
 
69
69
  // src/index.ts
70
- var import_node_path4 = __toESM(require("path"), 1);
70
+ var import_node_path5 = __toESM(require("path"), 1);
71
71
  var import_unplugin = require("unplugin");
72
72
 
73
73
  // src/util/parse.ts
@@ -5591,17 +5591,17 @@ function withTrailingSlash(input = "", respectQueryAndFragment) {
5591
5591
  if (hasTrailingSlash(input, true)) {
5592
5592
  return input || "/";
5593
5593
  }
5594
- let path7 = input;
5594
+ let path8 = input;
5595
5595
  let fragment = "";
5596
5596
  const fragmentIndex = input.indexOf("#");
5597
5597
  if (fragmentIndex >= 0) {
5598
- path7 = input.slice(0, fragmentIndex);
5598
+ path8 = input.slice(0, fragmentIndex);
5599
5599
  fragment = input.slice(fragmentIndex);
5600
- if (!path7) {
5600
+ if (!path8) {
5601
5601
  return fragment;
5602
5602
  }
5603
5603
  }
5604
- const [s0, ...s] = path7.split("?");
5604
+ const [s0, ...s] = path8.split("?");
5605
5605
  return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
5606
5606
  }
5607
5607
  function isNonEmptyURL(url) {
@@ -5635,8 +5635,8 @@ var import_node_path = __toESM(require("path"), 1);
5635
5635
  var import_node_v8 = __toESM(require("v8"), 1);
5636
5636
  var import_node_util = require("util");
5637
5637
  var BUILTIN_MODULES = new Set(import_node_module.builtinModules);
5638
- function normalizeSlash(path7) {
5639
- return path7.replace(/\\/g, "/");
5638
+ function normalizeSlash(path8) {
5639
+ return path8.replace(/\\/g, "/");
5640
5640
  }
5641
5641
  var own$1 = {}.hasOwnProperty;
5642
5642
  var classRegExp = /^([A-Z][a-z\d]*)+$/;
@@ -5752,8 +5752,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
5752
5752
  * @param {string} [base]
5753
5753
  * @param {string} [message]
5754
5754
  */
5755
- (path7, base, message) => {
5756
- return `Invalid package config ${path7}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
5755
+ (path8, base, message) => {
5756
+ return `Invalid package config ${path8}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
5757
5757
  },
5758
5758
  Error
5759
5759
  );
@@ -5785,8 +5785,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
5785
5785
  * @param {string} base
5786
5786
  * @param {boolean} [exactUrl]
5787
5787
  */
5788
- (path7, base, exactUrl = false) => {
5789
- return `Cannot find ${exactUrl ? "module" : "package"} '${path7}' imported from ${base}`;
5788
+ (path8, base, exactUrl = false) => {
5789
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path8}' imported from ${base}`;
5790
5790
  },
5791
5791
  Error
5792
5792
  );
@@ -5837,8 +5837,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
5837
5837
  * @param {string} extension
5838
5838
  * @param {string} path
5839
5839
  */
5840
- (extension, path7) => {
5841
- return `Unknown file extension "${extension}" for ${path7}`;
5840
+ (extension, path8) => {
5841
+ return `Unknown file extension "${extension}" for ${path8}`;
5842
5842
  },
5843
5843
  TypeError
5844
5844
  );
@@ -6218,9 +6218,9 @@ Default "index" lookups for the main are deprecated for ES modules.`,
6218
6218
  );
6219
6219
  }
6220
6220
  }
6221
- function tryStatSync(path7) {
6221
+ function tryStatSync(path8) {
6222
6222
  try {
6223
- return (0, import_node_fs.statSync)(path7);
6223
+ return (0, import_node_fs.statSync)(path8);
6224
6224
  } catch (e) {
6225
6225
  }
6226
6226
  }
@@ -7075,10 +7075,10 @@ _head = new WeakMap();
7075
7075
  _tail = new WeakMap();
7076
7076
  _size = new WeakMap();
7077
7077
  var findUpStop = Symbol("findUpStop");
7078
- function _resolve2(path7, options = {}) {
7078
+ function _resolve2(path8, options = {}) {
7079
7079
  if (options.platform === "auto" || !options.platform)
7080
7080
  options.platform = import_node_process2.default.platform === "win32" ? "win32" : "posix";
7081
- const modulePath = resolvePathSync(path7, {
7081
+ const modulePath = resolvePathSync(path8, {
7082
7082
  url: options.paths
7083
7083
  });
7084
7084
  if (options.platform === "win32")
@@ -7179,12 +7179,13 @@ function addToHeader(code, header2) {
7179
7179
  function addToFooter(code, footer2) {
7180
7180
  return code.replace(/(\s*)(<\/template>)(?!(([\s\S]*)(<\/template>)))/, (p) => footer2 + p);
7181
7181
  }
7182
+ var pageMap = /* @__PURE__ */ new Map();
7182
7183
  function getPages(collectMode) {
7183
7184
  const jsonStr = import_node_fs3.default.readFileSync(import_node_path3.default.resolve(INPUT_DIR, "pages.json"), "utf-8");
7184
7185
  const pagesJson = parseJson(jsonStr);
7185
7186
  const { pages, subPackages = [] } = pagesJson;
7186
7187
  const entryList = [...collectEntry(collectMode, pages), ...collectEntry(collectMode, subPackages)];
7187
- return entryList;
7188
+ return { entryList, pageMap };
7188
7189
  }
7189
7190
  function collectEntry(collectMode, json, root = "") {
7190
7191
  const entryList = [];
@@ -7197,6 +7198,7 @@ function collectEntry(collectMode, json, root = "") {
7197
7198
  return;
7198
7199
  }
7199
7200
  const _path = import_node_path3.default.resolve(INPUT_DIR, `${root}${root ? "/" : ""}${item.path}`);
7201
+ pageMap.set(_path, item);
7200
7202
  if (collectMode && typeof collectMode === "boolean" && !item["ROUTER_VIEW_EXCLUDE"]) {
7201
7203
  entryList.push(_path);
7202
7204
  } else if (typeof collectMode === "string" && item[collectMode]) {
@@ -7216,9 +7218,9 @@ function combineCode(code, header2, footer2) {
7216
7218
  code = addToFooter(code, footer2);
7217
7219
  return code;
7218
7220
  }
7219
- function transform(path7, code, entryPages, level) {
7221
+ function transform(path8, code, entryPages, level) {
7220
7222
  logLevel = level;
7221
- if (isAppVue(path7)) {
7223
+ if (isAppVue(path8)) {
7222
7224
  log(`\u57FA\u4E8E\u5E73\u53F0${process.env.UNI_PLATFORM}, \u5904\u7406App.vue...`, logLevel);
7223
7225
  const { origin, tpl } = getTemplate(code);
7224
7226
  const { count, before, after } = countRouterView(tpl);
@@ -7230,28 +7232,55 @@ function transform(path7, code, entryPages, level) {
7230
7232
  header = before;
7231
7233
  footer = after;
7232
7234
  return origin;
7233
- } else if (isEntryPage(path7, entryPages)) {
7234
- log(`\u5904\u7406 ${path7} ...`, logLevel);
7235
+ } else if (isEntryPage(path8, entryPages)) {
7236
+ log(`\u5904\u7406 ${path8} ...`, logLevel);
7235
7237
  code = combineCode(code, header, footer);
7236
7238
  }
7237
7239
  return code;
7238
7240
  }
7239
7241
 
7242
+ // src/util/pagemeta.ts
7243
+ var import_node_path4 = __toESM(require("path"), 1);
7244
+
7245
+ // src/util/constant.ts
7246
+ var PAGE_META = "$$__PageMeta";
7247
+
7248
+ // src/util/pagemeta.ts
7249
+ var scriptRegex = /<script\b[^>]*>/;
7250
+ function injectPageMeta(code, id, pageMap2) {
7251
+ const ext = import_node_path4.default.extname(id);
7252
+ const key = id.replace(new RegExp(`${ext}$`), "");
7253
+ const injection = `
7254
+ var __g =
7255
+ typeof globalThis !== 'undefined' ? globalThis :
7256
+ typeof self !== 'undefined' ? self :
7257
+ typeof window !== 'undefined' ? window :
7258
+ typeof global !== 'undefined' ? global :
7259
+ Function('return this')();
7260
+
7261
+ __g[Symbol.for('${PAGE_META}')] = ${JSON.stringify(pageMap2.get(key))}
7262
+ `;
7263
+ return code.replace(scriptRegex, (match) => match + injection);
7264
+ }
7265
+
7240
7266
  // src/index.ts
7241
7267
  var NAME = "unplugin-mp-router-view";
7242
7268
  var unpluginFactory = (options) => {
7243
7269
  var _a2, _b2;
7244
7270
  const log2 = (_a2 = options == null ? void 0 : options.log) != null ? _a2 : "error";
7245
- const entryPages = getPages((_b2 = options == null ? void 0 : options.collect) != null ? _b2 : true);
7271
+ const { entryList: entryPages, pageMap: pageMap2 } = getPages((_b2 = options == null ? void 0 : options.collect) != null ? _b2 : true);
7246
7272
  return {
7247
7273
  name: NAME,
7248
7274
  enforce: "pre",
7249
7275
  transformInclude(id) {
7250
- const _id = import_node_path4.default.resolve(id);
7276
+ const _id = import_node_path5.default.resolve(id);
7251
7277
  return isAppVue(_id) || isEntryPage(_id, entryPages);
7252
7278
  },
7253
7279
  transform(code, id) {
7254
- const res = transform(import_node_path4.default.resolve(id), code, entryPages, log2);
7280
+ let res = transform(import_node_path5.default.resolve(id), code, entryPages, log2);
7281
+ if (options == null ? void 0 : options.inject) {
7282
+ res = injectPageMeta(code, id, pageMap2);
7283
+ }
7255
7284
  return res;
7256
7285
  }
7257
7286
  };
package/dist/esbuild.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-UB2NVQE4.js";
3
+ } from "./chunk-34IBKFGI.js";
4
+ import "./chunk-M3QQKYK3.js";
4
5
 
5
6
  // src/esbuild.ts
6
7
  import { createEsbuildPlugin } from "unplugin";
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/helper/index.ts
21
+ var helper_exports = {};
22
+ __export(helper_exports, {
23
+ getPageMeta: () => getPageMeta
24
+ });
25
+ module.exports = __toCommonJS(helper_exports);
26
+
27
+ // src/util/constant.ts
28
+ var PAGE_META = "$$__PageMeta";
29
+
30
+ // src/helper/index.ts
31
+ function getPageMeta() {
32
+ var __g = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : (
33
+ // @ts-expect-error: ignore
34
+ typeof global !== "undefined" ? global : Function("return this")()
35
+ );
36
+ const meta = __g[Symbol.for(PAGE_META)];
37
+ if (!meta) {
38
+ throw new Error("[RouterView]: Page meta not found, maybe you forget to inject page meta?");
39
+ }
40
+ return meta;
41
+ }
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ getPageMeta
45
+ });
@@ -0,0 +1,5 @@
1
+ import { Page } from '../type.d.js';
2
+
3
+ declare function getPageMeta(): Page;
4
+
5
+ export { getPageMeta };
@@ -0,0 +1,19 @@
1
+ import {
2
+ PAGE_META
3
+ } from "../chunk-M3QQKYK3.js";
4
+
5
+ // src/helper/index.ts
6
+ function getPageMeta() {
7
+ var __g = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : (
8
+ // @ts-expect-error: ignore
9
+ typeof global !== "undefined" ? global : Function("return this")()
10
+ );
11
+ const meta = __g[Symbol.for(PAGE_META)];
12
+ if (!meta) {
13
+ throw new Error("[RouterView]: Page meta not found, maybe you forget to inject page meta?");
14
+ }
15
+ return meta;
16
+ }
17
+ export {
18
+ getPageMeta
19
+ };