fix: module download error at windows remove okhttp lib
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
996a63ba2d
commit
388e1e9135
19
pom.xml
19
pom.xml
|
@ -33,10 +33,6 @@
|
||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>org.kamranzafar:jtar</include>
|
<include>org.kamranzafar:jtar</include>
|
||||||
<include>com.squareup.okhttp3:okhttp</include>
|
|
||||||
<include>com.squareup.okio:okio</include>
|
|
||||||
<include>org.jetbrains.kotlin:kotlin-stdlib</include>
|
|
||||||
<include>org.jetbrains.kotlin:kotlin-stdlib-common</include>
|
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -167,21 +163,6 @@
|
||||||
<artifactId>jtar</artifactId>
|
<artifactId>jtar</artifactId>
|
||||||
<version>2.3</version>
|
<version>2.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
|
||||||
<artifactId>okhttp</artifactId>
|
|
||||||
<version>4.1.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
|
||||||
<artifactId>kotlin-stdlib</artifactId>
|
|
||||||
<version>1.3.50</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
|
||||||
<artifactId>kotlin-stdlib-common</artifactId>
|
|
||||||
<version>1.3.50</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
|
|
|
@ -230,8 +230,9 @@
|
||||||
// handle name es6-map/implement => es6-map @ms/common/dist/reflect => @ms/common
|
// handle name es6-map/implement => es6-map @ms/common/dist/reflect => @ms/common
|
||||||
var name_arr = name.split('/');
|
var name_arr = name.split('/');
|
||||||
var module_name = name.startsWith('@') ? name_arr[0] + '/' + name_arr[1] : name_arr[0];
|
var module_name = name.startsWith('@') ? name_arr[0] + '/' + name_arr[1] : name_arr[0];
|
||||||
var tempFile = Files.createTempDirectory('MiaoScript').resolve(module_name + '.tgz');
|
// at windows need replace file name java.lang.IllegalArgumentException: Invalid prefix or suffix
|
||||||
Files.copy(new URL('https://repo.yumc.pw/repository/npm/' + module_name).openStream(), tempFile, StandardCopyOption.REPLACE_EXISTING)
|
var tempFile = Files.createTempFile(module_name.replace('/', '_'), 'json');
|
||||||
|
Files.copy(new URL('https://repo.yumc.pw/repository/npm/' + module_name).openStream(), tempFile, StandardCopyOption.REPLACE_EXISTING);
|
||||||
var info = JSON.parse(new java.lang.String(Files.readAllBytes(tempFile), 'UTF-8'));
|
var info = JSON.parse(new java.lang.String(Files.readAllBytes(tempFile), 'UTF-8'));
|
||||||
var url = info.versions[info['dist-tags']['latest']].dist.tarball;
|
var url = info.versions[info['dist-tags']['latest']].dist.tarball;
|
||||||
console.log('node_module ' + module_name + ' not found at local but exist at internet ' + url + ' downloading...')
|
console.log('node_module ' + module_name + ' not found at local but exist at internet ' + url + ' downloading...')
|
||||||
|
@ -258,9 +259,10 @@
|
||||||
optional = __assign({ cache: true }, optional);
|
optional = __assign({ cache: true }, optional);
|
||||||
if (file === undefined) {
|
if (file === undefined) {
|
||||||
try {
|
try {
|
||||||
if (optional.recursive || notFoundModules[name]) {
|
// excloud local dir, prevent too many recursive call and cache not found module
|
||||||
|
if (name.startsWith('.') || name.startsWith('/') || optional.recursive || notFoundModules[name]) {
|
||||||
console.log(name, path, optional, notFoundModules[name])
|
console.log(name, path, optional, notFoundModules[name])
|
||||||
throw new Error("Can't found module " + name + ' in network!')
|
throw new Error("Can't found module " + name + ' at local or network!')
|
||||||
}
|
}
|
||||||
optional.recursive = true;
|
optional.recursive = true;
|
||||||
return _require(download(name), path, optional);
|
return _require(download(name), path, optional);
|
||||||
|
|
Loading…
Reference in New Issue