@fastkit/plugboy-sass-plugin 3.0.0 → 3.0.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.
@@ -17,4 +17,3 @@ interface SassPlugin extends Plugin {
17
17
  declare function createSassPlugin(options?: PluginOptions): SassPlugin;
18
18
  //#endregion
19
19
  export { createSassPlugin };
20
- //# sourceMappingURL=plugboy-sass-plugin.d.mts.map
@@ -27,7 +27,7 @@ function createSassPlugin(options = {}) {
27
27
  ...restOptions,
28
28
  options: {
29
29
  ...sassOptions,
30
- loadPaths: Array.from(new Set([...sassOptions?.loadPaths || modulesPaths()]))
30
+ loadPaths: Array.from(/* @__PURE__ */ new Set([...sassOptions?.loadPaths || modulesPaths()]))
31
31
  },
32
32
  output(styles) {
33
33
  _styles = styles;
@@ -1 +1 @@
1
- {"version":3,"file":"plugboy-sass-plugin.mjs","names":[],"sources":["../src/types.ts","../src/utils.ts","../src/plugin.ts"],"sourcesContent":["import { Plugin } from '@fastkit/plugboy';\nimport sass from 'rollup-plugin-sass';\nimport { type Options as SassOptions } from 'sass';\n\ntype RollupPluginSassOptions = NonNullable<Parameters<typeof sass>[0]>;\n\nexport interface PluginOptions extends Pick<\n RollupPluginSassOptions,\n 'include' | 'exclude'\n> {\n sass?: SassOptions<'async'>;\n}\n\nexport const PLUGIN_NAME = 'plugboy-sass';\n\nexport interface SassPlugin extends Plugin {\n name: typeof PLUGIN_NAME;\n _options: PluginOptions;\n}\n","import { parse, resolve } from 'path';\nimport { existsSync } from 'fs';\n\nexport function modulesPaths(absWorkingDir?: string): string[] {\n let path = absWorkingDir || process.cwd();\n const { root } = parse(path);\n const found: string[] = [];\n\n while (path !== root) {\n const filename = resolve(path, 'node_modules');\n if (existsSync(filename)) {\n found.push(filename);\n }\n path = resolve(path, '..');\n }\n return [...found];\n}\n","import { definePlugin, type TryGetWorkspace } from '@fastkit/plugboy';\nimport sass from 'rollup-plugin-sass';\nimport { PLUGIN_NAME, PluginOptions, SassPlugin } from './types';\nimport { modulesPaths } from './utils';\n\nexport function createSassPlugin(options: PluginOptions = {}) {\n let _styles = '';\n\n const { sass: sassOptions, ...restOptions } = options;\n\n const {\n name: _name,\n generateBundle,\n ...sassPluginSettings\n } = sass({\n api: 'modern',\n ...restOptions,\n options: {\n ...sassOptions,\n loadPaths: Array.from(\n new Set([...(sassOptions?.loadPaths || modulesPaths())]),\n ),\n },\n output(styles) {\n _styles = styles;\n },\n });\n\n let _getWorkspace: TryGetWorkspace;\n\n return definePlugin<SassPlugin>({\n name: PLUGIN_NAME,\n _options: options,\n ...(sassPluginSettings as any),\n hooks: {\n setupWorkspace(_, getWorkspace) {\n _getWorkspace = getWorkspace;\n },\n },\n async generateBundle(outputOptions, bundle, isWrite) {\n if (typeof generateBundle === 'function') {\n await generateBundle.call(\n this as any,\n outputOptions as any,\n bundle as any,\n isWrite,\n );\n }\n\n if (!_styles) return;\n\n let cssFile = outputOptions.file;\n\n if (!cssFile) {\n const workspace = _getWorkspace();\n\n const cssExport = workspace?.exports.find((e) => e.id.endsWith('.css'));\n if (cssExport) {\n const tmp = cssExport.id.split('/');\n cssFile = tmp[tmp.length - 1];\n } else {\n const fileNames = Object.keys(bundle);\n const jsFile = fileNames.find((f) => /\\.m?js$/.test(f));\n\n if (!jsFile) {\n return;\n }\n cssFile = jsFile.replace(/\\.m?js$/, '.css');\n }\n }\n this.emitFile({\n type: 'asset',\n name: cssFile,\n fileName: cssFile,\n source: _styles,\n });\n },\n });\n}\n"],"mappings":";;;;;AAaA,MAAa,cAAc;;;ACV3B,SAAgB,aAAa,eAAkC;CAC7D,IAAI,OAAO,iBAAiB,QAAQ,IAAI;CACxC,MAAM,EAAE,SAAS,MAAM,IAAI;CAC3B,MAAM,QAAkB,CAAC;CAEzB,OAAO,SAAS,MAAM;EACpB,MAAM,WAAW,QAAQ,MAAM,cAAc;EAC7C,IAAI,WAAW,QAAQ,GACrB,MAAM,KAAK,QAAQ;EAErB,OAAO,QAAQ,MAAM,IAAI;CAC3B;CACA,OAAO,CAAC,GAAG,KAAK;AAClB;;;ACXA,SAAgB,iBAAiB,UAAyB,CAAC,GAAG;CAC5D,IAAI,UAAU;CAEd,MAAM,EAAE,MAAM,aAAa,GAAG,gBAAgB;CAE9C,MAAM,EACJ,MAAM,OACN,gBACA,GAAG,uBACD,KAAK;EACP,KAAK;EACL,GAAG;EACH,SAAS;GACP,GAAG;GACH,WAAW,MAAM,KACf,IAAI,IAAI,CAAC,GAAI,aAAa,aAAa,aAAa,CAAE,CAAC,CACzD;EACF;EACA,OAAO,QAAQ;GACb,UAAU;EACZ;CACF,CAAC;CAED,IAAI;CAEJ,OAAO,aAAyB;EAC9B,MAAM;EACN,UAAU;EACV,GAAI;EACJ,OAAO,EACL,eAAe,GAAG,cAAc;GAC9B,gBAAgB;EAClB,EACF;EACA,MAAM,eAAe,eAAe,QAAQ,SAAS;GACnD,IAAI,OAAO,mBAAmB,YAC5B,MAAM,eAAe,KACnB,MACA,eACA,QACA,OACF;GAGF,IAAI,CAAC,SAAS;GAEd,IAAI,UAAU,cAAc;GAE5B,IAAI,CAAC,SAAS;IAGZ,MAAM,YAFY,cAEQ,CAAC,EAAE,QAAQ,MAAM,MAAM,EAAE,GAAG,SAAS,MAAM,CAAC;IACtE,IAAI,WAAW;KACb,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;KAClC,UAAU,IAAI,IAAI,SAAS;IAC7B,OAAO;KAEL,MAAM,SADY,OAAO,KAAK,MACP,CAAC,CAAC,MAAM,MAAM,UAAU,KAAK,CAAC,CAAC;KAEtD,IAAI,CAAC,QACH;KAEF,UAAU,OAAO,QAAQ,WAAW,MAAM;IAC5C;GACF;GACA,KAAK,SAAS;IACZ,MAAM;IACN,MAAM;IACN,UAAU;IACV,QAAQ;GACV,CAAC;EACH;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"plugboy-sass-plugin.mjs","names":[],"sources":["../src/types.ts","../src/utils.ts","../src/plugin.ts"],"sourcesContent":["import { Plugin } from '@fastkit/plugboy';\nimport sass from 'rollup-plugin-sass';\nimport { type Options as SassOptions } from 'sass';\n\ntype RollupPluginSassOptions = NonNullable<Parameters<typeof sass>[0]>;\n\nexport interface PluginOptions extends Pick<\n RollupPluginSassOptions,\n 'include' | 'exclude'\n> {\n sass?: SassOptions<'async'>;\n}\n\nexport const PLUGIN_NAME = 'plugboy-sass';\n\nexport interface SassPlugin extends Plugin {\n name: typeof PLUGIN_NAME;\n _options: PluginOptions;\n}\n","import { parse, resolve } from 'path';\nimport { existsSync } from 'fs';\n\nexport function modulesPaths(absWorkingDir?: string): string[] {\n let path = absWorkingDir || process.cwd();\n const { root } = parse(path);\n const found: string[] = [];\n\n while (path !== root) {\n const filename = resolve(path, 'node_modules');\n if (existsSync(filename)) {\n found.push(filename);\n }\n path = resolve(path, '..');\n }\n return [...found];\n}\n","import { definePlugin, type TryGetWorkspace } from '@fastkit/plugboy';\nimport sass from 'rollup-plugin-sass';\nimport { PLUGIN_NAME, PluginOptions, SassPlugin } from './types';\nimport { modulesPaths } from './utils';\n\nexport function createSassPlugin(options: PluginOptions = {}) {\n let _styles = '';\n\n const { sass: sassOptions, ...restOptions } = options;\n\n const {\n name: _name,\n generateBundle,\n ...sassPluginSettings\n } = sass({\n api: 'modern',\n ...restOptions,\n options: {\n ...sassOptions,\n loadPaths: Array.from(\n new Set([...(sassOptions?.loadPaths || modulesPaths())]),\n ),\n },\n output(styles) {\n _styles = styles;\n },\n });\n\n let _getWorkspace: TryGetWorkspace;\n\n return definePlugin<SassPlugin>({\n name: PLUGIN_NAME,\n _options: options,\n ...(sassPluginSettings as any),\n hooks: {\n setupWorkspace(_, getWorkspace) {\n _getWorkspace = getWorkspace;\n },\n },\n async generateBundle(outputOptions, bundle, isWrite) {\n if (typeof generateBundle === 'function') {\n await generateBundle.call(\n this as any,\n outputOptions as any,\n bundle as any,\n isWrite,\n );\n }\n\n if (!_styles) return;\n\n let cssFile = outputOptions.file;\n\n if (!cssFile) {\n const workspace = _getWorkspace();\n\n const cssExport = workspace?.exports.find((e) => e.id.endsWith('.css'));\n if (cssExport) {\n const tmp = cssExport.id.split('/');\n cssFile = tmp[tmp.length - 1];\n } else {\n const fileNames = Object.keys(bundle);\n const jsFile = fileNames.find((f) => /\\.m?js$/.test(f));\n\n if (!jsFile) {\n return;\n }\n cssFile = jsFile.replace(/\\.m?js$/, '.css');\n }\n }\n this.emitFile({\n type: 'asset',\n name: cssFile,\n fileName: cssFile,\n source: _styles,\n });\n },\n });\n}\n"],"mappings":";;;;;AAaA,MAAa,cAAc;;;ACV3B,SAAgB,aAAa,eAAkC;CAC7D,IAAI,OAAO,iBAAiB,QAAQ,IAAI;CACxC,MAAM,EAAE,SAAS,MAAM,IAAI;CAC3B,MAAM,QAAkB,CAAC;CAEzB,OAAO,SAAS,MAAM;EACpB,MAAM,WAAW,QAAQ,MAAM,cAAc;EAC7C,IAAI,WAAW,QAAQ,GACrB,MAAM,KAAK,QAAQ;EAErB,OAAO,QAAQ,MAAM,IAAI;CAC3B;CACA,OAAO,CAAC,GAAG,KAAK;AAClB;;;ACXA,SAAgB,iBAAiB,UAAyB,CAAC,GAAG;CAC5D,IAAI,UAAU;CAEd,MAAM,EAAE,MAAM,aAAa,GAAG,gBAAgB;CAE9C,MAAM,EACJ,MAAM,OACN,gBACA,GAAG,uBACD,KAAK;EACP,KAAK;EACL,GAAG;EACH,SAAS;GACP,GAAG;GACH,WAAW,MAAM,qBACf,IAAI,IAAI,CAAC,GAAI,aAAa,aAAa,aAAa,CAAE,CAAC,CACzD;EACF;EACA,OAAO,QAAQ;GACb,UAAU;EACZ;CACF,CAAC;CAED,IAAI;CAEJ,OAAO,aAAyB;EAC9B,MAAM;EACN,UAAU;EACV,GAAI;EACJ,OAAO,EACL,eAAe,GAAG,cAAc;GAC9B,gBAAgB;EAClB,EACF;EACA,MAAM,eAAe,eAAe,QAAQ,SAAS;GACnD,IAAI,OAAO,mBAAmB,YAC5B,MAAM,eAAe,KACnB,MACA,eACA,QACA,OACF;GAGF,IAAI,CAAC,SAAS;GAEd,IAAI,UAAU,cAAc;GAE5B,IAAI,CAAC,SAAS;IAGZ,MAAM,YAFY,cAEQ,CAAC,EAAE,QAAQ,MAAM,MAAM,EAAE,GAAG,SAAS,MAAM,CAAC;IACtE,IAAI,WAAW;KACb,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;KAClC,UAAU,IAAI,IAAI,SAAS;IAC7B,OAAO;KAEL,MAAM,SADY,OAAO,KAAK,MACP,CAAC,CAAC,MAAM,MAAM,UAAU,KAAK,CAAC,CAAC;KAEtD,IAAI,CAAC,QACH;KAEF,UAAU,OAAO,QAAQ,WAAW,MAAM;IAC5C;GACF;GACA,KAAK,SAAS;IACZ,MAAM;IACN,MAAM;IACN,UAAU;IACV,QAAQ;GACV,CAAC;EACH;CACF,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastkit/plugboy-sass-plugin",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "plugboy-sass-plugin",
5
5
  "keywords": [
6
6
  "plugboy",
@@ -40,10 +40,10 @@
40
40
  "sass": "^1.101.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@fastkit/plugboy": "^1.0.0"
43
+ "@fastkit/plugboy": "^1.0.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "@fastkit/plugboy": "^1.0.0"
46
+ "@fastkit/plugboy": "^1.0.1"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "plugboy build",