@cm-sigoo-temp/ui 0.2.0 → 0.2.2

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.
@@ -0,0 +1,8 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ type ViteAppPluginOptions = {
4
+ nombre: string;
5
+ } | string;
6
+ declare function export_default(options: ViteAppPluginOptions): Plugin;
7
+
8
+ export { type ViteAppPluginOptions, export_default as default };
@@ -0,0 +1,2 @@
1
+ import{createWriteStream as S,existsSync as p}from"node:fs";import{copyFile as I,mkdir as v}from"node:fs/promises";import{get as x}from"node:http";import{tmpdir as O}from"node:os";import{join as a,resolve as m}from"node:path";var c=e=>async o=>{if(!e||o)return;let r=O(),t=a(r,"cm-sigoo-temp-ui-temp"),i=a(t,"silent-check-sso.html"),d=new URL("/silent-check-sso.html","https://cm-sigoo-temp-ui-dev.firebaseapp.com");if(p(t)||await v(t),!p(i)){let s=S(i);await new Promise((h,u)=>x(d,_=>{_.pipe(s),s.on("finish",()=>h(null)),s.on("error",T=>u(T))}))}let g=m(__dirname,"dist"),f=m(g,"silent-check-sso.html");await I(i,f)};var l=(e,o)=>r=>({html:r,tags:[{tag:"meta",attrs:{charset:"UTF-8"},injectTo:"head-prepend"},{tag:"meta",attrs:{name:"viewport",content:"width=device-width, initial-scale=1.0"},injectTo:"head-prepend"},{tag:"title",children:e,injectTo:"head-prepend"},{tag:"link",attrs:{rel:"stylesheet",href:"https://fonts.googleapis.com/icon?family=Material+Icons"},injectTo:"head-prepend"},{tag:"link",attrs:{rel:"icon",type:"image/png",href:"https://cm-sigoo-temp-ui-dev.firebaseapp.com/favicon-96x96.png",sizes:"96x96"},injectTo:"head-prepend"},{tag:"link",attrs:{rel:"icon",type:"image/svg+xml",href:"https://cm-sigoo-temp-ui-dev.firebaseapp.com/favicon.svg"},injectTo:"head-prepend"},{tag:"link",attrs:{rel:"apple-touch-icon",sizes:"180x180",href:"https://cm-sigoo-temp-ui-dev.firebaseapp.com/apple-touch-icon.png"},injectTo:"head-prepend"},...o?[{tag:"script",attrs:{type:"importmap",src:"https://cm-sigoo-temp-ui-dev.firebaseapp.com/lib/importmap.json"},injectTo:"head-prepend"}]:[]]});function H(e){let{nombre:o}=typeof e=="string"?{nombre:e}:e,r=`Sigoo ${o} - Coordinadora S.A`,n;return{name:"cm-sigoo-temp-ui-app",configResolved(t){n=t},transformIndexHtml(...t){return l(r,n.command==="build")(...t)},buildEnd(t){return c(n.command==="build")(t)}}}export{H as default};
2
+ //# sourceMappingURL=app.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../node/vite/app/buildEnd.ts","../../node/vite/app/transformIndexHtml.ts","../../node/vite/app/app.plugin.ts"],"sourcesContent":["import { createWriteStream, existsSync } from 'node:fs';\nimport { copyFile, mkdir } from 'node:fs/promises';\nimport { get } from 'node:http';\nimport { tmpdir } from 'node:os';\nimport { join, resolve } from 'node:path';\n\nexport const getBuildEnd = (build: boolean) => async (error?: Error) => {\n if (!build || error) return;\n\n const temp = tmpdir();\n const tempDir = 'cm-sigoo-temp-ui-temp';\n\n const rutaTemp = join(temp, tempDir);\n const rutaSCSso = join(rutaTemp, 'silent-check-sso.html');\n\n const urlSCSso = new URL(\n '/silent-check-sso.html',\n process.env.URL__CM_SIGOO_TEMP_UI,\n );\n\n if (!existsSync(rutaTemp)) await mkdir(rutaTemp);\n if (!existsSync(rutaSCSso)) {\n const file = createWriteStream(rutaSCSso);\n await new Promise((resolve, reject) =>\n get(urlSCSso, (response) => {\n response.pipe(file);\n file.on('finish', () => resolve(null));\n file.on('error', (error) => reject(error));\n }),\n );\n }\n\n const rutaDist = resolve(__dirname, 'dist');\n const rutaDistSCSso = resolve(rutaDist, 'silent-check-sso.html');\n\n await copyFile(rutaSCSso, rutaDistSCSso);\n};\n","import { HtmlTagDescriptor, IndexHtmlTransformHook } from 'vite';\n\nexport const getTransformIndexHtml =\n (titulo: string, build: boolean): IndexHtmlTransformHook =>\n (html) => {\n const importmapScriptTag: HtmlTagDescriptor = {\n tag: 'script',\n attrs: {\n type: 'importmap',\n src: `${process.env.URL__CM_SIGOO_TEMP_UI}/lib/importmap.json`,\n },\n injectTo: 'head-prepend',\n };\n\n return {\n html,\n tags: [\n {\n tag: 'meta',\n attrs: {\n charset: 'UTF-8',\n },\n injectTo: 'head-prepend',\n },\n {\n tag: 'meta',\n attrs: {\n name: 'viewport',\n content: 'width=device-width, initial-scale=1.0',\n },\n injectTo: 'head-prepend',\n },\n {\n tag: 'title',\n children: titulo,\n injectTo: 'head-prepend',\n },\n {\n tag: 'link',\n attrs: {\n rel: 'stylesheet',\n href: 'https://fonts.googleapis.com/icon?family=Material+Icons',\n },\n injectTo: 'head-prepend',\n },\n {\n tag: 'link',\n attrs: {\n rel: 'icon',\n type: 'image/png',\n href: `${process.env.URL__CM_SIGOO_TEMP_UI}/favicon-96x96.png`,\n sizes: '96x96',\n },\n injectTo: 'head-prepend',\n },\n {\n tag: 'link',\n attrs: {\n rel: 'icon',\n type: 'image/svg+xml',\n href: `${process.env.URL__CM_SIGOO_TEMP_UI}/favicon.svg`,\n },\n injectTo: 'head-prepend',\n },\n {\n tag: 'link',\n attrs: {\n rel: 'apple-touch-icon',\n sizes: '180x180',\n href: `${process.env.URL__CM_SIGOO_TEMP_UI}/apple-touch-icon.png`,\n },\n injectTo: 'head-prepend',\n },\n ...(build ? [importmapScriptTag] : []),\n ],\n };\n };\n","import { Plugin, ResolvedConfig } from 'vite';\nimport { getBuildEnd } from './buildEnd.ts';\nimport { getTransformIndexHtml } from './transformIndexHtml.ts';\n\nexport type ViteAppPluginOptions =\n | {\n nombre: string;\n }\n | string;\n\nexport default function (options: ViteAppPluginOptions): Plugin {\n const { nombre } =\n typeof options === 'string' ? { nombre: options } : options;\n\n const titulo = `Sigoo ${nombre} - Coordinadora S.A`;\n\n let config: ResolvedConfig;\n\n return {\n name: 'cm-sigoo-temp-ui-app',\n\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n\n transformIndexHtml(...args) {\n return getTransformIndexHtml(titulo, config.command === 'build')(...args);\n },\n\n buildEnd(error) {\n return getBuildEnd(config.command === 'build')(error);\n },\n };\n}\n"],"mappings":"AAAA,OAAS,qBAAAA,EAAmB,cAAAC,MAAkB,UAC9C,OAAS,YAAAC,EAAU,SAAAC,MAAa,mBAChC,OAAS,OAAAC,MAAW,YACpB,OAAS,UAAAC,MAAc,UACvB,OAAS,QAAAC,EAAM,WAAAC,MAAe,YAEvB,IAAMC,EAAeC,GAAmB,MAAOC,GAAkB,CACtE,GAAI,CAACD,GAASC,EAAO,OAErB,IAAMC,EAAON,EAAO,EAGdO,EAAWN,EAAKK,EAFN,uBAEmB,EAC7BE,EAAYP,EAAKM,EAAU,uBAAuB,EAElDE,EAAW,IAAI,IACnB,yBACA,8CACF,EAGA,GADKb,EAAWW,CAAQ,GAAG,MAAMT,EAAMS,CAAQ,EAC3C,CAACX,EAAWY,CAAS,EAAG,CAC1B,IAAME,EAAOf,EAAkBa,CAAS,EACxC,MAAM,IAAI,QAAQ,CAACN,EAASS,IAC1BZ,EAAIU,EAAWG,GAAa,CAC1BA,EAAS,KAAKF,CAAI,EAClBA,EAAK,GAAG,SAAU,IAAMR,EAAQ,IAAI,CAAC,EACrCQ,EAAK,GAAG,QAAUL,GAAUM,EAAON,CAAK,CAAC,CAC3C,CAAC,CACH,CACF,CAEA,IAAMQ,EAAWX,EAAQ,UAAW,MAAM,EACpCY,EAAgBZ,EAAQW,EAAU,uBAAuB,EAE/D,MAAMhB,EAASW,EAAWM,CAAa,CACzC,EClCO,IAAMC,EACX,CAACC,EAAgBC,IAChBC,IAUQ,CACL,KAAAA,EACA,KAAM,CACJ,CACE,IAAK,OACL,MAAO,CACL,QAAS,OACX,EACA,SAAU,cACZ,EACA,CACE,IAAK,OACL,MAAO,CACL,KAAM,WACN,QAAS,uCACX,EACA,SAAU,cACZ,EACA,CACE,IAAK,QACL,SAAUF,EACV,SAAU,cACZ,EACA,CACE,IAAK,OACL,MAAO,CACL,IAAK,aACL,KAAM,yDACR,EACA,SAAU,cACZ,EACA,CACE,IAAK,OACL,MAAO,CACL,IAAK,OACL,KAAM,YACN,KAAM,iEACN,MAAO,OACT,EACA,SAAU,cACZ,EACA,CACE,IAAK,OACL,MAAO,CACL,IAAK,OACL,KAAM,gBACN,KAAM,0DACR,EACA,SAAU,cACZ,EACA,CACE,IAAK,OACL,MAAO,CACL,IAAK,mBACL,MAAO,UACP,KAAM,mEACR,EACA,SAAU,cACZ,EACA,GAAIC,EAAQ,CApE8B,CAC5C,IAAK,SACL,MAAO,CACL,KAAM,YACN,IAAK,iEACP,EACA,SAAU,cACZ,CA6DmC,EAAI,CAAC,CACtC,CACF,GCjEW,SAARE,EAAkBC,EAAuC,CAC9D,GAAM,CAAE,OAAAC,CAAO,EACb,OAAOD,GAAY,SAAW,CAAE,OAAQA,CAAQ,EAAIA,EAEhDE,EAAS,SAASD,CAAM,sBAE1BE,EAEJ,MAAO,CACL,KAAM,uBAEN,eAAeC,EAAgB,CAC7BD,EAASC,CACX,EAEA,sBAAsBC,EAAM,CAC1B,OAAOC,EAAsBJ,EAAQC,EAAO,UAAY,OAAO,EAAE,GAAGE,CAAI,CAC1E,EAEA,SAASE,EAAO,CACd,OAAOC,EAAYL,EAAO,UAAY,OAAO,EAAEI,CAAK,CACtD,CACF,CACF","names":["createWriteStream","existsSync","copyFile","mkdir","get","tmpdir","join","resolve","getBuildEnd","build","error","temp","rutaTemp","rutaSCSso","urlSCSso","file","reject","response","rutaDist","rutaDistSCSso","getTransformIndexHtml","titulo","build","html","app_plugin_default","options","nombre","titulo","config","resolvedConfig","args","getTransformIndexHtml","error","getBuildEnd"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@cm-sigoo-temp/ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "main": "dist/lib/cm-sigoo-temp-ui.js",
6
6
  "types": "dist/lib/lib.d.ts",
7
7
  "files": [
8
8
  "dist/lib/*",
9
- "plugin/*"
9
+ "dist/plugins/*"
10
10
  ],
11
11
  "exports": {
12
12
  ".": "./dist/lib/cm-sigoo-temp-ui.js",
@@ -14,7 +14,9 @@
14
14
  },
15
15
  "typesVersions": {
16
16
  "*": {
17
- "vite-app-plugin": ["dist/plugins/app.plugin.d.ts"]
17
+ "vite-app-plugin": [
18
+ "dist/plugins/app.plugin.d.ts"
19
+ ]
18
20
  }
19
21
  },
20
22
  "scripts": {