@sitecore-jss/sitecore-jss-nextjs 21.7.0-canary.18 → 21.7.0-canary.19
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/dist/cjs/utils/utils.js +6 -18
- package/dist/esm/utils/utils.js +6 -15
- package/package.json +5 -5
- package/types/utils/utils.d.ts +1 -0
package/dist/cjs/utils/utils.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getJssEditingSecret = exports.handleEditorFastRefresh = exports.getPublicUrl = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
4
|
const utils_1 = require("@sitecore-jss/sitecore-jss/utils");
|
|
9
5
|
/**
|
|
10
6
|
* Get the publicUrl.
|
|
@@ -13,27 +9,19 @@ const utils_1 = require("@sitecore-jss/sitecore-jss/utils");
|
|
|
13
9
|
* VERCEL_URL is provided by Vercel in case if we are in Preview deployment (deployment based on the custom branch),
|
|
14
10
|
* preview deployment has unique url, we don't know exact url.
|
|
15
11
|
* Similarly, DEPLOY_URL is provided by Netlify and would give us the deploy URL
|
|
12
|
+
* In production non-editing environments it is desirable to use relative urls, so in that case set PUBLIC_URL = ''
|
|
16
13
|
*/
|
|
17
14
|
const getPublicUrl = () => {
|
|
18
|
-
if (process.env.NETLIFY && process.env.DEPLOY_URL)
|
|
19
|
-
return process.env.DEPLOY_URL;
|
|
20
|
-
if (process.env.VERCEL_URL)
|
|
21
|
-
return `https://${process.env.VERCEL_URL}`;
|
|
22
15
|
let url = process.env.PUBLIC_URL;
|
|
23
16
|
if (url === undefined) {
|
|
24
|
-
|
|
17
|
+
if (process.env.NETLIFY && process.env.DEPLOY_URL)
|
|
18
|
+
return process.env.DEPLOY_URL;
|
|
19
|
+
if (process.env.VERCEL_URL)
|
|
20
|
+
return `https://${process.env.VERCEL_URL}`;
|
|
25
21
|
url = 'http://localhost:3000';
|
|
26
22
|
}
|
|
27
|
-
else {
|
|
28
|
-
try {
|
|
29
|
-
new URL(url);
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
throw new Error(`The PUBLIC_URL environment variable '${url}' is not a valid URL.`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
23
|
// Ensure no trailing slash
|
|
36
|
-
return url.
|
|
24
|
+
return url.replace(/\/$/, '');
|
|
37
25
|
};
|
|
38
26
|
exports.getPublicUrl = getPublicUrl;
|
|
39
27
|
/**
|
package/dist/esm/utils/utils.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
1
|
import { isEditorActive, resetEditorChromes } from '@sitecore-jss/sitecore-jss/utils';
|
|
3
2
|
/**
|
|
4
3
|
* Get the publicUrl.
|
|
@@ -7,27 +6,19 @@ import { isEditorActive, resetEditorChromes } from '@sitecore-jss/sitecore-jss/u
|
|
|
7
6
|
* VERCEL_URL is provided by Vercel in case if we are in Preview deployment (deployment based on the custom branch),
|
|
8
7
|
* preview deployment has unique url, we don't know exact url.
|
|
9
8
|
* Similarly, DEPLOY_URL is provided by Netlify and would give us the deploy URL
|
|
9
|
+
* In production non-editing environments it is desirable to use relative urls, so in that case set PUBLIC_URL = ''
|
|
10
10
|
*/
|
|
11
11
|
export const getPublicUrl = () => {
|
|
12
|
-
if (process.env.NETLIFY && process.env.DEPLOY_URL)
|
|
13
|
-
return process.env.DEPLOY_URL;
|
|
14
|
-
if (process.env.VERCEL_URL)
|
|
15
|
-
return `https://${process.env.VERCEL_URL}`;
|
|
16
12
|
let url = process.env.PUBLIC_URL;
|
|
17
13
|
if (url === undefined) {
|
|
18
|
-
|
|
14
|
+
if (process.env.NETLIFY && process.env.DEPLOY_URL)
|
|
15
|
+
return process.env.DEPLOY_URL;
|
|
16
|
+
if (process.env.VERCEL_URL)
|
|
17
|
+
return `https://${process.env.VERCEL_URL}`;
|
|
19
18
|
url = 'http://localhost:3000';
|
|
20
19
|
}
|
|
21
|
-
else {
|
|
22
|
-
try {
|
|
23
|
-
new URL(url);
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
throw new Error(`The PUBLIC_URL environment variable '${url}' is not a valid URL.`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
20
|
// Ensure no trailing slash
|
|
30
|
-
return url.
|
|
21
|
+
return url.replace(/\/$/, '');
|
|
31
22
|
};
|
|
32
23
|
/**
|
|
33
24
|
* Since Sitecore editors do not support Fast Refresh:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-jss/sitecore-jss-nextjs",
|
|
3
|
-
"version": "21.7.0-canary.
|
|
3
|
+
"version": "21.7.0-canary.19",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"react-dom": "^18.2.0"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@sitecore-jss/sitecore-jss": "^21.7.0-canary.
|
|
77
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "^21.7.0-canary.
|
|
78
|
-
"@sitecore-jss/sitecore-jss-react": "^21.7.0-canary.
|
|
76
|
+
"@sitecore-jss/sitecore-jss": "^21.7.0-canary.19",
|
|
77
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "^21.7.0-canary.19",
|
|
78
|
+
"@sitecore-jss/sitecore-jss-react": "^21.7.0-canary.19",
|
|
79
79
|
"@vercel/kv": "^0.2.1",
|
|
80
80
|
"node-html-parser": "^6.1.4",
|
|
81
81
|
"prop-types": "^15.8.1",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
"description": "",
|
|
86
86
|
"types": "types/index.d.ts",
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "ade83983264829c9a7eb4f5426450e75b00ff9fc",
|
|
88
88
|
"files": [
|
|
89
89
|
"dist",
|
|
90
90
|
"types",
|
package/types/utils/utils.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* VERCEL_URL is provided by Vercel in case if we are in Preview deployment (deployment based on the custom branch),
|
|
6
6
|
* preview deployment has unique url, we don't know exact url.
|
|
7
7
|
* Similarly, DEPLOY_URL is provided by Netlify and would give us the deploy URL
|
|
8
|
+
* In production non-editing environments it is desirable to use relative urls, so in that case set PUBLIC_URL = ''
|
|
8
9
|
*/
|
|
9
10
|
export declare const getPublicUrl: () => string;
|
|
10
11
|
/**
|