@fastkit/vui 0.9.0 → 0.10.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.
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var viteKit = require('@fastkit/vite-kit');
6
4
  var path = require('path');
7
5
  var fs = require('fs-extra');
@@ -9,17 +7,12 @@ var nodeUtil = require('@fastkit/node-util');
9
7
  var eta = require('eta');
10
8
  var tinyLogger = require('@fastkit/tiny-logger');
11
9
 
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
13
-
14
- var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
15
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
16
-
17
10
  const name = 'vui';
18
11
  new tinyLogger.TinyLogger(name);
19
12
  const VuiError = tinyLogger.createTinyError(name);
20
13
 
21
- const VUI_PACKAGE_DIR = path__default.resolve(__dirname, '../..');
22
- const STYLE_AFTER_EFFECTS_PATH = path__default.join(VUI_PACKAGE_DIR, 'src/styles/after-effects.scss');
14
+ const VUI_PACKAGE_DIR = path.resolve(__dirname, '../..');
15
+ const STYLE_AFTER_EFFECTS_PATH = path.join(VUI_PACKAGE_DIR, 'src/styles/after-effects.scss');
23
16
  const COLOR_DUMP_STYLE = `@include dump-color-scheme(true);`;
24
17
  const TEMPLATE = `
25
18
  /* eslint-disable */
@@ -68,19 +61,19 @@ async function renderTemplate({ colorScheme, mediaMatch, uiSettings, icons, __de
68
61
  return result;
69
62
  }
70
63
  function defaultDynamicDest() {
71
- return path__default.resolve('.vui');
64
+ return path.resolve('.vui');
72
65
  }
73
66
  function getBuiltinsDir() {
74
67
  const pkgDir = nodeUtil.findPackageDirSync(undefined, true);
75
68
  if (!pkgDir) {
76
69
  throw new Error(`missing package directory`);
77
70
  }
78
- return path__default.join(pkgDir, 'node_modules/@fastkit/vui/dist/assets/builtins');
71
+ return path.join(pkgDir, 'node_modules/@fastkit/vui/dist/assets/builtins');
79
72
  }
80
73
  function viteVuiPlugin(options = {}) {
81
74
  const plugins = [];
82
75
  const builtinsDir = getBuiltinsDir();
83
- const { colorScheme = path__default.join(builtinsDir, 'color-scheme'), mediaMatch = path__default.join(builtinsDir, 'media-match'), iconFont, iconFontDefaults, onBooted, onBootError, uiSettings = {
76
+ const { colorScheme = path.join(builtinsDir, 'color-scheme'), mediaMatch = path.join(builtinsDir, 'media-match'), iconFont, iconFontDefaults, onBooted, onBootError, uiSettings = {
84
77
  primaryScope: 'primary',
85
78
  plainVariant: 'plain',
86
79
  containedVariant: 'contained',
@@ -131,18 +124,18 @@ function viteVuiPlugin(options = {}) {
131
124
  else {
132
125
  dynamicDest = _dynamicDest;
133
126
  }
134
- const colorSchemeSrc = path__default.resolve(colorScheme);
135
- const colorSchemeDest = path__default.join(dynamicDest, 'color-scheme');
136
- const mediaMatchDest = path__default.join(dynamicDest, 'media-match');
127
+ const colorSchemeSrc = path.resolve(colorScheme);
128
+ const colorSchemeDest = path.join(dynamicDest, 'color-scheme');
129
+ const mediaMatchDest = path.join(dynamicDest, 'media-match');
137
130
  const dts = `
138
131
  /// <reference path="./color-scheme/color-scheme.info.ts" />
139
132
  /// <reference path="./icon-font/index.ts" />
140
133
  /// <reference path="./media-match/media-match.ts" />
141
134
  export {};
142
135
  `.trim();
143
- fs__default.ensureDirSync(dynamicDest);
144
- fs__default.writeFileSync(path__default.join(dynamicDest, 'setup.scss'), COLOR_DUMP_STYLE);
145
- fs__default.writeFileSync(path__default.join(dynamicDest, 'vui.d.ts'), dts);
136
+ fs.ensureDirSync(dynamicDest);
137
+ fs.writeFileSync(path.join(dynamicDest, 'setup.scss'), COLOR_DUMP_STYLE);
138
+ fs.writeFileSync(path.join(dynamicDest, 'vui.d.ts'), dts);
146
139
  let iconFontEntries = iconFont || [
147
140
  {
148
141
  src: '@mdi',
@@ -162,12 +155,12 @@ export {};
162
155
  dest: colorSchemeDest,
163
156
  },
164
157
  mediaMatch: {
165
- src: path__default.resolve(mediaMatch),
158
+ src: path.resolve(mediaMatch),
166
159
  dest: mediaMatchDest,
167
160
  },
168
161
  iconFont: {
169
162
  entries: iconFontEntries,
170
- dest: path__default.join(dynamicDest, 'icon-font'),
163
+ dest: path.join(dynamicDest, 'icon-font'),
171
164
  },
172
165
  onBooted,
173
166
  onBootError,
@@ -176,7 +169,7 @@ export {};
176
169
  name: 'vite:vui',
177
170
  enforce: 'pre',
178
171
  async config(config) {
179
- await fs__default.writeFile(path__default.join(dynamicDest, 'installer.ts'), await renderTemplate(settings));
172
+ await fs.writeFile(path.join(dynamicDest, 'installer.ts'), await renderTemplate(settings));
180
173
  const ssr = config.ssr || {};
181
174
  ssr.noExternal = ssr.noExternal || [];
182
175
  ssr.noExternal.push(/\/vui\/dist\/assets\//);
@@ -186,8 +179,8 @@ export {};
186
179
  };
187
180
  plugins.push(plugin);
188
181
  const settings = {
189
- colorScheme: path__default.join(colorSchemeDest, 'color-scheme.info'),
190
- mediaMatch: path__default.join(mediaMatchDest, 'media-match'),
182
+ colorScheme: path.join(colorSchemeDest, 'color-scheme.info'),
183
+ mediaMatch: path.join(mediaMatchDest, 'media-match'),
191
184
  uiSettings,
192
185
  icons,
193
186
  __dev,