js-routes 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/js_routes/version.rb +1 -1
- data/lib/routes.js +4 -3
- data/lib/routes.ts +6 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61ecfa4f633571ccef27b543b26c0f8ca285cd5e26b8970f079262ec2d34525a
|
4
|
+
data.tar.gz: f4188f8ae11c79987ca533feb5750160b69339b78d7f3eb13ba6c3d53ff7da59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e49b2584cefe8c936d087fb9fc14291f46b22c425397117f500cf18d492694bf81af4154a13be32b04b1c9738aa55923adf8277ca26f201dda82ba7c7c1a0df
|
7
|
+
data.tar.gz: a31127d506a1d316638d8e386cc96eee83fd980150f223f11aacf48602957323ff6850f9b38e6d2ee25ebb4c1824ed5d8047d657a5449c7bb82a7adf2d3dbac4
|
data/CHANGELOG.md
CHANGED
data/lib/js_routes/version.rb
CHANGED
data/lib/routes.js
CHANGED
@@ -16,6 +16,7 @@ RubyVariables.WRAPPER((that) => {
|
|
16
16
|
NodeTypes[NodeTypes["DOT"] = 8] = "DOT";
|
17
17
|
})(NodeTypes || (NodeTypes = {}));
|
18
18
|
const Root = that;
|
19
|
+
const isBroswer = typeof window !== "undefined";
|
19
20
|
const ModuleReferences = {
|
20
21
|
CJS: {
|
21
22
|
define(routes) {
|
@@ -419,15 +420,15 @@ RubyVariables.WRAPPER((that) => {
|
|
419
420
|
}
|
420
421
|
current_host() {
|
421
422
|
var _a;
|
422
|
-
return ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.hostname) || "";
|
423
|
+
return (isBroswer && ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.hostname)) || "";
|
423
424
|
}
|
424
425
|
current_protocol() {
|
425
426
|
var _a, _b;
|
426
|
-
return ((_b = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.protocol) === null || _b === void 0 ? void 0 : _b.replace(/:$/, "")) || "http";
|
427
|
+
return ((isBroswer && ((_b = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.protocol) === null || _b === void 0 ? void 0 : _b.replace(/:$/, ""))) || "http");
|
427
428
|
}
|
428
429
|
current_port() {
|
429
430
|
var _a;
|
430
|
-
return ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.port) || "";
|
431
|
+
return (isBroswer && ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.port)) || "";
|
431
432
|
}
|
432
433
|
is_object(value) {
|
433
434
|
return (typeof value === "object" &&
|
data/lib/routes.ts
CHANGED
@@ -129,6 +129,7 @@ RubyVariables.WRAPPER(
|
|
129
129
|
}[keyof RouteNodes];
|
130
130
|
|
131
131
|
const Root = that;
|
132
|
+
const isBroswer = typeof window !== "undefined";
|
132
133
|
type ModuleDefinition = {
|
133
134
|
define: (routes: RouterExposedMethods) => void;
|
134
135
|
isSupported: () => boolean;
|
@@ -625,15 +626,17 @@ RubyVariables.WRAPPER(
|
|
625
626
|
}
|
626
627
|
|
627
628
|
current_host(): string {
|
628
|
-
return window?.location?.hostname || "";
|
629
|
+
return (isBroswer && window?.location?.hostname) || "";
|
629
630
|
}
|
630
631
|
|
631
632
|
current_protocol(): string {
|
632
|
-
return
|
633
|
+
return (
|
634
|
+
(isBroswer && window?.location?.protocol?.replace(/:$/, "")) || "http"
|
635
|
+
);
|
633
636
|
}
|
634
637
|
|
635
638
|
current_port(): string {
|
636
|
-
return window?.location?.port || "";
|
639
|
+
return (isBroswer && window?.location?.port) || "";
|
637
640
|
}
|
638
641
|
|
639
642
|
is_object(value: unknown): value is Record<string, unknown> {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js-routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Gusiev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|