@spiffcommerce/theme-bridge 1.25.3 → 1.25.4-alpha.0
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/configurationTypes-6D808idm.js +9 -0
- package/dist/configurationTypes-6D808idm.js.map +1 -0
- package/dist/configurationTypes-Bt8NVGKp.cjs +2 -0
- package/dist/configurationTypes-Bt8NVGKp.cjs.map +1 -0
- package/dist/index.cjs +52 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +71 -71
- package/dist/index.js +4957 -5000
- package/dist/index.js.map +1 -1
- package/dist/plugin.cjs +2 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.js +52 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +18 -7
- /package/dist/{index.css → theme-bridge.css} +0 -0
package/dist/plugin.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./configurationTypes-Bt8NVGKp.cjs"),f=require("fs"),m=require("path"),y="1.25.3",h={version:y};function g(i,e,r){return e.type==="chunk"?(console.log(`chunk ${i} isEntry: ${e.isEntry}, isDynamicEntry: ${e.isDynamicEntry}, isImplicitEntry: ${e.isImplicitEntry}`),!e.isEntry&&!r?null:{type:u.ThemeFileType.Javascript,mimeType:"text/javascript",preload:!e.isEntry,filename:i}):i.endsWith(".css")?{type:u.ThemeFileType.CSS,mimeType:"text/css",filename:i}:null}function v(i){const{autoGenerateTargetFiles:e=!0,configurationSchema:r,includePreloadChunks:l=!1,targetFiles:s}=i??{};return{name:"spiff-theme-plugin",version:h.version,config(n,o){n.base!==void 0&&n.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),n.base=""},writeBundle(n,o){const a=e?Object.keys(o).map(t=>s?.some(p=>p.filename===t)?null:g(t,o[t],l)).filter(t=>t!==null):[];s&&a.push(...s);const c={launchData:{targetFiles:a},configurationSchema:r};f.writeFileSync(m.join(n.dir,"spiffTheme.json"),JSON.stringify(c,void 0,4))}}}exports.spiffThemePlugin=v;
|
|
2
|
+
//# sourceMappingURL=plugin.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs","sources":["../src/rollup.ts"],"sourcesContent":["import {\n ThemeConfigurationFile,\n ThemeConfigurationLaunchDataTargetFile,\n ThemeConfigurationSchema,\n ThemeFileType,\n} from \"./configurationTypes\";\nimport { Plugin } from \"vite\";\nimport { OutputAsset, OutputChunk } from \"rollup\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport pkg from \"../package.json\";\n\nfunction mapFile(key: string, file: OutputAsset | OutputChunk, includePreload: boolean) {\n if (file.type === \"chunk\") {\n console.log(\n `chunk ${key} isEntry: ${file.isEntry}, isDynamicEntry: ${file.isDynamicEntry}, isImplicitEntry: ${file.isImplicitEntry}`,\n );\n if (!file.isEntry && !includePreload) {\n return null;\n }\n return {\n type: ThemeFileType.Javascript,\n mimeType: \"text/javascript\",\n preload: !file.isEntry,\n filename: key,\n };\n } else {\n if (key.endsWith(\".css\")) {\n return {\n type: ThemeFileType.CSS,\n mimeType: \"text/css\",\n filename: key,\n };\n }\n }\n return null;\n}\n\ninterface PluginOptions {\n /**\n * When `true`, will automatically insert files from the build into the `launchData.targetFiles` field.\n * @default true\n */\n autoGenerateTargetFiles?: boolean;\n /**\n * A configuration schema to allow installs to customize your theme.\n * @default undefined\n */\n configurationSchema?: ThemeConfigurationSchema;\n /**\n * Generates `targetFiles` entries with preload set to true. Only applies when `autoGenerateTargetFiles` is set to true.\n * By default this will only include the primary entry file(s).\n * @default false\n */\n includePreloadChunks?: boolean;\n /**\n * Manually add/override specific files.\n * @default undefined\n */\n targetFiles?: ThemeConfigurationLaunchDataTargetFile[];\n}\n\n/**\n * Automatically generates a `spiffTheme.json` file in your output directory.\n * @param opts Options to customize the generated file.\n */\nexport function spiffThemePlugin(opts?: PluginOptions): Plugin {\n const {\n autoGenerateTargetFiles = true,\n configurationSchema,\n includePreloadChunks = false,\n targetFiles,\n } = opts ?? ({} as PluginOptions);\n return {\n name: \"spiff-theme-plugin\",\n version: pkg.version,\n config(config, _env) {\n if (config.base !== undefined && config.base !== \"\") {\n console.warn(\n 'You have specified a `base` in your vite configuration other than \"\". This value will now be overwritten.',\n );\n }\n config.base = \"\";\n },\n writeBundle(this, options, bundle) {\n const files = autoGenerateTargetFiles\n ? (Object.keys(bundle)\n .map((key) => {\n // Override files will be included manually after\n if (targetFiles?.some((file) => file.filename === key)) {\n return null;\n }\n return mapFile(key, bundle[key], includePreloadChunks);\n })\n .filter((x) => x !== null) as ThemeConfigurationLaunchDataTargetFile[])\n : [];\n if (targetFiles) {\n files.push(...targetFiles);\n }\n const config: ThemeConfigurationFile = {\n launchData: {\n targetFiles: files,\n },\n configurationSchema: configurationSchema,\n };\n fs.writeFileSync(path.join(options.dir!, \"spiffTheme.json\"), JSON.stringify(config, undefined, 4));\n },\n };\n}\n"],"names":["mapFile","key","file","includePreload","ThemeFileType","spiffThemePlugin","opts","autoGenerateTargetFiles","configurationSchema","includePreloadChunks","targetFiles","pkg","config","_env","options","bundle","files","x","fs","path"],"mappings":"gMAYA,SAASA,EAAQC,EAAaC,EAAiCC,EAAyB,CACpF,OAAID,EAAK,OAAS,SACd,QAAQ,IACJ,SAASD,CAAG,aAAaC,EAAK,OAAO,qBAAqBA,EAAK,cAAc,sBAAsBA,EAAK,eAAe,EAAA,EAEvH,CAACA,EAAK,SAAW,CAACC,EACX,KAEJ,CACH,KAAMC,EAAAA,cAAc,WACpB,SAAU,kBACV,QAAS,CAACF,EAAK,QACf,SAAUD,CAAA,GAGVA,EAAI,SAAS,MAAM,EACZ,CACH,KAAMG,EAAAA,cAAc,IACpB,SAAU,WACV,SAAUH,CAAA,EAIf,IACX,CA8BO,SAASI,EAAiBC,EAA8B,CAC3D,KAAM,CACF,wBAAAC,EAA0B,GAC1B,oBAAAC,EACA,qBAAAC,EAAuB,GACvB,YAAAC,CAAA,EACAJ,GAAS,CAAA,EACb,MAAO,CACH,KAAM,qBACN,QAASK,EAAI,QACb,OAAOC,EAAQC,EAAM,CACbD,EAAO,OAAS,QAAaA,EAAO,OAAS,IAC7C,QAAQ,KACJ,2GAAA,EAGRA,EAAO,KAAO,EAClB,EACA,YAAkBE,EAASC,EAAQ,CAC/B,MAAMC,EAAQT,EACP,OAAO,KAAKQ,CAAM,EACd,IAAKd,GAEES,GAAa,KAAMR,GAASA,EAAK,WAAaD,CAAG,EAC1C,KAEJD,EAAQC,EAAKc,EAAOd,CAAG,EAAGQ,CAAoB,CACxD,EACA,OAAQQ,GAAMA,IAAM,IAAI,EAC7B,CAAA,EACFP,GACAM,EAAM,KAAK,GAAGN,CAAW,EAE7B,MAAME,EAAiC,CACnC,WAAY,CACR,YAAaI,CAAA,EAEjB,oBAAAR,CAAA,EAEJU,EAAG,cAAcC,EAAK,KAAKL,EAAQ,IAAM,iBAAiB,EAAG,KAAK,UAAUF,EAAQ,OAAW,CAAC,CAAC,CACrG,CAAA,CAER"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { T as l } from "./configurationTypes-6D808idm.js";
|
|
2
|
+
import p from "fs";
|
|
3
|
+
import f from "path";
|
|
4
|
+
const h = "1.25.3", y = {
|
|
5
|
+
version: h
|
|
6
|
+
};
|
|
7
|
+
function v(i, e, r) {
|
|
8
|
+
return e.type === "chunk" ? (console.log(
|
|
9
|
+
`chunk ${i} isEntry: ${e.isEntry}, isDynamicEntry: ${e.isDynamicEntry}, isImplicitEntry: ${e.isImplicitEntry}`
|
|
10
|
+
), !e.isEntry && !r ? null : {
|
|
11
|
+
type: l.Javascript,
|
|
12
|
+
mimeType: "text/javascript",
|
|
13
|
+
preload: !e.isEntry,
|
|
14
|
+
filename: i
|
|
15
|
+
}) : i.endsWith(".css") ? {
|
|
16
|
+
type: l.CSS,
|
|
17
|
+
mimeType: "text/css",
|
|
18
|
+
filename: i
|
|
19
|
+
} : null;
|
|
20
|
+
}
|
|
21
|
+
function E(i) {
|
|
22
|
+
const {
|
|
23
|
+
autoGenerateTargetFiles: e = !0,
|
|
24
|
+
configurationSchema: r,
|
|
25
|
+
includePreloadChunks: u = !1,
|
|
26
|
+
targetFiles: s
|
|
27
|
+
} = i ?? {};
|
|
28
|
+
return {
|
|
29
|
+
name: "spiff-theme-plugin",
|
|
30
|
+
version: y.version,
|
|
31
|
+
config(n, o) {
|
|
32
|
+
n.base !== void 0 && n.base !== "" && console.warn(
|
|
33
|
+
'You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'
|
|
34
|
+
), n.base = "";
|
|
35
|
+
},
|
|
36
|
+
writeBundle(n, o) {
|
|
37
|
+
const a = e ? Object.keys(o).map((t) => s?.some((m) => m.filename === t) ? null : v(t, o[t], u)).filter((t) => t !== null) : [];
|
|
38
|
+
s && a.push(...s);
|
|
39
|
+
const c = {
|
|
40
|
+
launchData: {
|
|
41
|
+
targetFiles: a
|
|
42
|
+
},
|
|
43
|
+
configurationSchema: r
|
|
44
|
+
};
|
|
45
|
+
p.writeFileSync(f.join(n.dir, "spiffTheme.json"), JSON.stringify(c, void 0, 4));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
E as spiffThemePlugin
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["../src/rollup.ts"],"sourcesContent":["import {\n ThemeConfigurationFile,\n ThemeConfigurationLaunchDataTargetFile,\n ThemeConfigurationSchema,\n ThemeFileType,\n} from \"./configurationTypes\";\nimport { Plugin } from \"vite\";\nimport { OutputAsset, OutputChunk } from \"rollup\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport pkg from \"../package.json\";\n\nfunction mapFile(key: string, file: OutputAsset | OutputChunk, includePreload: boolean) {\n if (file.type === \"chunk\") {\n console.log(\n `chunk ${key} isEntry: ${file.isEntry}, isDynamicEntry: ${file.isDynamicEntry}, isImplicitEntry: ${file.isImplicitEntry}`,\n );\n if (!file.isEntry && !includePreload) {\n return null;\n }\n return {\n type: ThemeFileType.Javascript,\n mimeType: \"text/javascript\",\n preload: !file.isEntry,\n filename: key,\n };\n } else {\n if (key.endsWith(\".css\")) {\n return {\n type: ThemeFileType.CSS,\n mimeType: \"text/css\",\n filename: key,\n };\n }\n }\n return null;\n}\n\ninterface PluginOptions {\n /**\n * When `true`, will automatically insert files from the build into the `launchData.targetFiles` field.\n * @default true\n */\n autoGenerateTargetFiles?: boolean;\n /**\n * A configuration schema to allow installs to customize your theme.\n * @default undefined\n */\n configurationSchema?: ThemeConfigurationSchema;\n /**\n * Generates `targetFiles` entries with preload set to true. Only applies when `autoGenerateTargetFiles` is set to true.\n * By default this will only include the primary entry file(s).\n * @default false\n */\n includePreloadChunks?: boolean;\n /**\n * Manually add/override specific files.\n * @default undefined\n */\n targetFiles?: ThemeConfigurationLaunchDataTargetFile[];\n}\n\n/**\n * Automatically generates a `spiffTheme.json` file in your output directory.\n * @param opts Options to customize the generated file.\n */\nexport function spiffThemePlugin(opts?: PluginOptions): Plugin {\n const {\n autoGenerateTargetFiles = true,\n configurationSchema,\n includePreloadChunks = false,\n targetFiles,\n } = opts ?? ({} as PluginOptions);\n return {\n name: \"spiff-theme-plugin\",\n version: pkg.version,\n config(config, _env) {\n if (config.base !== undefined && config.base !== \"\") {\n console.warn(\n 'You have specified a `base` in your vite configuration other than \"\". This value will now be overwritten.',\n );\n }\n config.base = \"\";\n },\n writeBundle(this, options, bundle) {\n const files = autoGenerateTargetFiles\n ? (Object.keys(bundle)\n .map((key) => {\n // Override files will be included manually after\n if (targetFiles?.some((file) => file.filename === key)) {\n return null;\n }\n return mapFile(key, bundle[key], includePreloadChunks);\n })\n .filter((x) => x !== null) as ThemeConfigurationLaunchDataTargetFile[])\n : [];\n if (targetFiles) {\n files.push(...targetFiles);\n }\n const config: ThemeConfigurationFile = {\n launchData: {\n targetFiles: files,\n },\n configurationSchema: configurationSchema,\n };\n fs.writeFileSync(path.join(options.dir!, \"spiffTheme.json\"), JSON.stringify(config, undefined, 4));\n },\n };\n}\n"],"names":["mapFile","key","file","includePreload","ThemeFileType","spiffThemePlugin","opts","autoGenerateTargetFiles","configurationSchema","includePreloadChunks","targetFiles","pkg","config","_env","options","bundle","files","x","fs","path"],"mappings":";;;;;;AAYA,SAASA,EAAQC,GAAaC,GAAiCC,GAAyB;AACpF,SAAID,EAAK,SAAS,WACd,QAAQ;AAAA,IACJ,SAASD,CAAG,aAAaC,EAAK,OAAO,qBAAqBA,EAAK,cAAc,sBAAsBA,EAAK,eAAe;AAAA,EAAA,GAEvH,CAACA,EAAK,WAAW,CAACC,IACX,OAEJ;AAAA,IACH,MAAMC,EAAc;AAAA,IACpB,UAAU;AAAA,IACV,SAAS,CAACF,EAAK;AAAA,IACf,UAAUD;AAAA,EAAA,KAGVA,EAAI,SAAS,MAAM,IACZ;AAAA,IACH,MAAMG,EAAc;AAAA,IACpB,UAAU;AAAA,IACV,UAAUH;AAAA,EAAA,IAIf;AACX;AA8BO,SAASI,EAAiBC,GAA8B;AAC3D,QAAM;AAAA,IACF,yBAAAC,IAA0B;AAAA,IAC1B,qBAAAC;AAAA,IACA,sBAAAC,IAAuB;AAAA,IACvB,aAAAC;AAAA,EAAA,IACAJ,KAAS,CAAA;AACb,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAASK,EAAI;AAAA,IACb,OAAOC,GAAQC,GAAM;AACjB,MAAID,EAAO,SAAS,UAAaA,EAAO,SAAS,MAC7C,QAAQ;AAAA,QACJ;AAAA,MAAA,GAGRA,EAAO,OAAO;AAAA,IAClB;AAAA,IACA,YAAkBE,GAASC,GAAQ;AAC/B,YAAMC,IAAQT,IACP,OAAO,KAAKQ,CAAM,EACd,IAAI,CAACd,MAEES,GAAa,KAAK,CAACR,MAASA,EAAK,aAAaD,CAAG,IAC1C,OAEJD,EAAQC,GAAKc,EAAOd,CAAG,GAAGQ,CAAoB,CACxD,EACA,OAAO,CAACQ,MAAMA,MAAM,IAAI,IAC7B,CAAA;AACN,MAAIP,KACAM,EAAM,KAAK,GAAGN,CAAW;AAE7B,YAAME,IAAiC;AAAA,QACnC,YAAY;AAAA,UACR,aAAaI;AAAA,QAAA;AAAA,QAEjB,qBAAAR;AAAA,MAAA;AAEJ,MAAAU,EAAG,cAAcC,EAAK,KAAKL,EAAQ,KAAM,iBAAiB,GAAG,KAAK,UAAUF,GAAQ,QAAW,CAAC,CAAC;AAAA,IACrG;AAAA,EAAA;AAER;"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spiffcommerce/theme-bridge",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.4-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "SpiffCommerce",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc && vite build",
|
|
9
|
-
"dev": "
|
|
8
|
+
"build": "tsc --noEmit && vite build",
|
|
9
|
+
"dev": "vite build --watch",
|
|
10
10
|
"test": "vitest",
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|
|
12
12
|
"check-types": "tsc --noEmit",
|
|
13
|
-
"
|
|
13
|
+
"clean": "rm -rf dist src/**/*.js src/**/*.d.ts src/**/*.d.ts.map && git checkout src/dev.css",
|
|
14
|
+
"schema": "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts",
|
|
15
|
+
"size": "size-limit"
|
|
14
16
|
},
|
|
15
17
|
"main": "./dist/index.cjs",
|
|
16
18
|
"module": "./dist/index.js",
|
|
@@ -19,11 +21,20 @@
|
|
|
19
21
|
"./dist"
|
|
20
22
|
],
|
|
21
23
|
"exports": {
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.js",
|
|
27
|
+
"require": "./dist/index.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./plugin": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/plugin.js",
|
|
32
|
+
"require": "./dist/plugin.cjs"
|
|
33
|
+
}
|
|
24
34
|
},
|
|
25
35
|
"dependencies": {
|
|
26
|
-
"@spiffcommerce/core": "^
|
|
36
|
+
"@spiffcommerce/core": "^43.1.0",
|
|
37
|
+
"@spiffcommerce/types": "^1.0.0"
|
|
27
38
|
},
|
|
28
39
|
"peerDependencies": {
|
|
29
40
|
"@repo/core": "*"
|
|
File without changes
|