ladrillosjs 2.0.0-beta.3.4 → 2.0.0-beta.3.5
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/vite.cjs +2 -0
- package/dist/vite.cjs.map +7 -0
- package/dist/vite.js +2 -0
- package/dist/vite.js.map +7 -0
- package/package.json +6 -2
package/dist/vite.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var C=Object.create;var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var S=(o,n)=>{for(var e in n)l(o,e,{get:n[e],enumerable:!0})},d=(o,n,e,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of x(n))!O.call(o,s)&&s!==e&&l(o,s,{get:()=>n[s],enumerable:!(c=v(n,s))||c.enumerable});return o};var a=(o,n,e)=>(e=o!=null?C(D(o)):{},d(n||!o||!o.__esModule?l(e,"default",{value:o,enumerable:!0}):e,o)),j=o=>d(l({},"__esModule",{value:!0}),o);var f=(o,n,e)=>new Promise((c,s)=>{var y=r=>{try{t(e.next(r))}catch(p){s(p)}},u=r=>{try{t(e.throw(r))}catch(p){s(p)}},t=r=>r.done?c(r.value):Promise.resolve(r.value).then(y,u);t((e=e.apply(o,n)).next())});var w={};S(w,{copyComponentsPlugin:()=>g});module.exports=j(w);var i=a(require("fs")),m=a(require("path"));function g(o={}){let{src:n="components",dest:e="components",copyOnDev:c=!1}=o;return{name:"ladrillosjs:copy-components",apply:c?"serve":"build",generateBundle(y,u){return f(this,null,function*(){let t=m.default.resolve(process.cwd(),n),r=m.default.resolve(process.cwd(),"dist",e);if(!i.default.existsSync(t)){console.warn(`[ladrillosjs:copy-components] Source directory not found: ${t}`);return}try{i.default.existsSync(r)&&i.default.rmSync(r,{recursive:!0,force:!0}),i.default.cpSync(t,r,{recursive:!0}),console.log(`[ladrillosjs:copy-components] Copied components from ${t} to ${r}`)}catch(p){throw console.error("[ladrillosjs:copy-components] Error copying components:",p),p}})}}}0&&(module.exports={copyComponentsPlugin});
|
|
2
|
+
//# sourceMappingURL=vite.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/vite/index.ts", "../src/vite/copyComponentsPlugin.ts"],
|
|
4
|
+
"sourcesContent": ["/**\r\n * Vite plugins for LadrillosJS framework\r\n */\r\n\r\nexport {\r\n copyComponentsPlugin,\r\n type CopyComponentsOptions,\r\n} from \"./copyComponentsPlugin\";\r\n", "import { Plugin } from \"vite\";\r\nimport fs from \"fs\";\r\nimport path from \"path\";\r\n\r\nexport interface CopyComponentsOptions {\r\n /**\r\n * Source directory containing components to copy\r\n * @default 'components'\r\n */\r\n src?: string;\r\n /**\r\n * Destination directory in the dist folder\r\n * @default 'components'\r\n */\r\n dest?: string;\r\n /**\r\n * Whether to copy during development\r\n * @default false\r\n */\r\n copyOnDev?: boolean;\r\n}\r\n\r\n/**\r\n * Vite plugin for copying component files to the dist folder during build\r\n *\r\n * @example\r\n * ```typescript\r\n * import { defineConfig } from 'vite';\r\n * import { copyComponentsPlugin } from 'ladrillosjs/vite';\r\n *\r\n * export default defineConfig({\r\n * plugins: [\r\n * copyComponentsPlugin({\r\n * src: 'components',\r\n * dest: 'components',\r\n * copyOnDev: false\r\n * })\r\n * ]\r\n * });\r\n * ```\r\n */\r\nexport function copyComponentsPlugin(\r\n options: CopyComponentsOptions = {}\r\n): Plugin {\r\n const {\r\n src = \"components\",\r\n dest = \"components\",\r\n copyOnDev = false,\r\n } = options;\r\n\r\n return {\r\n name: \"ladrillosjs:copy-components\",\r\n apply: copyOnDev ? \"serve\" : \"build\",\r\n\r\n async generateBundle(_options, bundle) {\r\n const srcDir = path.resolve(process.cwd(), src);\r\n const distDestDir = path.resolve(process.cwd(), \"dist\", dest);\r\n\r\n // Only proceed if source directory exists\r\n if (!fs.existsSync(srcDir)) {\r\n console.warn(\r\n `[ladrillosjs:copy-components] Source directory not found: ${srcDir}`\r\n );\r\n return;\r\n }\r\n\r\n try {\r\n // Remove existing destination directory if it exists\r\n if (fs.existsSync(distDestDir)) {\r\n fs.rmSync(distDestDir, { recursive: true, force: true });\r\n }\r\n\r\n // Copy components folder to dist\r\n fs.cpSync(srcDir, distDestDir, { recursive: true });\r\n console.log(\r\n `[ladrillosjs:copy-components] Copied components from ${srcDir} to ${distDestDir}`\r\n );\r\n } catch (error) {\r\n console.error(\r\n `[ladrillosjs:copy-components] Error copying components:`,\r\n error\r\n );\r\n throw error;\r\n }\r\n },\r\n };\r\n}\r\n\r\nexport default copyComponentsPlugin;\r\n"],
|
|
5
|
+
"mappings": "uwBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GCCA,IAAAI,EAAe,iBACfC,EAAiB,mBAuCV,SAASC,EACdC,EAAiC,CAAC,EAC1B,CACR,GAAM,CACJ,IAAAC,EAAM,aACN,KAAAC,EAAO,aACP,UAAAC,EAAY,EACd,EAAIH,EAEJ,MAAO,CACL,KAAM,8BACN,MAAOG,EAAY,QAAU,QAEvB,eAAeC,EAAUC,EAAQ,QAAAC,EAAA,sBACrC,IAAMC,EAAS,EAAAC,QAAK,QAAQ,QAAQ,IAAI,EAAGP,CAAG,EACxCQ,EAAc,EAAAD,QAAK,QAAQ,QAAQ,IAAI,EAAG,OAAQN,CAAI,EAG5D,GAAI,CAAC,EAAAQ,QAAG,WAAWH,CAAM,EAAG,CAC1B,QAAQ,KACN,6DAA6DA,CAAM,EACrE,EACA,MACF,CAEA,GAAI,CAEE,EAAAG,QAAG,WAAWD,CAAW,GAC3B,EAAAC,QAAG,OAAOD,EAAa,CAAE,UAAW,GAAM,MAAO,EAAK,CAAC,EAIzD,EAAAC,QAAG,OAAOH,EAAQE,EAAa,CAAE,UAAW,EAAK,CAAC,EAClD,QAAQ,IACN,wDAAwDF,CAAM,OAAOE,CAAW,EAClF,CACF,OAASE,EAAO,CACd,cAAQ,MACN,0DACAA,CACF,EACMA,CACR,CACF,GACF,CACF",
|
|
6
|
+
"names": ["index_exports", "__export", "copyComponentsPlugin", "__toCommonJS", "import_fs", "import_path", "copyComponentsPlugin", "options", "src", "dest", "copyOnDev", "_options", "bundle", "__async", "srcDir", "path", "distDestDir", "fs", "error"]
|
|
7
|
+
}
|
package/dist/vite.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var y=(t,c,e)=>new Promise((p,i)=>{var l=o=>{try{n(e.next(o))}catch(r){i(r)}},m=o=>{try{n(e.throw(o))}catch(r){i(r)}},n=o=>o.done?p(o.value):Promise.resolve(o.value).then(l,m);n((e=e.apply(t,c)).next())});import s from"fs";import u from"path";function d(t={}){let{src:c="components",dest:e="components",copyOnDev:p=!1}=t;return{name:"ladrillosjs:copy-components",apply:p?"serve":"build",generateBundle(l,m){return y(this,null,function*(){let n=u.resolve(process.cwd(),c),o=u.resolve(process.cwd(),"dist",e);if(!s.existsSync(n)){console.warn(`[ladrillosjs:copy-components] Source directory not found: ${n}`);return}try{s.existsSync(o)&&s.rmSync(o,{recursive:!0,force:!0}),s.cpSync(n,o,{recursive:!0}),console.log(`[ladrillosjs:copy-components] Copied components from ${n} to ${o}`)}catch(r){throw console.error("[ladrillosjs:copy-components] Error copying components:",r),r}})}}}export{d as copyComponentsPlugin};
|
|
2
|
+
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/vite/copyComponentsPlugin.ts"],
|
|
4
|
+
"sourcesContent": ["import { Plugin } from \"vite\";\r\nimport fs from \"fs\";\r\nimport path from \"path\";\r\n\r\nexport interface CopyComponentsOptions {\r\n /**\r\n * Source directory containing components to copy\r\n * @default 'components'\r\n */\r\n src?: string;\r\n /**\r\n * Destination directory in the dist folder\r\n * @default 'components'\r\n */\r\n dest?: string;\r\n /**\r\n * Whether to copy during development\r\n * @default false\r\n */\r\n copyOnDev?: boolean;\r\n}\r\n\r\n/**\r\n * Vite plugin for copying component files to the dist folder during build\r\n *\r\n * @example\r\n * ```typescript\r\n * import { defineConfig } from 'vite';\r\n * import { copyComponentsPlugin } from 'ladrillosjs/vite';\r\n *\r\n * export default defineConfig({\r\n * plugins: [\r\n * copyComponentsPlugin({\r\n * src: 'components',\r\n * dest: 'components',\r\n * copyOnDev: false\r\n * })\r\n * ]\r\n * });\r\n * ```\r\n */\r\nexport function copyComponentsPlugin(\r\n options: CopyComponentsOptions = {}\r\n): Plugin {\r\n const {\r\n src = \"components\",\r\n dest = \"components\",\r\n copyOnDev = false,\r\n } = options;\r\n\r\n return {\r\n name: \"ladrillosjs:copy-components\",\r\n apply: copyOnDev ? \"serve\" : \"build\",\r\n\r\n async generateBundle(_options, bundle) {\r\n const srcDir = path.resolve(process.cwd(), src);\r\n const distDestDir = path.resolve(process.cwd(), \"dist\", dest);\r\n\r\n // Only proceed if source directory exists\r\n if (!fs.existsSync(srcDir)) {\r\n console.warn(\r\n `[ladrillosjs:copy-components] Source directory not found: ${srcDir}`\r\n );\r\n return;\r\n }\r\n\r\n try {\r\n // Remove existing destination directory if it exists\r\n if (fs.existsSync(distDestDir)) {\r\n fs.rmSync(distDestDir, { recursive: true, force: true });\r\n }\r\n\r\n // Copy components folder to dist\r\n fs.cpSync(srcDir, distDestDir, { recursive: true });\r\n console.log(\r\n `[ladrillosjs:copy-components] Copied components from ${srcDir} to ${distDestDir}`\r\n );\r\n } catch (error) {\r\n console.error(\r\n `[ladrillosjs:copy-components] Error copying components:`,\r\n error\r\n );\r\n throw error;\r\n }\r\n },\r\n };\r\n}\r\n\r\nexport default copyComponentsPlugin;\r\n"],
|
|
5
|
+
"mappings": "6MACA,OAAOA,MAAQ,KACf,OAAOC,MAAU,OAuCV,SAASC,EACdC,EAAiC,CAAC,EAC1B,CACR,GAAM,CACJ,IAAAC,EAAM,aACN,KAAAC,EAAO,aACP,UAAAC,EAAY,EACd,EAAIH,EAEJ,MAAO,CACL,KAAM,8BACN,MAAOG,EAAY,QAAU,QAEvB,eAAeC,EAAUC,EAAQ,QAAAC,EAAA,sBACrC,IAAMC,EAASC,EAAK,QAAQ,QAAQ,IAAI,EAAGP,CAAG,EACxCQ,EAAcD,EAAK,QAAQ,QAAQ,IAAI,EAAG,OAAQN,CAAI,EAG5D,GAAI,CAACQ,EAAG,WAAWH,CAAM,EAAG,CAC1B,QAAQ,KACN,6DAA6DA,CAAM,EACrE,EACA,MACF,CAEA,GAAI,CAEEG,EAAG,WAAWD,CAAW,GAC3BC,EAAG,OAAOD,EAAa,CAAE,UAAW,GAAM,MAAO,EAAK,CAAC,EAIzDC,EAAG,OAAOH,EAAQE,EAAa,CAAE,UAAW,EAAK,CAAC,EAClD,QAAQ,IACN,wDAAwDF,CAAM,OAAOE,CAAW,EAClF,CACF,OAASE,EAAO,CACd,cAAQ,MACN,0DACAA,CACF,EACMA,CACR,CACF,GACF,CACF",
|
|
6
|
+
"names": ["fs", "path", "copyComponentsPlugin", "options", "src", "dest", "copyOnDev", "_options", "bundle", "__async", "srcDir", "path", "distDestDir", "fs", "error"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ladrillosjs",
|
|
3
|
-
"version": "2.0.0-beta.3.
|
|
3
|
+
"version": "2.0.0-beta.3.5",
|
|
4
4
|
"description": "A lightweight, zero-dependency web component framework for building modular web applications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,12 +19,16 @@
|
|
|
19
19
|
"browser": "./dist/ladrillosjs.umd.js",
|
|
20
20
|
"import": "./src/index.ts",
|
|
21
21
|
"require": "./dist/ladrillosjs.cjs.js"
|
|
22
|
+
},
|
|
23
|
+
"./vite": {
|
|
24
|
+
"import": "./dist/vite.js",
|
|
25
|
+
"require": "./dist/vite.cjs"
|
|
22
26
|
}
|
|
23
27
|
},
|
|
24
28
|
"scripts": {
|
|
25
29
|
"prepare": "npm run build && npm run build:types",
|
|
26
30
|
"dev": "vite",
|
|
27
|
-
"build": "vite build",
|
|
31
|
+
"build": "vite build && node scripts/build-vite-plugin.js",
|
|
28
32
|
"build:types": "tsc -p tsconfig.json",
|
|
29
33
|
"preview": "vite preview",
|
|
30
34
|
"test": "vitest",
|