-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5cdcb9
commit c7707cd
Showing
8 changed files
with
42 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,4 @@ | |
".": "./imports.js", | ||
"./packit": "./packit-intellisense.js" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ | |
"bin": { | ||
"create-reejs": "./index.js" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,8 @@ if (!fs.existsSync(path.join(_reejsDir, "failsafe", "package.json"))) | |
if (!globalThis.fetch) { | ||
if (!fs.existsSync(path.join(_reejsDir, "failsafe", "fetch.js"))) { | ||
let fetchFileCode = await fetchUrl( | ||
`${process.env.ESM_SERVER || "https://esm.sh" | ||
`${ | ||
process.env.ESM_SERVER || "https://esm.sh" | ||
}/v128/[email protected]/node/node-fetch.bundle.mjs` | ||
); | ||
fs.writeFileSync( | ||
|
@@ -162,21 +163,21 @@ let URLToFile = function (url, noFolderPath = false, reejsDir) { | |
|
||
let fileString = noFolderPath | ||
? "./" + | ||
crypto | ||
.createHash("sha256") | ||
.update(url + UA) | ||
.digest("hex") | ||
.slice(0, 6) + | ||
fileExt | ||
: path.join( | ||
reejsDir == true ? path.join(processCwd, ".reejs") : _reejsDir, | ||
"cache", | ||
crypto | ||
.createHash("sha256") | ||
.update(url + UA) | ||
.digest("hex") | ||
.slice(0, 6) + fileExt | ||
); | ||
.slice(0, 6) + | ||
fileExt | ||
: path.join( | ||
reejsDir == true ? path.join(processCwd, ".reejs") : _reejsDir, | ||
"cache", | ||
crypto | ||
.createHash("sha256") | ||
.update(url + UA) | ||
.digest("hex") | ||
.slice(0, 6) + fileExt | ||
); | ||
return fileString; | ||
}; | ||
|
||
|
@@ -186,9 +187,9 @@ let followRedirect = async function (url, forBrowser = false) { | |
return ( | ||
await fetch( | ||
(process.env.ESM_SERVER || "https://esm.sh/") + | ||
"/" + | ||
url.replace("npm:", "") + | ||
"?bundle", | ||
"/" + | ||
url.replace("npm:", "") + | ||
"?bundle", | ||
{ | ||
headers: { | ||
"User-Agent": forBrowser | ||
|
@@ -238,7 +239,8 @@ let lexer, parser; | |
|
||
if (!fs.existsSync(path.join(_reejsDir, "failsafe", "spinnies.js"))) { | ||
let spinniesCode = await fetchUrl( | ||
`${process.env.ESM_SERVER || "https://esm.sh"}/v128/[email protected]/${globalThis?.Deno ? "denonext" : "node" | ||
`${process.env.ESM_SERVER || "https://esm.sh"}/v128/[email protected]/${ | ||
globalThis?.Deno ? "denonext" : "node" | ||
}/spinnies.bundle.mjs` | ||
); | ||
fs.writeFileSync( | ||
|
@@ -327,7 +329,8 @@ let dl = async function ( | |
if (res != url && !NOTIFIED_UPDATE_URL.some(u => u == url)) { | ||
spinners.succeed(originalUrl, { | ||
text: styleit( | ||
`${isChild ? "├─ " : "" | ||
`${ | ||
isChild ? "├─ " : "" | ||
}🪄 %c Please use specific version for %c${url} %cto access %c${res} %cfaster without pinging for latest version`, | ||
"", | ||
"color: yellow", | ||
|
@@ -383,7 +386,8 @@ let dl = async function ( | |
//set timeout for fetch for 30 secs, after which throw error | ||
let timeout = setTimeout(async () => { | ||
throw new Error( | ||
`Failed to download ${finalURL}\nUser Agent: ${forBrowser ? `Mozilla/5.0 (reejs/${pkgJson.version})` : UA | ||
`Failed to download ${finalURL}\nUser Agent: ${ | ||
forBrowser ? `Mozilla/5.0 (reejs/${pkgJson.version})` : UA | ||
}\n${await res.text()}` | ||
); | ||
}, 30000); | ||
|
@@ -467,10 +471,10 @@ let dl = async function ( | |
ext === "jsx" | ||
? ["jsx"] | ||
: ext === "ts" | ||
? ["typescript"] | ||
: ext === "tsx" | ||
? ["typescript", "jsx"] | ||
: []; | ||
? ["typescript"] | ||
: ext === "tsx" | ||
? ["typescript", "jsx"] | ||
: []; | ||
code = parser.transform(code, { | ||
transforms, | ||
production: true, | ||
|
@@ -557,9 +561,9 @@ let dl = async function ( | |
if (e.startsWith("npm:")) { | ||
return await followRedirect( | ||
(process.env.ESM_SERVER || "https://esm.sh") + | ||
"/" + | ||
e.replace("npm:", "") + | ||
"?bundle", | ||
"/" + | ||
e.replace("npm:", "") + | ||
"?bundle", | ||
forBrowser | ||
); | ||
} else if (e.startsWith("/")) { | ||
|
@@ -688,7 +692,8 @@ let dl = async function ( | |
if ((isChild && process.env.DEBUG) || !isChild) | ||
spinners.update(originalUrl, { | ||
text: styleit( | ||
`${isChild ? "├─ " : ""}%c${finalURL} %cin %c${(Date.now() - start) / 1000 | ||
`${isChild ? "├─ " : ""}%c${finalURL} %cin %c${ | ||
(Date.now() - start) / 1000 | ||
}s`, | ||
"", | ||
"color: blue", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ | |
"type": "git", | ||
"url": "https://github.com/rovelstars/reejs.git" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ | |
"keywords": [], | ||
"author": "", | ||
"license": "MIT" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ | |
"keywords": [], | ||
"author": "", | ||
"license": "MIT" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
"dependencies": { | ||
"@reejs/imports": "*" | ||
} | ||
} | ||
} |