serverless-offline 14.3.2 → 14.3.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.
- package/package.json +2 -2
- package/src/utils/logSponsor.js +48 -51
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "serverless-offline",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.4",
|
|
4
4
|
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"java-invoke-local": "0.0.6",
|
|
91
91
|
"jose": "^5.7.0",
|
|
92
92
|
"js-string-escape": "^1.0.1",
|
|
93
|
-
"jsonpath-plus": "^
|
|
93
|
+
"jsonpath-plus": "^10.0.0",
|
|
94
94
|
"jsonschema": "^1.4.1",
|
|
95
95
|
"jszip": "^3.10.1",
|
|
96
96
|
"luxon": "^3.5.0",
|
package/src/utils/logSponsor.js
CHANGED
|
@@ -1,69 +1,66 @@
|
|
|
1
1
|
/* eslint-disable no-use-before-define */
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
|
-
import process from "node:process"
|
|
3
|
+
// import process from "node:process"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
// const boxenOptions = {
|
|
6
|
+
// borderColor: "blue",
|
|
7
|
+
// margin: 1,
|
|
8
|
+
// padding: 1,
|
|
9
|
+
// }
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
// Promotion starts on August 22, 2024
|
|
15
|
-
const startAt = new Date("2024-08-22T00:00:00.000Z")
|
|
16
|
-
// By October 22, 2024, the promotion will be displayed to 100% of users
|
|
17
|
-
const endAt = new Date("2024-10-22T00:00:00.000Z")
|
|
18
|
-
const nDays = diffDays(startAt, endAt)
|
|
11
|
+
// // Promotion starts on August 22, 2024
|
|
12
|
+
// const startAt = new Date("2024-08-22T00:00:00.000Z")
|
|
13
|
+
// // By October 22, 2024, the promotion will be displayed to 100% of users
|
|
14
|
+
// const endAt = new Date("2024-10-22T00:00:00.000Z")
|
|
15
|
+
// const nDays = diffDays(startAt, endAt)
|
|
19
16
|
|
|
20
17
|
function logSponsor() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
)
|
|
18
|
+
console.log()
|
|
19
|
+
// if (!shouldDisplaySponsor()) {
|
|
20
|
+
// console.log()
|
|
21
|
+
// return
|
|
22
|
+
// }
|
|
23
|
+
// console.log(
|
|
24
|
+
// boxen(
|
|
25
|
+
// `Sponsored by ${dodgerblue("Arccode, the RPG for developers")}\nhttps://arccode.dev?ref=so\n${gray.dim(
|
|
26
|
+
// "Disable with --noSponsor",
|
|
27
|
+
// )}`,
|
|
28
|
+
// boxenOptions,
|
|
29
|
+
// ),
|
|
30
|
+
// )
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
// Display the message progressively over time to 100% of users
|
|
38
|
-
function shouldDisplaySponsor() {
|
|
39
|
-
|
|
34
|
+
// function shouldDisplaySponsor() {
|
|
35
|
+
// const ratio = diffDays(startAt, new Date()) / nDays
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
// if (ratio >= 1) return true
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
// try {
|
|
40
|
+
// const nonce = Number(
|
|
41
|
+
// encodeStringToNumber(process.cwd()).toString().padStart(2, "0").slice(-2),
|
|
42
|
+
// )
|
|
47
43
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
// return nonce <= ratio * 100
|
|
45
|
+
// } catch {
|
|
46
|
+
// //
|
|
47
|
+
// }
|
|
52
48
|
|
|
53
|
-
|
|
54
|
-
}
|
|
49
|
+
// return false
|
|
50
|
+
// }
|
|
55
51
|
|
|
56
|
-
function encodeStringToNumber(string) {
|
|
57
|
-
|
|
52
|
+
// function encodeStringToNumber(string) {
|
|
53
|
+
// let sum = 0
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
// for (let i = 0; i < string.length; i += 1) {
|
|
56
|
+
// sum += Number(string.codePointAt(i).toString(10))
|
|
57
|
+
// }
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
}
|
|
59
|
+
// return sum
|
|
60
|
+
// }
|
|
61
|
+
|
|
62
|
+
// function diffDays(a, b) {
|
|
63
|
+
// return Math.round((b - a) / (1000 * 60 * 60 * 24))
|
|
64
|
+
// }
|
|
65
65
|
|
|
66
|
-
function diffDays(a, b) {
|
|
67
|
-
return Math.round((b - a) / (1000 * 60 * 60 * 24))
|
|
68
|
-
}
|
|
69
66
|
export default logSponsor
|