@keload/node-red-dxp 1.24.0 → 1.24.1
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/cli/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
8
8
|
`),n=r-1;e=[...t.slice(0,n),`... (content truncated to fit terminal)`].join(`
|
|
9
9
|
`)}return this.#c.write(e),this.#e=this.#b(e,t),this}start(e){if(e&&(this.text=e),this.#f)return this;if(!this.#d){let e=` `.repeat(this.#p)+this.#v(this.#h,` `)+(this.text?`- ${this.text}`:``)+this.#y(this.#g,` `);return e.trim()!==``&&this.#c.write(e+`
|
|
10
10
|
`),this}return this.isSpinning?this:(this.#o.hideCursor&&pt.hide(this.#c),this.#o.discardStdin&&l.default.stdin.isTTY&&(this.#t=!0,jn.start()),this.render(),this.#l=setInterval(this.render.bind(this),this.interval),this)}stop(){return clearInterval(this.#l),this.#l=void 0,this.#r=0,this.#d&&(this.clear(),this.#o.hideCursor&&pt.show(this.#c)),this.#o.discardStdin&&l.default.stdin.isTTY&&this.#t&&(jn.stop(),this.#t=!1),this}succeed(e){return this.stopAndPersist({symbol:cn,text:e})}fail(e){return this.stopAndPersist({symbol:un,text:e})}warn(e){return this.stopAndPersist({symbol:ln,text:e})}info(e){return this.stopAndPersist({symbol:sn,text:e})}stopAndPersist(e={}){if(this.#f)return this;let t=e.prefixText??this.#h,n=this.#v(t,` `),r=e.symbol??` `,i=e.text??this.text,a=typeof i==`string`?(r?` `:``)+i:``,o=e.suffixText??this.#g,s=this.#y(o,` `),c=n+r+a+s+`
|
|
11
|
-
`;return this.stop(),this.#c.write(c),this}};function Nn(e){return new Mn(e)}var Pn=`1.
|
|
11
|
+
`;return this.stop(),this.#c.write(c),this}};function Nn(e){return new Mn(e)}var Pn=`1.24.0`;function Fn(e){return Object.prototype.toString.call(e).slice(8,-1)}function W(e){if(Fn(e)!==`Object`)return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function In(e){return Fn(e)===`Symbol`}function Ln(e,t,n,r){let i={}.propertyIsEnumerable.call(r,t)?`enumerable`:`nonenumerable`;i===`enumerable`&&(e[t]=n),i===`nonenumerable`&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function Rn(e,t,n){if(!W(t))return t;let r={};if(W(e)){let n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertySymbols(e);r=[...n,...i].reduce((n,r)=>{if(r===`__proto__`)return n;let i=e[r];return(!In(r)&&!Object.getOwnPropertyNames(t).includes(r)||In(r)&&!Object.getOwnPropertySymbols(t).includes(r))&&Ln(n,r,i,e),n},{})}let i=Object.getOwnPropertyNames(t),a=Object.getOwnPropertySymbols(t);return[...i,...a].reduce((r,i)=>{if(i===`__proto__`)return r;let a=t[i],o=W(e)?e[i]:void 0;return o!==void 0&&W(a)&&(a=Rn(o,a,n)),Ln(r,i,n?n(o,a,i):a,t),r},r)}function zn(e,...t){return t.reduce((e,t)=>Rn(e,t),e)}const Bn={builder:{outputDir:`dist`,esbuildControllerOptions:{includeInBundle:[]},tailwind:{forcedClassesInclusion:[]},editor:{webComponents:{formRow:!1}}},watcher:{nodeRed:{enabled:!0,path:`~/.node-red`,url:`http://localhost:1880`}}},G={libCacheDir:`.node-red-dxp`,srcDir:`src`,nodesDirName:`nodes`,localesDirName:`locales`,globalStylesName:`styles`,nodes:{controllerName:`controller`,editor:{dirName:`editor`,htmlName:`index`,stylesName:`styles`,tsName:`index`}}},Vn=`node-red-dxp`,Hn=e=>e.replace(`@`,``).replace(`/`,`-`);function Un(){let e=(0,ee.cosmiconfigSync)(`node-red-dxp`);try{let t=e.search();return zn(Bn,t?t.config:{})}catch(e){throw console.error(`Error while loading configuration`,e),e}}const K=Un(),q=process.cwd(),Wn=JSON.parse((0,m.readFileSync)(`${q}/package.json`,`utf-8`)),J=`${q}/${G.srcDir}`,Gn=`${q}/resources`,Kn=`${q}/resources`,Y=`${J}/${G.nodesDirName}`,qn=`${q}/${G.libCacheDir}`,Jn=`${h.default.resolve(__dirname,`..`)}`,Yn=Hn(Wn.name);function Xn(e=[]){return e.map(e=>{let t=e.path,n=`${t}/${G.nodes.editor.dirName}`,r=t.replace(q,``).slice(1),i=`${r}/${G.nodes.editor.dirName}`,a=(0,g.globSync)(`${n}/${G.nodes.editor.stylesName}.scss`),o=(0,g.globSync)(`${t}/docs.mdx`),s=(0,g.globSync)(`${t}/docs.md`),c=(0,_.dash)(e.name);return{fullEditorPath:n,fullPath:t,name:e.name,pascalName:(0,_.pascal)(e.name),dashName:c,relativeEditorPath:i,relativePath:r,nodeIdentifier:`${Yn}-${c}`,fullControllerPath:`${t}/${G.nodes.controllerName}.ts`,editor:{tsPath:`${n}/${G.nodes.editor.tsName}.ts`,htmlPath:`${n}/${G.nodes.editor.htmlName}.html`,pugPath:`${n}/${G.nodes.editor.htmlName}.pug`,scssFiles:a},doc:{mdxFiles:o,mdFiles:s}}})}function Zn(){let e=(0,g.globSync)(`${Y}/**/*`,{onlyDirectories:!0,deep:1,objectMode:!0}),t=Xn(e),n=t.map(e=>e.name);return{currentDir:q,pathSrcDir:J,pathSrcNodesDir:Y,pathResourcesDir:Gn,additionalResourcesDir:Kn,pathDist:`${q}/${K.builder.outputDir}`,currentPackagedDistPath:Jn,cacheDirFiles:{controllerIndex:`${qn}/controller-index.ts`,editorIndex:`${qn}/editor-index.ts`},pathLibCacheDir:qn,packageName:Wn.name,packageNameSlug:Yn,config:K,resolvedSrcPathsScss:(0,g.globSync)(`${J}/${G.globalStylesName}.scss`,{ignore:[`${Y}/**/*.scss`]}),resolvedNodesPaths:e.map(e=>e.path),resolvedSrcLocalesPaths:(0,g.globSync)(`${J}/${G.localesDirName}/*.json`),redServerPath:(0,g.globSync)(`${J}/red-server.ts`),listNodesFull:t,listNodesFullNames:n}}const X=Zn(),Qn=`${h.default.resolve(__dirname,`..`)}`;function Z(e){m.default.existsSync(e)||m.default.mkdirSync(e,{recursive:!0})}async function Q(e,t){try{await p.default.writeFile(e,t)}catch(e){console.error(`Error writing controller index:`,e)}}async function $n(e){for(let t of e)try{let e=h.default.resolve(t),n=await p.default.stat(e).catch(()=>null);n!=null&&n.isDirectory()&&await p.default.rm(e,{recursive:!0,force:!0})}catch(e){console.error(`Error cleaning path (${t}): ${e}`)}}const er={name:`add-credentials-export`,setup(e){e.onLoad({filter:/controller\.ts$/},async e=>{let t=await p.default.readFile(e.path,`utf8`);return/export\s+const\s+credentials\s*=/.test(t)?{contents:t,loader:`ts`}:{contents:`${t}\nexport const credentials = {};`,loader:`ts`}})}},tr=`${X.currentDir}/package.json`;var nr=class{constructor(e){this.params={minify:!1,...e}}async getControllerIndexContent(){return`
|
|
12
12
|
import type { NodeAPI } from 'node-red';
|
|
13
13
|
${X.listNodesFull.map(e=>`// @ts-ignore\nimport ${e.pascalName}, {credentials as cred${e.pascalName}} from '${e.fullControllerPath}';`).join(`
|
|
14
14
|
`)}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|