Skip to content

Commit 6e59a48

Browse files
committed
0.0.11
1 parent d814c3c commit 6e59a48

File tree

15 files changed

+14
-219
lines changed

15 files changed

+14
-219
lines changed

index.js

-199
Original file line numberDiff line numberDiff line change
@@ -15,204 +15,5 @@ module.exports.isExternalLink = function isExternalLink(input, sitehost, exclude
1515
}
1616

1717
module.exports.encodeUrl = encodeUrl
18-
switch (platform) {
19-
case 'android':
20-
switch (arch) {
21-
case 'arm64':
22-
localFileExisted = existsSync(join(__dirname, 'hexo-util.android-arm64.node'))
23-
try {
24-
if (localFileExisted) {
25-
nativeBinding = require('./hexo-util.android-arm64.node')
26-
} else {
27-
nativeBinding = require('@sukka/hexo-util-rs-android-arm64')
28-
}
29-
} catch (e) {
30-
loadError = e
31-
}
32-
break
33-
case 'arm':
34-
localFileExisted = existsSync(join(__dirname, 'hexo-util.android-arm-eabi.node'))
35-
try {
36-
if (localFileExisted) {
37-
nativeBinding = require('./hexo-util.android-arm-eabi.node')
38-
} else {
39-
nativeBinding = require('@sukka/hexo-util-rs-android-arm-eabi')
40-
}
41-
} catch (e) {
42-
loadError = e
43-
}
44-
break
45-
default:
46-
throw new Error(`Unsupported architecture on Android ${arch}`)
47-
}
48-
break
49-
case 'win32':
50-
switch (arch) {
51-
case 'x64':
52-
localFileExisted = existsSync(join(__dirname, 'hexo-util.win32-x64-msvc.node'))
53-
try {
54-
if (localFileExisted) {
55-
nativeBinding = require('./hexo-util.win32-x64-msvc.node')
56-
} else {
57-
nativeBinding = require('@sukka/hexo-util-rs-win32-x64-msvc')
58-
}
59-
} catch (e) {
60-
loadError = e
61-
}
62-
break
63-
case 'ia32':
64-
localFileExisted = existsSync(join(__dirname, 'hexo-util.win32-ia32-msvc.node'))
65-
try {
66-
if (localFileExisted) {
67-
nativeBinding = require('./hexo-util.win32-ia32-msvc.node')
68-
} else {
69-
nativeBinding = require('@sukka/hexo-util-rs-win32-ia32-msvc')
70-
}
71-
} catch (e) {
72-
loadError = e
73-
}
74-
break
75-
case 'arm64':
76-
localFileExisted = existsSync(join(__dirname, 'hexo-util.win32-arm64-msvc.node'))
77-
try {
78-
if (localFileExisted) {
79-
nativeBinding = require('./hexo-util.win32-arm64-msvc.node')
80-
} else {
81-
nativeBinding = require('@sukka/hexo-util-rs-win32-arm64-msvc')
82-
}
83-
} catch (e) {
84-
loadError = e
85-
}
86-
break
87-
default:
88-
throw new Error(`Unsupported architecture on Windows: ${arch}`)
89-
}
90-
break
91-
case 'darwin':
92-
switch (arch) {
93-
case 'x64':
94-
localFileExisted = existsSync(join(__dirname, 'hexo-util.darwin-x64.node'))
95-
try {
96-
if (localFileExisted) {
97-
nativeBinding = require('./hexo-util.darwin-x64.node')
98-
} else {
99-
nativeBinding = require('@sukka/hexo-util-rs-darwin-x64')
100-
}
101-
} catch (e) {
102-
loadError = e
103-
}
104-
break
105-
case 'arm64':
106-
localFileExisted = existsSync(join(__dirname, 'hexo-util.darwin-arm64.node'))
107-
try {
108-
if (localFileExisted) {
109-
nativeBinding = require('./hexo-util.darwin-arm64.node')
110-
} else {
111-
nativeBinding = require('@sukka/hexo-util-rs-darwin-arm64')
112-
}
113-
} catch (e) {
114-
loadError = e
115-
}
116-
break
117-
default:
118-
throw new Error(`Unsupported architecture on macOS: ${arch}`)
119-
}
120-
break
121-
case 'freebsd':
122-
if (arch !== 'x64') {
123-
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
124-
}
125-
localFileExisted = existsSync(join(__dirname, 'hexo-util.freebsd-x64.node'))
126-
try {
127-
if (localFileExisted) {
128-
nativeBinding = require('./hexo-util.freebsd-x64.node')
129-
} else {
130-
nativeBinding = require('@sukka/hexo-util-rs-freebsd-x64')
131-
}
132-
} catch (e) {
133-
loadError = e
134-
}
135-
break
136-
case 'linux':
137-
switch (arch) {
138-
case 'x64':
139-
if (isMusl()) {
140-
localFileExisted = existsSync(join(__dirname, 'hexo-util.linux-x64-musl.node'))
141-
try {
142-
if (localFileExisted) {
143-
nativeBinding = require('./hexo-util.linux-x64-musl.node')
144-
} else {
145-
nativeBinding = require('@sukka/hexo-util-rs-linux-x64-musl')
146-
}
147-
} catch (e) {
148-
loadError = e
149-
}
150-
} else {
151-
localFileExisted = existsSync(join(__dirname, 'hexo-util.linux-x64-gnu.node'))
152-
try {
153-
if (localFileExisted) {
154-
nativeBinding = require('./hexo-util.linux-x64-gnu.node')
155-
} else {
156-
nativeBinding = require('@sukka/hexo-util-rs-linux-x64-gnu')
157-
}
158-
} catch (e) {
159-
loadError = e
160-
}
161-
}
162-
break
163-
case 'arm64':
164-
if (isMusl()) {
165-
localFileExisted = existsSync(join(__dirname, 'hexo-util.linux-arm64-musl.node'))
166-
try {
167-
if (localFileExisted) {
168-
nativeBinding = require('./hexo-util.linux-arm64-musl.node')
169-
} else {
170-
nativeBinding = require('@sukka/hexo-util-rs-linux-arm64-musl')
171-
}
172-
} catch (e) {
173-
loadError = e
174-
}
175-
} else {
176-
localFileExisted = existsSync(join(__dirname, 'hexo-util.linux-arm64-gnu.node'))
177-
try {
178-
if (localFileExisted) {
179-
nativeBinding = require('./hexo-util.linux-arm64-gnu.node')
180-
} else {
181-
nativeBinding = require('@sukka/hexo-util-rs-linux-arm64-gnu')
182-
}
183-
} catch (e) {
184-
loadError = e
185-
}
186-
}
187-
break
188-
case 'arm':
189-
localFileExisted = existsSync(join(__dirname, 'hexo-util.linux-arm-gnueabihf.node'))
190-
try {
191-
if (localFileExisted) {
192-
nativeBinding = require('./hexo-util.linux-arm-gnueabihf.node')
193-
} else {
194-
nativeBinding = require('@sukka/hexo-util-rs-linux-arm-gnueabihf')
195-
}
196-
} catch (e) {
197-
loadError = e
198-
}
199-
break
200-
default:
201-
throw new Error(`Unsupported architecture on Linux: ${arch}`)
202-
}
203-
break
204-
default:
205-
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
206-
}
207-
208-
if (!nativeBinding) {
209-
if (loadError) {
210-
throw loadError
211-
}
212-
throw new Error(`Failed to load native binding`)
213-
}
214-
215-
const { slugize, stripTags } = nativeBinding
216-
21718
module.exports.slugize = slugize
21819
module.exports.stripTags = stripTags

npm/android-arm-eabi/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-android-arm-eabi",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"android"
66
],

npm/android-arm64/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-android-arm64",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"android"
66
],

npm/darwin-arm64/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-darwin-arm64",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"darwin"
66
],

npm/darwin-x64/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-darwin-x64",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"darwin"
66
],

npm/freebsd-x64/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-freebsd-x64",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"freebsd"
66
],

npm/linux-arm-gnueabihf/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-linux-arm-gnueabihf",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"linux"
66
],

npm/linux-arm64-gnu/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-linux-arm64-gnu",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"linux"
66
],

npm/linux-arm64-musl/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-linux-arm64-musl",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"linux"
66
],

npm/linux-x64-gnu/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-linux-x64-gnu",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"linux"
66
],

npm/linux-x64-musl/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-linux-x64-musl",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"linux"
66
],

npm/win32-arm64-msvc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-win32-arm64-msvc",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"win32"
66
],

npm/win32-ia32-msvc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-win32-ia32-msvc",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"win32"
66
],

npm/win32-x64-msvc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sukka/hexo-util-rs-win32-x64-msvc",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"os": [
55
"win32"
66
],

package.json

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
{
2-
"name": "@napi-rs/hexo-util",
3-
"version": "1.0.0",
42
"name": "@sukka/hexo-util-rs",
5-
"version": "0.0.10",
3+
"version": "0.0.11",
64
"description": "Utilities for Hexo using rust rewrite.",
7-
"name": "@sukka/hexo-util-rs",
8-
"version": "0.0.3",
9-
"description": "Template project for writing node package with napi-rs",
105
"main": "index.js",
116
"repository": "https://github.com/liby/hexo-util-rs.git",
127
"license": "MIT",
@@ -26,7 +21,6 @@
2621
"index.js",
2722
"utils.js",
2823
"common/cache.js"
29-
"common"
3024
],
3125
"napi": {
3226
"name": "hexo-util",

0 commit comments

Comments
 (0)