create-xmlui-app 0.9.36 → 0.9.38
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.
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Mock Service Worker
|
|
5
|
+
* Mock Service Worker.
|
|
6
6
|
* @see https://github.com/mswjs/msw
|
|
7
7
|
* - Please do NOT modify this file.
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const PACKAGE_VERSION = '2.8.4'
|
|
12
|
+
const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
|
|
12
13
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
13
14
|
const activeClientIds = new Set()
|
|
14
15
|
|
|
@@ -48,7 +49,10 @@ self.addEventListener('message', async function (event) {
|
|
|
48
49
|
case 'INTEGRITY_CHECK_REQUEST': {
|
|
49
50
|
sendToClient(client, {
|
|
50
51
|
type: 'INTEGRITY_CHECK_RESPONSE',
|
|
51
|
-
payload:
|
|
52
|
+
payload: {
|
|
53
|
+
packageVersion: PACKAGE_VERSION,
|
|
54
|
+
checksum: INTEGRITY_CHECKSUM,
|
|
55
|
+
},
|
|
52
56
|
})
|
|
53
57
|
break
|
|
54
58
|
}
|
|
@@ -58,7 +62,12 @@ self.addEventListener('message', async function (event) {
|
|
|
58
62
|
|
|
59
63
|
sendToClient(client, {
|
|
60
64
|
type: 'MOCKING_ENABLED',
|
|
61
|
-
payload:
|
|
65
|
+
payload: {
|
|
66
|
+
client: {
|
|
67
|
+
id: client.id,
|
|
68
|
+
frameType: client.frameType,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
62
71
|
})
|
|
63
72
|
break
|
|
64
73
|
}
|
|
@@ -121,11 +130,6 @@ async function handleRequest(event, requestId) {
|
|
|
121
130
|
if (client && activeClientIds.has(client.id)) {
|
|
122
131
|
;(async function () {
|
|
123
132
|
const responseClone = response.clone()
|
|
124
|
-
// When performing original requests, response body will
|
|
125
|
-
// always be a ReadableStream, even for 204 responses.
|
|
126
|
-
// But when creating a new Response instance on the client,
|
|
127
|
-
// the body for a 204 response must be null.
|
|
128
|
-
const responseBody = response.status === 204 ? null : responseClone.body
|
|
129
133
|
|
|
130
134
|
sendToClient(
|
|
131
135
|
client,
|
|
@@ -137,11 +141,11 @@ async function handleRequest(event, requestId) {
|
|
|
137
141
|
type: responseClone.type,
|
|
138
142
|
status: responseClone.status,
|
|
139
143
|
statusText: responseClone.statusText,
|
|
140
|
-
body:
|
|
144
|
+
body: responseClone.body,
|
|
141
145
|
headers: Object.fromEntries(responseClone.headers.entries()),
|
|
142
146
|
},
|
|
143
147
|
},
|
|
144
|
-
[
|
|
148
|
+
[responseClone.body],
|
|
145
149
|
)
|
|
146
150
|
})()
|
|
147
151
|
}
|
|
@@ -156,6 +160,10 @@ async function handleRequest(event, requestId) {
|
|
|
156
160
|
async function resolveMainClient(event) {
|
|
157
161
|
const client = await self.clients.get(event.clientId)
|
|
158
162
|
|
|
163
|
+
if (activeClientIds.has(event.clientId)) {
|
|
164
|
+
return client
|
|
165
|
+
}
|
|
166
|
+
|
|
159
167
|
if (client?.frameType === 'top-level') {
|
|
160
168
|
return client
|
|
161
169
|
}
|
|
@@ -184,12 +192,26 @@ async function getResponse(event, client, requestId) {
|
|
|
184
192
|
const requestClone = request.clone()
|
|
185
193
|
|
|
186
194
|
function passthrough() {
|
|
187
|
-
|
|
195
|
+
// Cast the request headers to a new Headers instance
|
|
196
|
+
// so the headers can be manipulated with.
|
|
197
|
+
const headers = new Headers(requestClone.headers)
|
|
198
|
+
|
|
199
|
+
// Remove the "accept" header value that marked this request as passthrough.
|
|
200
|
+
// This prevents request alteration and also keeps it compliant with the
|
|
201
|
+
// user-defined CORS policies.
|
|
202
|
+
const acceptHeader = headers.get('accept')
|
|
203
|
+
if (acceptHeader) {
|
|
204
|
+
const values = acceptHeader.split(',').map((value) => value.trim())
|
|
205
|
+
const filteredValues = values.filter(
|
|
206
|
+
(value) => value !== 'msw/passthrough',
|
|
207
|
+
)
|
|
188
208
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
209
|
+
if (filteredValues.length > 0) {
|
|
210
|
+
headers.set('accept', filteredValues.join(', '))
|
|
211
|
+
} else {
|
|
212
|
+
headers.delete('accept')
|
|
213
|
+
}
|
|
214
|
+
}
|
|
193
215
|
|
|
194
216
|
return fetch(requestClone, { headers })
|
|
195
217
|
}
|
|
@@ -207,13 +229,6 @@ async function getResponse(event, client, requestId) {
|
|
|
207
229
|
return passthrough()
|
|
208
230
|
}
|
|
209
231
|
|
|
210
|
-
// Bypass requests with the explicit bypass header.
|
|
211
|
-
// Such requests can be issued by "ctx.fetch()".
|
|
212
|
-
const mswIntention = request.headers.get('x-msw-intention')
|
|
213
|
-
if (['bypass', 'passthrough'].includes(mswIntention)) {
|
|
214
|
-
return passthrough()
|
|
215
|
-
}
|
|
216
|
-
|
|
217
232
|
// Notify the client that a request has been intercepted.
|
|
218
233
|
const requestBuffer = await request.arrayBuffer()
|
|
219
234
|
const clientMessage = await sendToClient(
|
|
@@ -245,7 +260,7 @@ async function getResponse(event, client, requestId) {
|
|
|
245
260
|
return respondWithMock(clientMessage.data)
|
|
246
261
|
}
|
|
247
262
|
|
|
248
|
-
case '
|
|
263
|
+
case 'PASSTHROUGH': {
|
|
249
264
|
return passthrough()
|
|
250
265
|
}
|
|
251
266
|
}
|
package/dist/index.js
CHANGED
|
@@ -63,4 +63,4 @@ var s=r(4300);var i=s.Buffer;function copyProps(t,e){for(var r in t){e[r]=t[r]}}
|
|
|
63
63
|
*
|
|
64
64
|
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
65
65
|
* Released under the MIT License.
|
|
66
|
-
*/const s=r(6110);const toRegexRange=(t,e,r)=>{if(s(t)===false){throw new TypeError("toRegexRange: expected the first argument to be a number")}if(e===void 0||t===e){return String(t)}if(s(e)===false){throw new TypeError("toRegexRange: expected the second argument to be a number.")}let i={relaxZeros:true,...r};if(typeof i.strictZeros==="boolean"){i.relaxZeros=i.strictZeros===false}let n=String(i.relaxZeros);let o=String(i.shorthand);let a=String(i.capture);let l=String(i.wrap);let u=t+":"+e+"="+n+o+a+l;if(toRegexRange.cache.hasOwnProperty(u)){return toRegexRange.cache[u].result}let c=Math.min(t,e);let h=Math.max(t,e);if(Math.abs(c-h)===1){let r=t+"|"+e;if(i.capture){return`(${r})`}if(i.wrap===false){return r}return`(?:${r})`}let d=hasPadding(t)||hasPadding(e);let f={min:t,max:e,a:c,b:h};let p=[];let g=[];if(d){f.isPadded=d;f.maxLen=String(f.max).length}if(c<0){let t=h<0?Math.abs(h):1;g=splitToPatterns(t,Math.abs(c),f,i);c=f.a=0}if(h>=0){p=splitToPatterns(c,h,f,i)}f.negatives=g;f.positives=p;f.result=collatePatterns(g,p,i);if(i.capture===true){f.result=`(${f.result})`}else if(i.wrap!==false&&p.length+g.length>1){f.result=`(?:${f.result})`}toRegexRange.cache[u]=f;return f.result};function collatePatterns(t,e,r){let s=filterPatterns(t,e,"-",false,r)||[];let i=filterPatterns(e,t,"",false,r)||[];let n=filterPatterns(t,e,"-?",true,r)||[];let o=s.concat(n).concat(i);return o.join("|")}function splitToRanges(t,e){let r=1;let s=1;let i=countNines(t,r);let n=new Set([e]);while(t<=i&&i<=e){n.add(i);r+=1;i=countNines(t,r)}i=countZeros(e+1,s)-1;while(t<i&&i<=e){n.add(i);s+=1;i=countZeros(e+1,s)-1}n=[...n];n.sort(compare);return n}function rangeToPattern(t,e,r){if(t===e){return{pattern:t,count:[],digits:0}}let s=zip(t,e);let i=s.length;let n="";let o=0;for(let t=0;t<i;t++){let[e,i]=s[t];if(e===i){n+=e}else if(e!=="0"||i!=="9"){n+=toCharacterClass(e,i,r)}else{o++}}if(o){n+=r.shorthand===true?"\\d":"[0-9]"}return{pattern:n,count:[o],digits:i}}function splitToPatterns(t,e,r,s){let i=splitToRanges(t,e);let n=[];let o=t;let a;for(let t=0;t<i.length;t++){let e=i[t];let l=rangeToPattern(String(o),String(e),s);let u="";if(!r.isPadded&&a&&a.pattern===l.pattern){if(a.count.length>1){a.count.pop()}a.count.push(l.count[0]);a.string=a.pattern+toQuantifier(a.count);o=e+1;continue}if(r.isPadded){u=padZeros(e,r,s)}l.string=u+l.pattern+toQuantifier(l.count);n.push(l);o=e+1;a=l}return n}function filterPatterns(t,e,r,s,i){let n=[];for(let i of t){let{string:t}=i;if(!s&&!contains(e,"string",t)){n.push(r+t)}if(s&&contains(e,"string",t)){n.push(r+t)}}return n}function zip(t,e){let r=[];for(let s=0;s<t.length;s++)r.push([t[s],e[s]]);return r}function compare(t,e){return t>e?1:e>t?-1:0}function contains(t,e,r){return t.some((t=>t[e]===r))}function countNines(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function countZeros(t,e){return t-t%Math.pow(10,e)}function toQuantifier(t){let[e=0,r=""]=t;if(r||e>1){return`{${e+(r?","+r:"")}}`}return""}function toCharacterClass(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function hasPadding(t){return/^-?(0+)\d/.test(t)}function padZeros(t,e,r){if(!e.isPadded){return t}let s=Math.abs(e.maxLen-String(t).length);let i=r.relaxZeros!==false;switch(s){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:{return i?`0{0,${s}}`:`0{${s}}`}}}toRegexRange.cache={};toRegexRange.clearCache=()=>toRegexRange.cache={};t.exports=toRegexRange},5418:(t,e,r)=>{const{URL:s}=r(7310);const{join:i}=r(1017);const n=r(7147);const{promisify:o}=r(3837);const{tmpdir:a}=r(2037);const l=r(2447);const u=o(n.writeFile);const c=o(n.mkdir);const h=o(n.readFile);const compareVersions=(t,e)=>t.localeCompare(e,"en-US",{numeric:true});const encode=t=>encodeURIComponent(t).replace(/^%40/,"@");const getFile=async(t,e)=>{const r=a();const s=i(r,"update-check");if(!n.existsSync(s)){await c(s)}let o=`${t.name}-${e}.json`;if(t.scope){o=`${t.scope}-${o}`}return i(s,o)};const evaluateCache=async(t,e,r)=>{if(n.existsSync(t)){const s=await h(t,"utf8");const{lastUpdate:i,latest:n}=JSON.parse(s);const o=i+r;if(o>e){return{shouldCheck:false,latest:n}}}return{shouldCheck:true,latest:null}};const updateCache=async(t,e,r)=>{const s=JSON.stringify({latest:e,lastUpdate:r});await u(t,s,"utf8")};const loadPackage=(t,e)=>new Promise(((s,i)=>{const n={host:t.hostname,path:t.pathname,port:t.port,headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"},timeout:2e3};if(e){n.headers.authorization=`${e.type} ${e.token}`}const{get:o}=r(t.protocol==="https:"?5687:3685);o(n,(t=>{const{statusCode:e}=t;if(e!==200){const r=new Error(`Request failed with code ${e}`);r.code=e;i(r);t.resume();return}let r="";t.setEncoding("utf8");t.on("data",(t=>{r+=t}));t.on("end",(()=>{try{const t=JSON.parse(r);s(t)}catch(t){i(t)}}))})).on("error",i).on("timeout",i)}));const getMostRecent=async({full:t,scope:e},i)=>{const n=l(e);const o=new s(t,n);let a=null;try{a=await loadPackage(o)}catch(t){if(t.code&&String(t.code).startsWith(4)){const t=r(1384);const e=t(n,{recursive:true});a=await loadPackage(o,e)}else{throw t}}const u=a["dist-tags"][i];if(!u){throw new Error(`Distribution tag ${i} is not available`)}return u};const d={interval:36e5,distTag:"latest"};const getDetails=t=>{const e={full:encode(t)};if(t.includes("/")){const r=t.split("/");e.scope=r[0];e.name=r[1]}else{e.scope=null;e.name=t}return e};t.exports=async(t,e)=>{if(typeof t!=="object"){throw new Error("The first parameter should be your package.json file content")}const r=getDetails(t.name);const s=Date.now();const{distTag:i,interval:n}=Object.assign({},d,e);const o=await getFile(r,i);let a=null;let l=true;({shouldCheck:l,latest:a}=await evaluateCache(o,s,n));if(l){a=await getMostRecent(r,i);await updateCache(o,a,s)}const u=compareVersions(t.version,a);if(u===-1){return{latest:a,fromCache:!l}}return null}},5880:(t,e,r)=>{"use strict";var s=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");var i=r(5462);var n=["node_modules","favicon.ico"];var o=t.exports=function(t){var e=[];var r=[];if(t===null){r.push("name cannot be null");return done(e,r)}if(t===undefined){r.push("name cannot be undefined");return done(e,r)}if(typeof t!=="string"){r.push("name must be a string");return done(e,r)}if(!t.length){r.push("name length must be greater than zero")}if(t.match(/^\./)){r.push("name cannot start with a period")}if(t.match(/^_/)){r.push("name cannot start with an underscore")}if(t.trim()!==t){r.push("name cannot contain leading or trailing spaces")}n.forEach((function(e){if(t.toLowerCase()===e){r.push(e+" is a blacklisted name")}}));i.forEach((function(r){if(t.toLowerCase()===r){e.push(r+" is a core module name")}}));if(t.length>214){e.push("name can no longer contain more than 214 characters")}if(t.toLowerCase()!==t){e.push("name can no longer contain capital letters")}if(/[~'!()*]/.test(t.split("/").slice(-1)[0])){e.push('name can no longer contain special characters ("~\'!()*")')}if(encodeURIComponent(t)!==t){var o=t.match(s);if(o){var a=o[1];var l=o[2];if(encodeURIComponent(a)===a&&encodeURIComponent(l)===l){return done(e,r)}}r.push("name can only contain URL-friendly characters")}return done(e,r)};o.scopedPackagePattern=s;var done=function(t,e){var r={validForNewPackages:e.length===0&&t.length===0,validForOldPackages:e.length===0,warnings:t,errors:e};if(!r.warnings.length)delete r.warnings;if(!r.errors.length)delete r.errors;return r}},8201:(t,e,r)=>{const s=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys";const i=r(1017);const n=s?";":":";const o=r(228);const getNotFoundError=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"});const getPathInfo=(t,e)=>{const r=e.colon||n;const i=t.match(/\//)||s&&t.match(/\\/)?[""]:[...s?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)];const o=s?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"";const a=s?o.split(r):[""];if(s){if(t.indexOf(".")!==-1&&a[0]!=="")a.unshift("")}return{pathEnv:i,pathExt:a,pathExtExe:o}};const which=(t,e,r)=>{if(typeof e==="function"){r=e;e={}}if(!e)e={};const{pathEnv:s,pathExt:n,pathExtExe:a}=getPathInfo(t,e);const l=[];const step=r=>new Promise(((n,o)=>{if(r===s.length)return e.all&&l.length?n(l):o(getNotFoundError(t));const a=s[r];const u=/^".*"$/.test(a)?a.slice(1,-1):a;const c=i.join(u,t);const h=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+c:c;n(subStep(h,r,0))}));const subStep=(t,r,s)=>new Promise(((i,u)=>{if(s===n.length)return i(step(r+1));const c=n[s];o(t+c,{pathExt:a},((n,o)=>{if(!n&&o){if(e.all)l.push(t+c);else return i(t+c)}return i(subStep(t,r,s+1))}))}));return r?step(0).then((t=>r(null,t)),r):step(0)};const whichSync=(t,e)=>{e=e||{};const{pathEnv:r,pathExt:s,pathExtExe:n}=getPathInfo(t,e);const a=[];for(let l=0;l<r.length;l++){const u=r[l];const c=/^".*"$/.test(u)?u.slice(1,-1):u;const h=i.join(c,t);const d=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+h:h;for(let t=0;t<s.length;t++){const r=d+s[t];try{const t=o.sync(r,{pathExt:n});if(t){if(e.all)a.push(r);else return r}}catch(t){}}}if(e.all&&a.length)return a;if(e.nothrow)return null;throw getNotFoundError(t)};t.exports=which;which.sync=whichSync},7019:(t,e,r)=>{"use strict";r.r(e);var s=r(9397);var i=r(8018);var n=r.n(i);var o=r(1017);var a=r.n(o);var l=r(1112);var u=r.n(l);var c=r(5418);var h=r.n(c);var d=r(7147);var f=r.n(d);function makeDir(t,e={recursive:true}){return f().promises.mkdir(t,e)}var p=r(2081);function isInGitRepository(){try{(0,p.execSync)("git rev-parse --is-inside-work-tree",{stdio:"ignore"});return true}catch(t){}return false}function isInMercurialRepository(){try{(0,p.execSync)("hg --cwd . root",{stdio:"ignore"});return true}catch(t){}return false}function isDefaultBranchSet(){try{(0,p.execSync)("git config init.defaultBranch",{stdio:"ignore"});return true}catch(t){}return false}function tryGitInit(t){let e=false;try{(0,p.execSync)("git --version",{stdio:"ignore"});if(isInGitRepository()||isInMercurialRepository()){return false}(0,p.execSync)("git init",{stdio:"ignore"});e=true;if(!isDefaultBranchSet()){(0,p.execSync)("git checkout -b main",{stdio:"ignore"})}(0,p.execSync)("git add -A",{stdio:"ignore"});(0,p.execSync)('git commit -m "Initial commit from Create Next App"',{stdio:"ignore"});return true}catch(r){if(e){try{f().rmSync(a().join(t,".git"),{recursive:true,force:true})}catch(t){}}return false}}function isFolderEmpty(t,e){const r=[".DS_Store",".git",".gitattributes",".gitignore",".gitlab-ci.yml",".hg",".hgcheck",".hgignore",".idea",".npmignore",".travis.yml","LICENSE","Thumbs.db","docs","mkdocs.yml","npm-debug.log","yarn-debug.log","yarn-error.log","yarnrc.yml",".yarn"];const i=f().readdirSync(t).filter((t=>!r.includes(t))).filter((t=>!/\.iml$/.test(t)));if(i.length>0){console.log(`The directory ${(0,s.green)(e)} contains files that could conflict:`);console.log();for(const e of i){try{const r=f().lstatSync(a().join(t,e));if(r.isDirectory()){console.log(` ${(0,s.blue)(e)}/`)}else{console.log(` ${e}`)}}catch{console.log(` ${e}`)}}console.log();console.log("Either try using a new directory name, or remove the files listed above.");console.log();return false}return true}async function isWriteable(t){try{await f().promises.access(t,(f().constants||f()).W_OK);return true}catch(t){return false}}var g=r(7987);var m=r.n(g);async function install(t){let e=["install"];return new Promise(((r,s)=>{const i=m()(t,e,{stdio:"inherit",env:{...process.env,ADBLOCK:"1",NODE_ENV:"development",DISABLE_OPENCOLLECTIVE:"1"}});i.on("close",(i=>{if(i!==0){s({command:`${t} ${e.join(" ")}`});return}r()}))}))}var y=r(3909);const identity=t=>t;const copy=async(t,e,{cwd:r,rename:s=identity,parents:i=true}={})=>{const n=typeof t==="string"?[t]:t;if(n.length===0||!e){throw new TypeError("`src` and `dest` are required")}const o=await(0,y.async)(n,{cwd:r,dot:true,absolute:false,stats:false});const l=r?a().resolve(r,e):e;return Promise.all(o.map((async t=>{const e=a().dirname(t);const n=s(a().basename(t));const o=r?a().resolve(r,t):t;const u=i?a().join(l,e,n):a().join(l,n);await f().promises.mkdir(a().dirname(u),{recursive:true});return f().promises.copyFile(o,u)})))};var v=r(2037);var b=r.n(v);const _=require("fs/promises");var S=r.n(_);const w=JSON.parse('{"name":"create-xmlui-app","version":"0.9.36","scripts":{"dev":"mkdir -p dist && cp -r templates/default dist/ && ncc build ./index.ts -w -o dist/","build":"ncc build ./index.ts -o dist/ --minify --no-cache --no-source-map-register && cp -r templates/default dist/","prepublishOnly":"npm run build"},"bin":{"create-xmlui-app":"./dist/index.js"},"files":["dist"],"devDependencies":{"@types/cross-spawn":"6.0.0","@types/node":"^20.2.5","@types/prompts":"2.0.1","@types/validate-npm-package-name":"3.0.0","@vercel/ncc":"0.34.0","fast-glob":"3.3.1","commander":"2.20.0","cross-spawn":"7.0.5","picocolors":"1.0.0","prompts":"2.1.0","update-check":"1.5.4","validate-npm-package-name":"3.0.0"},"engines":{"node":">=18.12.0"},"repository":{"url":"https://github.com/xmlui-com/xmlui.git"}}');const installTemplate=async({appName:t,root:e,packageManager:r,template:i,useGit:n})=>{console.log((0,s.bold)(`Using ${r}.`));console.log("\nInitializing project with template:",i,"\n");const o=a().join(__dirname,i,"ts");const l=["**"];if(!n){l.push("!gitignore")}await copy(l,e,{parents:true,cwd:o,rename(t){switch(t){case"gitignore":case"eslintrc.json":{return`.${t}`}case"README-template.md":{return"README.md"}default:{return t}}}});const u={name:t,version:"0.1.0",private:true,scripts:{start:"xmlui start",build:"xmlui build",preview:"xmlui preview","build-prod":"npm run build -- --prod","release-ci":"npm run build-prod && xmlui zip-dist"},dependencies:{xmlui:w.version}};await S().writeFile(a().join(e,"package.json"),JSON.stringify(u,null,2)+b().EOL);console.log("\nInstalling dependencies:");for(const t in u.dependencies)console.log(`- ${(0,s.cyan)(t)}`);console.log();await install(r)};async function createApp({appPath:t,packageManager:e,useGit:r}){const i="default";const n=a().resolve(t);if(!await isWriteable(a().dirname(n))){console.error("The application path is not writable, please check folder permissions and try again.");console.error("It is likely you do not have write permissions for this folder.");process.exit(1)}const o=a().basename(n);await makeDir(n);if(!isFolderEmpty(n,o)){process.exit(1)}console.log(`Creating a new UI Engine app in ${(0,s.green)(n)}.`);console.log();process.chdir(n);await installTemplate({appName:o,root:n,template:i,packageManager:e,useGit:r});if(r&&tryGitInit(n)){console.log("Initialized a git repository.");console.log()}console.log(`${(0,s.green)("Success!")} Created ${o} at ${t}`);console.log()}var x=r(5880);var P=r.n(x);function validateNpmName(t){const e=P()(t);if(e.validForNewPackages){return{valid:true}}return{valid:false,problems:[...e.errors||[],...e.warnings||[]]}}let E="";const handleSigTerm=()=>process.exit(0);process.on("SIGINT",handleSigTerm);process.on("SIGTERM",handleSigTerm);const onPromptState=t=>{if(t.aborted){process.stdout.write("[?25h");process.stdout.write("\n");process.exit(1)}};const A=new(n().Command)(w.name).version(w.version).arguments("<project-directory>").usage(`${(0,s.green)("<project-directory>")} [options]`).action((t=>{E=t})).option("--use-git",`Explicitly tell the CLI to initialize a git repository`).allowUnknownOption().parse(process.argv);const C="npm";async function run(){if(typeof E==="string"){E=E.trim()}if(!E){const t=await u()({onState:onPromptState,type:"text",name:"path",message:"What is your project named?",initial:"my-app",validate:t=>{const e=validateNpmName(a().basename(a().resolve(t)));if(e.valid){return true}return"Invalid project name: "+e.problems[0]}});if(typeof t.path==="string"){E=t.path.trim()}}if(!E){console.log("\nPlease specify the project directory:\n"+` ${(0,s.cyan)(A.name())} ${(0,s.green)("<project-directory>")}\n`+"For example:\n"+` ${(0,s.cyan)(A.name())} ${(0,s.green)("my-xmlui-app")}\n\n`+`Run ${(0,s.cyan)(`${A.name()} --help`)} to see all options.`);process.exit(1)}const t=a().resolve(E);const e=a().basename(t);const{valid:r,problems:i}=validateNpmName(e);if(!r){console.error(`Could not create a project called ${(0,s.red)(`"${e}"`)} because of npm naming restrictions:`);i.forEach((t=>console.error(` ${(0,s.red)((0,s.bold)("*"))} ${t}`)));process.exit(1)}const n=a().resolve(t);const o=a().basename(n);const l=f().existsSync(n);if(l&&!isFolderEmpty(n,o)){process.exit(1)}if(A.useGit===undefined){const{useGit:t}=await u()({type:"toggle",name:"useGit",message:`Would you like to initialize a git repository?`,initial:false,active:"Yes",inactive:"No"},{onCancel:()=>{console.error("Exiting.");process.exit(1)}});A.useGit=Boolean(t)}await createApp({appPath:t,packageManager:C,useGit:!!A.useGit})}const R=h()(w).catch((()=>null));async function notifyUpdate(){try{const t=await R;if(t===null||t===void 0?void 0:t.latest){const t="npm i -g create-xmlui-app";console.log((0,s.yellow)((0,s.bold)("A new version of `create-xmlui-app` is available!"))+"\n"+"You can update by running: "+(0,s.cyan)(t)+"\n")}process.exit()}catch{}}run().then(notifyUpdate).catch((async t=>{console.log();console.log("Aborting installation.");if(t.command){console.log(` ${(0,s.cyan)(t.command)} has failed.`)}else{console.log((0,s.red)("Unexpected error. Please report it as a bug:")+"\n",t)}console.log();await notifyUpdate();process.exit(1)}))},4300:t=>{"use strict";t.exports=require("buffer")},2081:t=>{"use strict";t.exports=require("child_process")},2361:t=>{"use strict";t.exports=require("events")},7147:t=>{"use strict";t.exports=require("fs")},3685:t=>{"use strict";t.exports=require("http")},5687:t=>{"use strict";t.exports=require("https")},2037:t=>{"use strict";t.exports=require("os")},1017:t=>{"use strict";t.exports=require("path")},4521:t=>{"use strict";t.exports=require("readline")},2781:t=>{"use strict";t.exports=require("stream")},6224:t=>{"use strict";t.exports=require("tty")},7310:t=>{"use strict";t.exports=require("url")},3837:t=>{"use strict";t.exports=require("util")},5462:t=>{"use strict";t.exports=JSON.parse('["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","process","punycode","querystring","readline","repl","stream","string_decoder","timers","tls","tty","url","util","v8","vm","zlib"]')}};var e={};function __nccwpck_require__(r){var s=e[r];if(s!==undefined){return s.exports}var i=e[r]={exports:{}};var n=true;try{t[r](i,i.exports,__nccwpck_require__);n=false}finally{if(n)delete e[r]}return i.exports}(()=>{__nccwpck_require__.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(e,{a:e});return e}})();(()=>{__nccwpck_require__.d=(t,e)=>{for(var r in e){if(__nccwpck_require__.o(e,r)&&!__nccwpck_require__.o(t,r)){Object.defineProperty(t,r,{enumerable:true,get:e[r]})}}}})();(()=>{__nccwpck_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(7019);module.exports=r})();
|
|
66
|
+
*/const s=r(6110);const toRegexRange=(t,e,r)=>{if(s(t)===false){throw new TypeError("toRegexRange: expected the first argument to be a number")}if(e===void 0||t===e){return String(t)}if(s(e)===false){throw new TypeError("toRegexRange: expected the second argument to be a number.")}let i={relaxZeros:true,...r};if(typeof i.strictZeros==="boolean"){i.relaxZeros=i.strictZeros===false}let n=String(i.relaxZeros);let o=String(i.shorthand);let a=String(i.capture);let l=String(i.wrap);let u=t+":"+e+"="+n+o+a+l;if(toRegexRange.cache.hasOwnProperty(u)){return toRegexRange.cache[u].result}let c=Math.min(t,e);let h=Math.max(t,e);if(Math.abs(c-h)===1){let r=t+"|"+e;if(i.capture){return`(${r})`}if(i.wrap===false){return r}return`(?:${r})`}let d=hasPadding(t)||hasPadding(e);let f={min:t,max:e,a:c,b:h};let p=[];let g=[];if(d){f.isPadded=d;f.maxLen=String(f.max).length}if(c<0){let t=h<0?Math.abs(h):1;g=splitToPatterns(t,Math.abs(c),f,i);c=f.a=0}if(h>=0){p=splitToPatterns(c,h,f,i)}f.negatives=g;f.positives=p;f.result=collatePatterns(g,p,i);if(i.capture===true){f.result=`(${f.result})`}else if(i.wrap!==false&&p.length+g.length>1){f.result=`(?:${f.result})`}toRegexRange.cache[u]=f;return f.result};function collatePatterns(t,e,r){let s=filterPatterns(t,e,"-",false,r)||[];let i=filterPatterns(e,t,"",false,r)||[];let n=filterPatterns(t,e,"-?",true,r)||[];let o=s.concat(n).concat(i);return o.join("|")}function splitToRanges(t,e){let r=1;let s=1;let i=countNines(t,r);let n=new Set([e]);while(t<=i&&i<=e){n.add(i);r+=1;i=countNines(t,r)}i=countZeros(e+1,s)-1;while(t<i&&i<=e){n.add(i);s+=1;i=countZeros(e+1,s)-1}n=[...n];n.sort(compare);return n}function rangeToPattern(t,e,r){if(t===e){return{pattern:t,count:[],digits:0}}let s=zip(t,e);let i=s.length;let n="";let o=0;for(let t=0;t<i;t++){let[e,i]=s[t];if(e===i){n+=e}else if(e!=="0"||i!=="9"){n+=toCharacterClass(e,i,r)}else{o++}}if(o){n+=r.shorthand===true?"\\d":"[0-9]"}return{pattern:n,count:[o],digits:i}}function splitToPatterns(t,e,r,s){let i=splitToRanges(t,e);let n=[];let o=t;let a;for(let t=0;t<i.length;t++){let e=i[t];let l=rangeToPattern(String(o),String(e),s);let u="";if(!r.isPadded&&a&&a.pattern===l.pattern){if(a.count.length>1){a.count.pop()}a.count.push(l.count[0]);a.string=a.pattern+toQuantifier(a.count);o=e+1;continue}if(r.isPadded){u=padZeros(e,r,s)}l.string=u+l.pattern+toQuantifier(l.count);n.push(l);o=e+1;a=l}return n}function filterPatterns(t,e,r,s,i){let n=[];for(let i of t){let{string:t}=i;if(!s&&!contains(e,"string",t)){n.push(r+t)}if(s&&contains(e,"string",t)){n.push(r+t)}}return n}function zip(t,e){let r=[];for(let s=0;s<t.length;s++)r.push([t[s],e[s]]);return r}function compare(t,e){return t>e?1:e>t?-1:0}function contains(t,e,r){return t.some((t=>t[e]===r))}function countNines(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function countZeros(t,e){return t-t%Math.pow(10,e)}function toQuantifier(t){let[e=0,r=""]=t;if(r||e>1){return`{${e+(r?","+r:"")}}`}return""}function toCharacterClass(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function hasPadding(t){return/^-?(0+)\d/.test(t)}function padZeros(t,e,r){if(!e.isPadded){return t}let s=Math.abs(e.maxLen-String(t).length);let i=r.relaxZeros!==false;switch(s){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:{return i?`0{0,${s}}`:`0{${s}}`}}}toRegexRange.cache={};toRegexRange.clearCache=()=>toRegexRange.cache={};t.exports=toRegexRange},5418:(t,e,r)=>{const{URL:s}=r(7310);const{join:i}=r(1017);const n=r(7147);const{promisify:o}=r(3837);const{tmpdir:a}=r(2037);const l=r(2447);const u=o(n.writeFile);const c=o(n.mkdir);const h=o(n.readFile);const compareVersions=(t,e)=>t.localeCompare(e,"en-US",{numeric:true});const encode=t=>encodeURIComponent(t).replace(/^%40/,"@");const getFile=async(t,e)=>{const r=a();const s=i(r,"update-check");if(!n.existsSync(s)){await c(s)}let o=`${t.name}-${e}.json`;if(t.scope){o=`${t.scope}-${o}`}return i(s,o)};const evaluateCache=async(t,e,r)=>{if(n.existsSync(t)){const s=await h(t,"utf8");const{lastUpdate:i,latest:n}=JSON.parse(s);const o=i+r;if(o>e){return{shouldCheck:false,latest:n}}}return{shouldCheck:true,latest:null}};const updateCache=async(t,e,r)=>{const s=JSON.stringify({latest:e,lastUpdate:r});await u(t,s,"utf8")};const loadPackage=(t,e)=>new Promise(((s,i)=>{const n={host:t.hostname,path:t.pathname,port:t.port,headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"},timeout:2e3};if(e){n.headers.authorization=`${e.type} ${e.token}`}const{get:o}=r(t.protocol==="https:"?5687:3685);o(n,(t=>{const{statusCode:e}=t;if(e!==200){const r=new Error(`Request failed with code ${e}`);r.code=e;i(r);t.resume();return}let r="";t.setEncoding("utf8");t.on("data",(t=>{r+=t}));t.on("end",(()=>{try{const t=JSON.parse(r);s(t)}catch(t){i(t)}}))})).on("error",i).on("timeout",i)}));const getMostRecent=async({full:t,scope:e},i)=>{const n=l(e);const o=new s(t,n);let a=null;try{a=await loadPackage(o)}catch(t){if(t.code&&String(t.code).startsWith(4)){const t=r(1384);const e=t(n,{recursive:true});a=await loadPackage(o,e)}else{throw t}}const u=a["dist-tags"][i];if(!u){throw new Error(`Distribution tag ${i} is not available`)}return u};const d={interval:36e5,distTag:"latest"};const getDetails=t=>{const e={full:encode(t)};if(t.includes("/")){const r=t.split("/");e.scope=r[0];e.name=r[1]}else{e.scope=null;e.name=t}return e};t.exports=async(t,e)=>{if(typeof t!=="object"){throw new Error("The first parameter should be your package.json file content")}const r=getDetails(t.name);const s=Date.now();const{distTag:i,interval:n}=Object.assign({},d,e);const o=await getFile(r,i);let a=null;let l=true;({shouldCheck:l,latest:a}=await evaluateCache(o,s,n));if(l){a=await getMostRecent(r,i);await updateCache(o,a,s)}const u=compareVersions(t.version,a);if(u===-1){return{latest:a,fromCache:!l}}return null}},5880:(t,e,r)=>{"use strict";var s=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");var i=r(5462);var n=["node_modules","favicon.ico"];var o=t.exports=function(t){var e=[];var r=[];if(t===null){r.push("name cannot be null");return done(e,r)}if(t===undefined){r.push("name cannot be undefined");return done(e,r)}if(typeof t!=="string"){r.push("name must be a string");return done(e,r)}if(!t.length){r.push("name length must be greater than zero")}if(t.match(/^\./)){r.push("name cannot start with a period")}if(t.match(/^_/)){r.push("name cannot start with an underscore")}if(t.trim()!==t){r.push("name cannot contain leading or trailing spaces")}n.forEach((function(e){if(t.toLowerCase()===e){r.push(e+" is a blacklisted name")}}));i.forEach((function(r){if(t.toLowerCase()===r){e.push(r+" is a core module name")}}));if(t.length>214){e.push("name can no longer contain more than 214 characters")}if(t.toLowerCase()!==t){e.push("name can no longer contain capital letters")}if(/[~'!()*]/.test(t.split("/").slice(-1)[0])){e.push('name can no longer contain special characters ("~\'!()*")')}if(encodeURIComponent(t)!==t){var o=t.match(s);if(o){var a=o[1];var l=o[2];if(encodeURIComponent(a)===a&&encodeURIComponent(l)===l){return done(e,r)}}r.push("name can only contain URL-friendly characters")}return done(e,r)};o.scopedPackagePattern=s;var done=function(t,e){var r={validForNewPackages:e.length===0&&t.length===0,validForOldPackages:e.length===0,warnings:t,errors:e};if(!r.warnings.length)delete r.warnings;if(!r.errors.length)delete r.errors;return r}},8201:(t,e,r)=>{const s=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys";const i=r(1017);const n=s?";":":";const o=r(228);const getNotFoundError=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"});const getPathInfo=(t,e)=>{const r=e.colon||n;const i=t.match(/\//)||s&&t.match(/\\/)?[""]:[...s?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)];const o=s?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"";const a=s?o.split(r):[""];if(s){if(t.indexOf(".")!==-1&&a[0]!=="")a.unshift("")}return{pathEnv:i,pathExt:a,pathExtExe:o}};const which=(t,e,r)=>{if(typeof e==="function"){r=e;e={}}if(!e)e={};const{pathEnv:s,pathExt:n,pathExtExe:a}=getPathInfo(t,e);const l=[];const step=r=>new Promise(((n,o)=>{if(r===s.length)return e.all&&l.length?n(l):o(getNotFoundError(t));const a=s[r];const u=/^".*"$/.test(a)?a.slice(1,-1):a;const c=i.join(u,t);const h=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+c:c;n(subStep(h,r,0))}));const subStep=(t,r,s)=>new Promise(((i,u)=>{if(s===n.length)return i(step(r+1));const c=n[s];o(t+c,{pathExt:a},((n,o)=>{if(!n&&o){if(e.all)l.push(t+c);else return i(t+c)}return i(subStep(t,r,s+1))}))}));return r?step(0).then((t=>r(null,t)),r):step(0)};const whichSync=(t,e)=>{e=e||{};const{pathEnv:r,pathExt:s,pathExtExe:n}=getPathInfo(t,e);const a=[];for(let l=0;l<r.length;l++){const u=r[l];const c=/^".*"$/.test(u)?u.slice(1,-1):u;const h=i.join(c,t);const d=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+h:h;for(let t=0;t<s.length;t++){const r=d+s[t];try{const t=o.sync(r,{pathExt:n});if(t){if(e.all)a.push(r);else return r}}catch(t){}}}if(e.all&&a.length)return a;if(e.nothrow)return null;throw getNotFoundError(t)};t.exports=which;which.sync=whichSync},7019:(t,e,r)=>{"use strict";r.r(e);var s=r(9397);var i=r(8018);var n=r.n(i);var o=r(1017);var a=r.n(o);var l=r(1112);var u=r.n(l);var c=r(5418);var h=r.n(c);var d=r(7147);var f=r.n(d);function makeDir(t,e={recursive:true}){return f().promises.mkdir(t,e)}var p=r(2081);function isInGitRepository(){try{(0,p.execSync)("git rev-parse --is-inside-work-tree",{stdio:"ignore"});return true}catch(t){}return false}function isInMercurialRepository(){try{(0,p.execSync)("hg --cwd . root",{stdio:"ignore"});return true}catch(t){}return false}function isDefaultBranchSet(){try{(0,p.execSync)("git config init.defaultBranch",{stdio:"ignore"});return true}catch(t){}return false}function tryGitInit(t){let e=false;try{(0,p.execSync)("git --version",{stdio:"ignore"});if(isInGitRepository()||isInMercurialRepository()){return false}(0,p.execSync)("git init",{stdio:"ignore"});e=true;if(!isDefaultBranchSet()){(0,p.execSync)("git checkout -b main",{stdio:"ignore"})}(0,p.execSync)("git add -A",{stdio:"ignore"});(0,p.execSync)('git commit -m "Initial commit from Create Next App"',{stdio:"ignore"});return true}catch(r){if(e){try{f().rmSync(a().join(t,".git"),{recursive:true,force:true})}catch(t){}}return false}}function isFolderEmpty(t,e){const r=[".DS_Store",".git",".gitattributes",".gitignore",".gitlab-ci.yml",".hg",".hgcheck",".hgignore",".idea",".npmignore",".travis.yml","LICENSE","Thumbs.db","docs","mkdocs.yml","npm-debug.log","yarn-debug.log","yarn-error.log","yarnrc.yml",".yarn"];const i=f().readdirSync(t).filter((t=>!r.includes(t))).filter((t=>!/\.iml$/.test(t)));if(i.length>0){console.log(`The directory ${(0,s.green)(e)} contains files that could conflict:`);console.log();for(const e of i){try{const r=f().lstatSync(a().join(t,e));if(r.isDirectory()){console.log(` ${(0,s.blue)(e)}/`)}else{console.log(` ${e}`)}}catch{console.log(` ${e}`)}}console.log();console.log("Either try using a new directory name, or remove the files listed above.");console.log();return false}return true}async function isWriteable(t){try{await f().promises.access(t,(f().constants||f()).W_OK);return true}catch(t){return false}}var g=r(7987);var m=r.n(g);async function install(t){let e=["install"];return new Promise(((r,s)=>{const i=m()(t,e,{stdio:"inherit",env:{...process.env,ADBLOCK:"1",NODE_ENV:"development",DISABLE_OPENCOLLECTIVE:"1"}});i.on("close",(i=>{if(i!==0){s({command:`${t} ${e.join(" ")}`});return}r()}))}))}var y=r(3909);const identity=t=>t;const copy=async(t,e,{cwd:r,rename:s=identity,parents:i=true}={})=>{const n=typeof t==="string"?[t]:t;if(n.length===0||!e){throw new TypeError("`src` and `dest` are required")}const o=await(0,y.async)(n,{cwd:r,dot:true,absolute:false,stats:false});const l=r?a().resolve(r,e):e;return Promise.all(o.map((async t=>{const e=a().dirname(t);const n=s(a().basename(t));const o=r?a().resolve(r,t):t;const u=i?a().join(l,e,n):a().join(l,n);await f().promises.mkdir(a().dirname(u),{recursive:true});return f().promises.copyFile(o,u)})))};var v=r(2037);var b=r.n(v);const _=require("fs/promises");var S=r.n(_);const w=JSON.parse('{"name":"create-xmlui-app","version":"0.9.38","scripts":{"dev":"mkdir -p dist && cp -r templates/default dist/ && ncc build ./index.ts -w -o dist/","build":"ncc build ./index.ts -o dist/ --minify --no-cache --no-source-map-register && cp -r templates/default dist/","prepublishOnly":"npm run build"},"bin":{"create-xmlui-app":"./dist/index.js"},"files":["dist"],"devDependencies":{"@types/cross-spawn":"6.0.0","@types/node":"^20.2.5","@types/prompts":"2.0.1","@types/validate-npm-package-name":"3.0.0","@vercel/ncc":"0.34.0","fast-glob":"3.3.1","commander":"2.20.0","cross-spawn":"7.0.5","picocolors":"1.0.0","prompts":"2.1.0","update-check":"1.5.4","validate-npm-package-name":"3.0.0"},"engines":{"node":">=18.12.0"},"repository":{"url":"https://github.com/xmlui-com/xmlui.git"}}');const installTemplate=async({appName:t,root:e,packageManager:r,template:i,useGit:n})=>{console.log((0,s.bold)(`Using ${r}.`));console.log("\nInitializing project with template:",i,"\n");const o=a().join(__dirname,i,"ts");const l=["**"];if(!n){l.push("!gitignore")}await copy(l,e,{parents:true,cwd:o,rename(t){switch(t){case"gitignore":case"eslintrc.json":{return`.${t}`}case"README-template.md":{return"README.md"}default:{return t}}}});const u={name:t,version:"0.1.0",private:true,scripts:{start:"xmlui start",build:"xmlui build",preview:"xmlui preview","build-prod":"npm run build -- --prod","release-ci":"npm run build-prod && xmlui zip-dist"},dependencies:{xmlui:w.version}};await S().writeFile(a().join(e,"package.json"),JSON.stringify(u,null,2)+b().EOL);console.log("\nInstalling dependencies:");for(const t in u.dependencies)console.log(`- ${(0,s.cyan)(t)}`);console.log();await install(r)};async function createApp({appPath:t,packageManager:e,useGit:r}){const i="default";const n=a().resolve(t);if(!await isWriteable(a().dirname(n))){console.error("The application path is not writable, please check folder permissions and try again.");console.error("It is likely you do not have write permissions for this folder.");process.exit(1)}const o=a().basename(n);await makeDir(n);if(!isFolderEmpty(n,o)){process.exit(1)}console.log(`Creating a new UI Engine app in ${(0,s.green)(n)}.`);console.log();process.chdir(n);await installTemplate({appName:o,root:n,template:i,packageManager:e,useGit:r});if(r&&tryGitInit(n)){console.log("Initialized a git repository.");console.log()}console.log(`${(0,s.green)("Success!")} Created ${o} at ${t}`);console.log()}var x=r(5880);var P=r.n(x);function validateNpmName(t){const e=P()(t);if(e.validForNewPackages){return{valid:true}}return{valid:false,problems:[...e.errors||[],...e.warnings||[]]}}let E="";const handleSigTerm=()=>process.exit(0);process.on("SIGINT",handleSigTerm);process.on("SIGTERM",handleSigTerm);const onPromptState=t=>{if(t.aborted){process.stdout.write("[?25h");process.stdout.write("\n");process.exit(1)}};const A=new(n().Command)(w.name).version(w.version).arguments("<project-directory>").usage(`${(0,s.green)("<project-directory>")} [options]`).action((t=>{E=t})).option("--use-git",`Explicitly tell the CLI to initialize a git repository`).allowUnknownOption().parse(process.argv);const C="npm";async function run(){if(typeof E==="string"){E=E.trim()}if(!E){const t=await u()({onState:onPromptState,type:"text",name:"path",message:"What is your project named?",initial:"my-app",validate:t=>{const e=validateNpmName(a().basename(a().resolve(t)));if(e.valid){return true}return"Invalid project name: "+e.problems[0]}});if(typeof t.path==="string"){E=t.path.trim()}}if(!E){console.log("\nPlease specify the project directory:\n"+` ${(0,s.cyan)(A.name())} ${(0,s.green)("<project-directory>")}\n`+"For example:\n"+` ${(0,s.cyan)(A.name())} ${(0,s.green)("my-xmlui-app")}\n\n`+`Run ${(0,s.cyan)(`${A.name()} --help`)} to see all options.`);process.exit(1)}const t=a().resolve(E);const e=a().basename(t);const{valid:r,problems:i}=validateNpmName(e);if(!r){console.error(`Could not create a project called ${(0,s.red)(`"${e}"`)} because of npm naming restrictions:`);i.forEach((t=>console.error(` ${(0,s.red)((0,s.bold)("*"))} ${t}`)));process.exit(1)}const n=a().resolve(t);const o=a().basename(n);const l=f().existsSync(n);if(l&&!isFolderEmpty(n,o)){process.exit(1)}if(A.useGit===undefined){const{useGit:t}=await u()({type:"toggle",name:"useGit",message:`Would you like to initialize a git repository?`,initial:false,active:"Yes",inactive:"No"},{onCancel:()=>{console.error("Exiting.");process.exit(1)}});A.useGit=Boolean(t)}await createApp({appPath:t,packageManager:C,useGit:!!A.useGit})}const R=h()(w).catch((()=>null));async function notifyUpdate(){try{const t=await R;if(t===null||t===void 0?void 0:t.latest){const t="npm i -g create-xmlui-app";console.log((0,s.yellow)((0,s.bold)("A new version of `create-xmlui-app` is available!"))+"\n"+"You can update by running: "+(0,s.cyan)(t)+"\n")}process.exit()}catch{}}run().then(notifyUpdate).catch((async t=>{console.log();console.log("Aborting installation.");if(t.command){console.log(` ${(0,s.cyan)(t.command)} has failed.`)}else{console.log((0,s.red)("Unexpected error. Please report it as a bug:")+"\n",t)}console.log();await notifyUpdate();process.exit(1)}))},4300:t=>{"use strict";t.exports=require("buffer")},2081:t=>{"use strict";t.exports=require("child_process")},2361:t=>{"use strict";t.exports=require("events")},7147:t=>{"use strict";t.exports=require("fs")},3685:t=>{"use strict";t.exports=require("http")},5687:t=>{"use strict";t.exports=require("https")},2037:t=>{"use strict";t.exports=require("os")},1017:t=>{"use strict";t.exports=require("path")},4521:t=>{"use strict";t.exports=require("readline")},2781:t=>{"use strict";t.exports=require("stream")},6224:t=>{"use strict";t.exports=require("tty")},7310:t=>{"use strict";t.exports=require("url")},3837:t=>{"use strict";t.exports=require("util")},5462:t=>{"use strict";t.exports=JSON.parse('["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","process","punycode","querystring","readline","repl","stream","string_decoder","timers","tls","tty","url","util","v8","vm","zlib"]')}};var e={};function __nccwpck_require__(r){var s=e[r];if(s!==undefined){return s.exports}var i=e[r]={exports:{}};var n=true;try{t[r](i,i.exports,__nccwpck_require__);n=false}finally{if(n)delete e[r]}return i.exports}(()=>{__nccwpck_require__.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(e,{a:e});return e}})();(()=>{__nccwpck_require__.d=(t,e)=>{for(var r in e){if(__nccwpck_require__.o(e,r)&&!__nccwpck_require__.o(t,r)){Object.defineProperty(t,r,{enumerable:true,get:e[r]})}}}})();(()=>{__nccwpck_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(7019);module.exports=r})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-xmlui-app",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.38",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "mkdir -p dist && cp -r templates/default dist/ && ncc build ./index.ts -w -o dist/",
|
|
6
6
|
"build": "ncc build ./index.ts -o dist/ --minify --no-cache --no-source-map-register && cp -r templates/default dist/",
|