Skip to content

Commit

Permalink
fix: import global files
Browse files Browse the repository at this point in the history
  • Loading branch information
yunsii committed Jan 18, 2022
1 parent c714b2d commit 239961d
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 8 deletions.
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "MIT",
"private": true,
"dependencies": {
"less": "^4.1.2",
"react": "^17.0.0",
"react-dom": "^17.0.0"
},
Expand Down
3 changes: 3 additions & 0 deletions example/src/global.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
p {
margin: 0;
}
88 changes: 85 additions & 3 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,13 @@ convert-source-map@^1.7.0:
dependencies:
safe-buffer "~5.1.1"

copy-anything@^2.0.1:
version "2.0.3"
resolved "https://registry.nlark.com/copy-anything/download/copy-anything-2.0.3.tgz#842407ba02466b0df844819bbe3baebbe5d45d87"
integrity sha1-hCQHugJGaw34RIGbvjuuu+XUXYc=
dependencies:
is-what "^3.12.0"

core-util-is@1.0.2:
version "1.0.2"
resolved "https://registry.nlark.com/core-util-is/download/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
Expand Down Expand Up @@ -1884,6 +1891,13 @@ debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2:
dependencies:
ms "2.1.2"

debug@^3.2.6:
version "3.2.7"
resolved "https://registry.npmmirror.com/debug/download/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a"
integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==
dependencies:
ms "^2.1.1"

debuglog@^1.0.1:
version "1.0.1"
resolved "https://registry.npmmirror.com/debuglog/download/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
Expand Down Expand Up @@ -2045,6 +2059,13 @@ err-code@^2.0.2:
resolved "https://registry.nlark.com/err-code/download/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9"
integrity sha1-I8Lzt1b/38YI0w4nyalBAkgH5/k=

errno@^0.1.1:
version "0.1.8"
resolved "https://registry.nlark.com/errno/download/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f"
integrity sha1-i7Ppx9Rjvkl2/4iPdrSAnrwugR8=
dependencies:
prr "~1.0.1"

error-ex@^1.3.1:
version "1.3.2"
resolved "https://registry.nlark.com/error-ex/download/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
Expand Down Expand Up @@ -2571,7 +2592,7 @@ humanize-ms@^1.2.1:
dependencies:
ms "^2.0.0"

iconv-lite@^0.4.24:
iconv-lite@^0.4.24, iconv-lite@^0.4.4:
version "0.4.24"
resolved "https://registry.nlark.com/iconv-lite/download/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
integrity sha1-ICK0sl+93CHS9SSXSkdKr+czkIs=
Expand All @@ -2597,6 +2618,11 @@ ignore@^5.2.0:
resolved "https://registry.npmmirror.com/ignore/download/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a"
integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==

image-size@~0.5.0:
version "0.5.5"
resolved "https://registry.npmmirror.com/image-size/download/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c"
integrity sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w=

import-fresh@^3.2.1:
version "3.3.0"
resolved "https://registry.nlark.com/import-fresh/download/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b"
Expand Down Expand Up @@ -2881,6 +2907,11 @@ is-weakref@^1.0.1:
dependencies:
call-bind "^1.0.2"

is-what@^3.12.0:
version "3.14.1"
resolved "https://registry.npmmirror.com/is-what/download/is-what-3.14.1.tgz#e1222f46ddda85dead0fd1c9df131760e77755c1"
integrity sha1-4SIvRt3ahd6tD9HJ3xMXYOd3VcE=

isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/isarray/download/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
Expand Down Expand Up @@ -3008,6 +3039,23 @@ lerna@^4.0.0:
import-local "^3.0.2"
npmlog "^4.1.2"

less@^4.1.2:
version "4.1.2"
resolved "https://registry.npmmirror.com/less/download/less-4.1.2.tgz#6099ee584999750c2624b65f80145f8674e4b4b0"
integrity sha512-EoQp/Et7OSOVu0aJknJOtlXZsnr8XE8KwuzTHOLeVSEx8pVWUICc8Q0VYRHgzyjX78nMEyC/oztWFbgyhtNfDA==
dependencies:
copy-anything "^2.0.1"
parse-node-version "^1.0.1"
tslib "^2.3.0"
optionalDependencies:
errno "^0.1.1"
graceful-fs "^4.1.2"
image-size "~0.5.0"
make-dir "^2.1.0"
mime "^1.4.1"
needle "^2.5.2"
source-map "~0.6.0"

libnpmaccess@^4.0.1:
version "4.0.3"
resolved "https://registry.npmmirror.com/libnpmaccess/download/libnpmaccess-4.0.3.tgz#dfb0e5b0a53c315a2610d300e46b4ddeb66e7eec"
Expand Down Expand Up @@ -3228,6 +3276,11 @@ mime-types@^2.1.12, mime-types@~2.1.19:
dependencies:
mime-db "1.51.0"

mime@^1.4.1:
version "1.6.0"
resolved "https://registry.npmmirror.com/mime/download/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha1-Ms2eXGRVO9WNGaVor0Uqz/BJgbE=

mimic-fn@^2.1.0:
version "2.1.0"
resolved "https://registry.npmmirror.com/mimic-fn/download/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
Expand Down Expand Up @@ -3379,7 +3432,7 @@ ms@2.1.2:
resolved "https://registry.npmmirror.com/ms/download/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=

ms@^2.0.0:
ms@^2.0.0, ms@^2.1.1:
version "2.1.3"
resolved "https://registry.npmmirror.com/ms/download/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha1-V0yBOM4dK1hh8LRFedut1gxmFbI=
Expand All @@ -3400,6 +3453,15 @@ mute-stream@0.0.8, mute-stream@~0.0.4:
resolved "https://registry.nlark.com/mute-stream/download/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
integrity sha1-FjDEKyJR/4HiooPelqVJfqkuXg0=

needle@^2.5.2:
version "2.9.1"
resolved "https://registry.nlark.com/needle/download/needle-2.9.1.tgz?cache=0&sync_timestamp=1630674995929&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fneedle%2Fdownload%2Fneedle-2.9.1.tgz#22d1dffbe3490c2b83e301f7709b6736cd8f2684"
integrity sha1-ItHf++NJDCuD4wH3cJtnNs2PJoQ=
dependencies:
debug "^3.2.6"
iconv-lite "^0.4.4"
sax "^1.2.4"

negotiator@^0.6.2:
version "0.6.2"
resolved "https://registry.nlark.com/negotiator/download/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
Expand Down Expand Up @@ -3825,6 +3887,11 @@ parse-json@^5.0.0:
json-parse-even-better-errors "^2.3.0"
lines-and-columns "^1.1.6"

parse-node-version@^1.0.1:
version "1.0.1"
resolved "https://registry.npmmirror.com/parse-node-version/download/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b"
integrity sha1-4rXb7eAOf6m8NjYH9TMn6LBzGJs=

parse-path@^4.0.0:
version "4.0.3"
resolved "https://registry.nlark.com/parse-path/download/parse-path-4.0.3.tgz#82d81ec3e071dcc4ab49aa9f2c9c0b8966bb22bf"
Expand Down Expand Up @@ -3969,6 +4036,11 @@ protocols@^1.1.0, protocols@^1.4.0:
resolved "https://registry.nlark.com/protocols/download/protocols-1.4.8.tgz#48eea2d8f58d9644a4a32caae5d5db290a075ce8"
integrity sha1-SO6i2PWNlkSkoyyq5dXbKQoHXOg=

prr@~1.0.1:
version "1.0.1"
resolved "https://registry.nlark.com/prr/download/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"
integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY=

psl@^1.1.28:
version "1.8.0"
resolved "https://registry.nlark.com/psl/download/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24"
Expand Down Expand Up @@ -4303,6 +4375,11 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1:
resolved "https://registry.nlark.com/safer-buffer/download/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo=

sax@^1.2.4:
version "1.2.4"
resolved "https://registry.nlark.com/sax/download/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha1-KBYjTiN4vdxOU1T6tcqold9xANk=

scheduler@^0.20.2:
version "0.20.2"
resolved "https://registry.npmmirror.com/scheduler/download/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91"
Expand Down Expand Up @@ -4426,7 +4503,7 @@ source-map@^0.5.0:
resolved "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=

source-map@^0.6.1:
source-map@^0.6.1, source-map@~0.6.0:
version "0.6.1"
resolved "https://registry.nlark.com/source-map/download/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha1-dHIq8y6WFOnCh6jQu95IteLxomM=
Expand Down Expand Up @@ -4745,6 +4822,11 @@ tslib@^1.9.0:
resolved "https://registry.npmmirror.com/tslib/download/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tslib@^2.3.0:
version "2.3.1"
resolved "https://registry.npmmirror.com/tslib/download/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==

tunnel-agent@^0.6.0:
version "0.6.0"
resolved "https://registry.nlark.com/tunnel-agent/download/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"build": "lerna run build",
"ver": "lerna version",
"pub": "lerna publish from-git",
"dev": "npm run dev:demo",
"dev:demo": "cd example && vite",
"dev:packages": "lerna run dev --parallel",
"build:demo": "cd example && vite build"
Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/Service/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ type IGetGlobalFiles = (options: { absSrcPath: string; files: string[]; checkExi
* @param files default load global files
*/
export const getGlobalFiles: IGetGlobalFiles = ({ absSrcPath, files }) => {
return files
.map((file) => join(absSrcPath || '', file))
.filter((file) => existsSync(file))
.slice(0, 1);
return files.map((file) => join(absSrcPath || '', file)).filter((file) => existsSync(file));
};

export const isDynamicRoute = (path: string): boolean =>
Expand Down
3 changes: 2 additions & 1 deletion packages/vit/src/generateFiles/vit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import { renderRoutes } from '@vitjs/runtime';
{{/COMMENT}}
import { Router, history } from '@vitjs/runtime';

import getRoutes from './routes';
{{ #imports }}
{{{ imports }}}
{{ /imports }}

import getRoutes from './routes';

{{ #entryCodeAhead }}
{{{ entryCodeAhead }}}
{{ /entryCodeAhead }}
Expand Down

0 comments on commit 239961d

Please sign in to comment.