@code-inspector/vite 1.4.3 → 1.4.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/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var w=Object.defineProperty,j=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var k=(e,n,i)=>n in e?w(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i,f=(e,n)=>{for(var i in n||(n={}))W.call(n,i)&&k(e,i,n[i]);if(h)for(var i of h(n))q.call(n,i)&&k(e,i,n[i]);return e},m=(e,n)=>j(e,P(n));var v=(e,n,i)=>new Promise((t,a)=>{var c=l=>{try{u(i.next(l))}catch(r){a(r)}},s=l=>{try{u(i.throw(l))}catch(r){a(r)}},u=l=>l.done?t(l.value):Promise.resolve(l.value).then(c,s);u((i=i.apply(e,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@code-inspector/core"),d=require("chalk"),y="@code-inspector/vite",C=[{name:"vite:react-babel",package:"@vitejs/plugin-react"},{name:"vite:react-swc",package:"@vitejs/plugin-react-swc"},{name:"vite:react-oxc:config",package:"@vitejs/plugin-react-oxc"},{name:"solid",package:"vite-plugin-solid"},{name:"vite-plugin-qwik",package:"qwikVite"},{name:"vite-plugin-qwik-city",package:"qwikCity"},{name:"vite-plugin-qwik-react",package:"qwikReact"},{name:"vite:preact-jsx",package:"@preact/preset-vite"},{name:"vite-plugin-svelte",package:"@sveltejs/vite-plugin-svelte"}],I=["isJsx","isTsx","lang.jsx","lang.tsx"];function b(e=[]){const n=e.findIndex(i=>i.name===y);C.forEach(i=>{const t=e.findIndex(a=>a.name===i.name);if(t!==-1&&t<n){const a=[d.yellow("[WARNING]"),"You need to put",d.green("code-inspector-plugin"),"before",d.green(i.package),"in the vite config file."];console.log(a.join(" "))}})}function T(e){const n={port:0,entry:"",output:e.output,envDir:""};return m(f({name:y},e.enforcePre===!1?{}:{enforce:"pre"}),{apply(t,{command:a}){return!e.close&&o.isDev(e.dev,a==="serve")},configResolved(t){n.envDir=t.envDir||t.root,n.root=t.root},transform(t,a){return v(this,null,function*(){if(o.isExcludedFile(a,e))return t;t=yield o.getCodeWithWebComponent({options:e,file:a,code:t,record:n});const{escapeTags:c=[],mappings:s}=e,[u,l]=a.split("?",2);let r=o.normalizePath(u);r=o.getMappingFilePath(r,s);const g=new URLSearchParams(l);if(e.match&&!e.match.test(r))return t;let p="";return o.isJsTypeFile(r)||r.endsWith(".vue")&&(I.some(x=>g.get(x)!==null)||g.get("lang")==="tsx"||g.get("lang")==="jsx")?p="jsx":r.endsWith(".html")&&g.get("type")==="template"&&g.has("vue")||r.endsWith(".vue")&&g.get("type")!=="style"&&g.get("raw")===null?p="vue":r.endsWith(".svelte")&&(p="svelte"),p?yield o.transformCode({content:t,filePath:r,fileType:p,escapeTags:c,pathType:e.pathType}):t})},transformIndexHtml(t){return v(this,null,function*(){var c,s;if((s=(c=e.skipSnippets)==null?void 0:c.includes)!=null&&s.call(c,"htmlScript"))return t;const a=yield o.getCodeWithWebComponent({options:m(f({},e),{importClient:"code"}),file:"main.js",code:"",record:n,inject:!0});return t.replace("<head>",'<head><script type="module">\n'.concat(a,"\n<\/script>"))})},configureServer(t){const a=t.config.logger.info;t.config.logger.info=function(c,s){a.call(this,c,s),b(t.config.plugins),t.config.logger.info=a}}})}exports.ViteCodeInspectorPlugin=T;
|
package/dist/index.mjs
CHANGED
|
@@ -116,7 +116,7 @@ function J(e) {
|
|
|
116
116
|
if (e.match && !e.match.test(r))
|
|
117
117
|
return t;
|
|
118
118
|
let g = "";
|
|
119
|
-
return D(r) || r.endsWith(".vue") && (F.some((y) => o.get(y) !== null) || o.get("lang") === "tsx" || o.get("lang") === "jsx") ? g = "jsx" : r.endsWith(".html") && o.get("type") === "template" && o.has("vue") || r.endsWith(".vue") && o.get("type") !== "style" && o.get("raw") === null ? g = "vue" : r.endsWith(".svelte") && (g = "svelte"), g ? R({
|
|
119
|
+
return D(r) || r.endsWith(".vue") && (F.some((y) => o.get(y) !== null) || o.get("lang") === "tsx" || o.get("lang") === "jsx") ? g = "jsx" : r.endsWith(".html") && o.get("type") === "template" && o.has("vue") || r.endsWith(".vue") && o.get("type") !== "style" && o.get("raw") === null ? g = "vue" : r.endsWith(".svelte") && (g = "svelte"), g ? yield R({
|
|
120
120
|
content: t,
|
|
121
121
|
filePath: r,
|
|
122
122
|
fileType: g,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-inspector/vite",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./types/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"chalk": "4.1.1",
|
|
42
|
-
"@code-inspector/core": "1.4.
|
|
42
|
+
"@code-inspector/core": "1.4.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^16.0.1",
|