@next-core/runtime 1.17.3 → 1.17.4

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.
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createHistory = createHistory;
7
7
  exports.getHistory = getHistory;
8
- var _history = require("history");
8
+ var _history2 = require("history");
9
9
  var _getBasePath = require("./getBasePath.js");
10
10
  var _historyExtended = require("./internal/historyExtended.js");
11
11
  let history;
12
12
  function createHistory() {
13
13
  if (!history) {
14
14
  // https://github.com/remix-run/history/issues/810
15
- const browserHistory = (0, _history.createBrowserHistory)({
15
+ const browserHistory = (0, _history2.createBrowserHistory)({
16
16
  basename: (0, _getBasePath.getBasePath)().replace(/\/$/, ""),
17
17
  getUserConfirmation: _historyExtended.getUserConfirmation
18
18
  });
@@ -22,6 +22,20 @@ function createHistory() {
22
22
  return history;
23
23
  }
24
24
  function getHistory() {
25
- return history;
25
+ var _history;
26
+ return (_history = history) !== null && _history !== void 0 ? _history : getV2History();
27
+ }
28
+
29
+ /**
30
+ * When using v3 bricks in v2 runtime, return history from v2 runtime.
31
+ */
32
+ function getV2History() {
33
+ const {
34
+ dll
35
+ } = window;
36
+ if (typeof dll === "function") {
37
+ const LegacyBrickKit = dll("tYg3");
38
+ return LegacyBrickKit.getHistory();
39
+ }
26
40
  }
27
41
  //# sourceMappingURL=history.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","names":["_history","require","_getBasePath","_historyExtended","history","createHistory","browserHistory","createBrowserHistory","basename","getBasePath","replace","getUserConfirmation","Object","assign","historyExtended","getHistory"],"sources":["../../src/history.ts"],"sourcesContent":["import { History, Location, createBrowserHistory } from \"history\";\nimport { getBasePath } from \"./getBasePath.js\";\nimport {\n type ExtendedHistory,\n getUserConfirmation,\n historyExtended,\n NextHistoryState,\n} from \"./internal/historyExtended.js\";\n\nexport type NextHistory = History<NextHistoryState> & ExtendedHistory;\n\nlet history: NextHistory;\n\nexport function createHistory(): NextHistory {\n if (!history) {\n // https://github.com/remix-run/history/issues/810\n const browserHistory = createBrowserHistory<NextHistoryState>({\n basename: getBasePath().replace(/\\/$/, \"\"),\n getUserConfirmation,\n });\n Object.assign(browserHistory, historyExtended(browserHistory));\n history = browserHistory as NextHistory;\n }\n return history;\n}\n\nexport function getHistory(): NextHistory {\n return history;\n}\n\nexport type NextLocation = Location<NextHistoryState>;\n\nexport type { NextHistoryState };\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AASA,IAAIG,OAAoB;AAEjB,SAASC,aAAaA,CAAA,EAAgB;EAC3C,IAAI,CAACD,OAAO,EAAE;IACZ;IACA,MAAME,cAAc,GAAG,IAAAC,6BAAoB,EAAmB;MAC5DC,QAAQ,EAAE,IAAAC,wBAAW,EAAC,CAAC,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;MAC1CC,mBAAmB,EAAnBA;IACF,CAAC,CAAC;IACFC,MAAM,CAACC,MAAM,CAACP,cAAc,EAAE,IAAAQ,gCAAe,EAACR,cAAc,CAAC,CAAC;IAC9DF,OAAO,GAAGE,cAA6B;EACzC;EACA,OAAOF,OAAO;AAChB;AAEO,SAASW,UAAUA,CAAA,EAAgB;EACxC,OAAOX,OAAO;AAChB"}
1
+ {"version":3,"file":"history.js","names":["_history2","require","_getBasePath","_historyExtended","history","createHistory","browserHistory","createBrowserHistory","basename","getBasePath","replace","getUserConfirmation","Object","assign","historyExtended","getHistory","_history","getV2History","dll","window","LegacyBrickKit"],"sources":["../../src/history.ts"],"sourcesContent":["import { History, Location, createBrowserHistory } from \"history\";\nimport { getBasePath } from \"./getBasePath.js\";\nimport {\n type ExtendedHistory,\n getUserConfirmation,\n historyExtended,\n NextHistoryState,\n} from \"./internal/historyExtended.js\";\n\nexport type NextHistory = History<NextHistoryState> & ExtendedHistory;\n\nlet history: NextHistory;\n\nexport function createHistory(): NextHistory {\n if (!history) {\n // https://github.com/remix-run/history/issues/810\n const browserHistory = createBrowserHistory<NextHistoryState>({\n basename: getBasePath().replace(/\\/$/, \"\"),\n getUserConfirmation,\n });\n Object.assign(browserHistory, historyExtended(browserHistory));\n history = browserHistory as NextHistory;\n }\n return history;\n}\n\nexport function getHistory(): NextHistory {\n return history ?? getV2History();\n}\n\n/**\n * When using v3 bricks in v2 runtime, return history from v2 runtime.\n */\nfunction getV2History() {\n const { dll } = window as unknown as { dll?: DLL };\n if (typeof dll === \"function\") {\n const LegacyBrickKit = dll(\"tYg3\");\n return LegacyBrickKit.getHistory();\n }\n}\n\ninterface DLL {\n (moduleId: \"tYg3\"): {\n getHistory(): NextHistory;\n };\n}\n\nexport type NextLocation = Location<NextHistoryState>;\n\nexport type { NextHistoryState };\n"],"mappings":";;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AASA,IAAIG,OAAoB;AAEjB,SAASC,aAAaA,CAAA,EAAgB;EAC3C,IAAI,CAACD,OAAO,EAAE;IACZ;IACA,MAAME,cAAc,GAAG,IAAAC,8BAAoB,EAAmB;MAC5DC,QAAQ,EAAE,IAAAC,wBAAW,EAAC,CAAC,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;MAC1CC,mBAAmB,EAAnBA;IACF,CAAC,CAAC;IACFC,MAAM,CAACC,MAAM,CAACP,cAAc,EAAE,IAAAQ,gCAAe,EAACR,cAAc,CAAC,CAAC;IAC9DF,OAAO,GAAGE,cAA6B;EACzC;EACA,OAAOF,OAAO;AAChB;AAEO,SAASW,UAAUA,CAAA,EAAgB;EAAA,IAAAC,QAAA;EACxC,QAAAA,QAAA,GAAOZ,OAAO,cAAAY,QAAA,cAAAA,QAAA,GAAIC,YAAY,CAAC,CAAC;AAClC;;AAEA;AACA;AACA;AACA,SAASA,YAAYA,CAAA,EAAG;EACtB,MAAM;IAAEC;EAAI,CAAC,GAAGC,MAAkC;EAClD,IAAI,OAAOD,GAAG,KAAK,UAAU,EAAE;IAC7B,MAAME,cAAc,GAAGF,GAAG,CAAC,MAAM,CAAC;IAClC,OAAOE,cAAc,CAACL,UAAU,CAAC,CAAC;EACpC;AACF"}
@@ -15,6 +15,20 @@ export function createHistory() {
15
15
  return history;
16
16
  }
17
17
  export function getHistory() {
18
- return history;
18
+ var _history;
19
+ return (_history = history) !== null && _history !== void 0 ? _history : getV2History();
20
+ }
21
+
22
+ /**
23
+ * When using v3 bricks in v2 runtime, return history from v2 runtime.
24
+ */
25
+ function getV2History() {
26
+ var {
27
+ dll
28
+ } = window;
29
+ if (typeof dll === "function") {
30
+ var LegacyBrickKit = dll("tYg3");
31
+ return LegacyBrickKit.getHistory();
32
+ }
19
33
  }
20
34
  //# sourceMappingURL=history.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","names":["createBrowserHistory","getBasePath","getUserConfirmation","historyExtended","history","createHistory","browserHistory","basename","replace","Object","assign","getHistory"],"sources":["../../src/history.ts"],"sourcesContent":["import { History, Location, createBrowserHistory } from \"history\";\nimport { getBasePath } from \"./getBasePath.js\";\nimport {\n type ExtendedHistory,\n getUserConfirmation,\n historyExtended,\n NextHistoryState,\n} from \"./internal/historyExtended.js\";\n\nexport type NextHistory = History<NextHistoryState> & ExtendedHistory;\n\nlet history: NextHistory;\n\nexport function createHistory(): NextHistory {\n if (!history) {\n // https://github.com/remix-run/history/issues/810\n const browserHistory = createBrowserHistory<NextHistoryState>({\n basename: getBasePath().replace(/\\/$/, \"\"),\n getUserConfirmation,\n });\n Object.assign(browserHistory, historyExtended(browserHistory));\n history = browserHistory as NextHistory;\n }\n return history;\n}\n\nexport function getHistory(): NextHistory {\n return history;\n}\n\nexport type NextLocation = Location<NextHistoryState>;\n\nexport type { NextHistoryState };\n"],"mappings":"AAAA,SAA4BA,oBAAoB,QAAQ,SAAS;AACjE,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAEEC,mBAAmB,EACnBC,eAAe,QAEV,+BAA+B;AAItC,IAAIC,OAAoB;AAExB,OAAO,SAASC,aAAaA,CAAA,EAAgB;EAC3C,IAAI,CAACD,OAAO,EAAE;IACZ;IACA,IAAME,cAAc,GAAGN,oBAAoB,CAAmB;MAC5DO,QAAQ,EAAEN,WAAW,CAAC,CAAC,CAACO,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;MAC1CN;IACF,CAAC,CAAC;IACFO,MAAM,CAACC,MAAM,CAACJ,cAAc,EAAEH,eAAe,CAACG,cAAc,CAAC,CAAC;IAC9DF,OAAO,GAAGE,cAA6B;EACzC;EACA,OAAOF,OAAO;AAChB;AAEA,OAAO,SAASO,UAAUA,CAAA,EAAgB;EACxC,OAAOP,OAAO;AAChB"}
1
+ {"version":3,"file":"history.js","names":["createBrowserHistory","getBasePath","getUserConfirmation","historyExtended","history","createHistory","browserHistory","basename","replace","Object","assign","getHistory","_history","getV2History","dll","window","LegacyBrickKit"],"sources":["../../src/history.ts"],"sourcesContent":["import { History, Location, createBrowserHistory } from \"history\";\nimport { getBasePath } from \"./getBasePath.js\";\nimport {\n type ExtendedHistory,\n getUserConfirmation,\n historyExtended,\n NextHistoryState,\n} from \"./internal/historyExtended.js\";\n\nexport type NextHistory = History<NextHistoryState> & ExtendedHistory;\n\nlet history: NextHistory;\n\nexport function createHistory(): NextHistory {\n if (!history) {\n // https://github.com/remix-run/history/issues/810\n const browserHistory = createBrowserHistory<NextHistoryState>({\n basename: getBasePath().replace(/\\/$/, \"\"),\n getUserConfirmation,\n });\n Object.assign(browserHistory, historyExtended(browserHistory));\n history = browserHistory as NextHistory;\n }\n return history;\n}\n\nexport function getHistory(): NextHistory {\n return history ?? getV2History();\n}\n\n/**\n * When using v3 bricks in v2 runtime, return history from v2 runtime.\n */\nfunction getV2History() {\n const { dll } = window as unknown as { dll?: DLL };\n if (typeof dll === \"function\") {\n const LegacyBrickKit = dll(\"tYg3\");\n return LegacyBrickKit.getHistory();\n }\n}\n\ninterface DLL {\n (moduleId: \"tYg3\"): {\n getHistory(): NextHistory;\n };\n}\n\nexport type NextLocation = Location<NextHistoryState>;\n\nexport type { NextHistoryState };\n"],"mappings":"AAAA,SAA4BA,oBAAoB,QAAQ,SAAS;AACjE,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAEEC,mBAAmB,EACnBC,eAAe,QAEV,+BAA+B;AAItC,IAAIC,OAAoB;AAExB,OAAO,SAASC,aAAaA,CAAA,EAAgB;EAC3C,IAAI,CAACD,OAAO,EAAE;IACZ;IACA,IAAME,cAAc,GAAGN,oBAAoB,CAAmB;MAC5DO,QAAQ,EAAEN,WAAW,CAAC,CAAC,CAACO,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;MAC1CN;IACF,CAAC,CAAC;IACFO,MAAM,CAACC,MAAM,CAACJ,cAAc,EAAEH,eAAe,CAACG,cAAc,CAAC,CAAC;IAC9DF,OAAO,GAAGE,cAA6B;EACzC;EACA,OAAOF,OAAO;AAChB;AAEA,OAAO,SAASO,UAAUA,CAAA,EAAgB;EAAA,IAAAC,QAAA;EACxC,QAAAA,QAAA,GAAOR,OAAO,cAAAQ,QAAA,cAAAA,QAAA,GAAIC,YAAY,CAAC,CAAC;AAClC;;AAEA;AACA;AACA;AACA,SAASA,YAAYA,CAAA,EAAG;EACtB,IAAM;IAAEC;EAAI,CAAC,GAAGC,MAAkC;EAClD,IAAI,OAAOD,GAAG,KAAK,UAAU,EAAE;IAC7B,IAAME,cAAc,GAAGF,GAAG,CAAC,MAAM,CAAC;IAClC,OAAOE,cAAc,CAACL,UAAU,CAAC,CAAC;EACpC;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/runtime",
3
- "version": "1.17.3",
3
+ "version": "1.17.4",
4
4
  "homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/runtime",
5
5
  "license": "GPL-3.0",
6
6
  "repository": {
@@ -65,5 +65,5 @@
65
65
  "@next-core/build-next-libs": "^1.0.5",
66
66
  "@next-core/test-next": "^1.0.6"
67
67
  },
68
- "gitHead": "527bb701e7906d4f15bc0be76e56e7b313e5b4d6"
68
+ "gitHead": "89a3f3f76e9c065908e616cc3fb723ad81f6f1c7"
69
69
  }