powerbi-visuals-tools 7.0.2 → 7.0.3

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/Changelog.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This page contains information about changes to the PowerBI Visual Tools (pbiviz).
4
4
 
5
+ ## 7.0.3
6
+ * Fixed missing validation for `author` object in pbiviz.json. The `author` object with `name` and `email` fields is now required.
7
+ * Updated packages.
8
+
5
9
  ## 7.0.2
6
10
  * Changed source map generation to `eval-source-map`.
7
11
  * Fixed load source map error.
package/eslint.config.mjs CHANGED
@@ -2,18 +2,21 @@ import typescriptEslint from "@typescript-eslint/eslint-plugin";
2
2
  import globals from "globals";
3
3
  import tsParser from "@typescript-eslint/parser";
4
4
 
5
+ const __dirname = import.meta.dirname; // built-in, no imports needed
6
+
5
7
  export default [
6
8
  {
7
- files: ["*.ts", "*tsx"],
8
9
  ignores: [
9
- "node_modules/",
10
- "dist/",
11
- "templates/",
12
- "spec/*/**",
13
- "**/lib/",
14
- "bin/",
15
- "eslint.config.mjs",
10
+ "node_modules/**",
11
+ "dist/**",
12
+ "templates/**",
13
+ "spec/**",
14
+ "lib/**",
15
+ "bin/**",
16
16
  ],
17
+ },
18
+ {
19
+ files: ["**/*.ts", "**/*.tsx"],
17
20
  plugins: {
18
21
  "@typescript-eslint": typescriptEslint,
19
22
  },
@@ -26,7 +29,7 @@ export default [
26
29
  sourceType: "module",
27
30
  parserOptions: {
28
31
  project: "tsconfig.json",
29
- tsconfigRootDir: ".",
32
+ tsconfigRootDir: __dirname,
30
33
  },
31
34
  },
32
35
  rules: {
@@ -179,7 +179,7 @@ async function openCertFile() {
179
179
  }
180
180
  await exec(`${startCmd} "${certPath}"`);
181
181
  }
182
- catch (e) {
182
+ catch {
183
183
  ConsoleWriter.info(['Certificate path:', certPath]);
184
184
  }
185
185
  }
package/lib/Visual.js CHANGED
@@ -17,6 +17,12 @@ export class Visual {
17
17
  isVisualVersionValid(length) {
18
18
  return this.visualVersion.split(".").length === length;
19
19
  }
20
+ isAuthorDefined() {
21
+ const author = this.config?.author;
22
+ const emailRegex = /^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/;
23
+ return typeof author?.name === "string" && author.name.length > 0 &&
24
+ typeof author?.email === "string" && emailRegex.test(author.email);
25
+ }
20
26
  getVisualFeatureType() {
21
27
  const isMatrixSupported = this.capabilities?.dataViewMappings?.some(dataView => dataView.matrix);
22
28
  const isSlicer = Boolean(this.capabilities?.objects?.general?.properties?.filter?.type?.filter);
@@ -96,7 +96,7 @@ function fileExists(file) {
96
96
  try {
97
97
  fs.accessSync(file);
98
98
  }
99
- catch (e) {
99
+ catch {
100
100
  return false;
101
101
  }
102
102
  return true;
@@ -120,7 +120,7 @@ function validTemplate(templateName) {
120
120
  try {
121
121
  fs.accessSync(path.join(VISUAL_TEMPLATES_PATH, templateName));
122
122
  }
123
- catch (e) {
123
+ catch {
124
124
  return false;
125
125
  }
126
126
  return true;
@@ -6,7 +6,6 @@ import util from 'util';
6
6
  const exec = util.promisify(processExec);
7
7
  import { exec as processExec } from 'child_process';
8
8
  import lodashCloneDeep from 'lodash.clonedeep';
9
- import ExtraWatchWebpackPlugin from 'extra-watch-webpack-plugin';
10
9
  import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
11
10
  import { PowerBICustomVisualsWebpackPlugin, LocalizationLoader } from 'powerbi-visuals-webpack-plugin';
12
11
  import ConsoleWriter from './ConsoleWriter.js';
@@ -180,9 +179,14 @@ export default class WebPackWrap {
180
179
  analyzerMode: `static`
181
180
  }));
182
181
  }
183
- this.webpackConfig.plugins.push(new PowerBICustomVisualsWebpackPlugin(pluginConfiguration), new ExtraWatchWebpackPlugin({
184
- files: this.pbiviz.capabilities
185
- }));
182
+ this.webpackConfig.plugins.push(new PowerBICustomVisualsWebpackPlugin(pluginConfiguration), {
183
+ apply: (compiler) => {
184
+ compiler.hooks.afterCompile.tap('AddCapabilitiesWatch', (compilation) => {
185
+ const capabilitiesPath = path.resolve(process.cwd(), this.pbiviz.capabilities);
186
+ compilation.fileDependencies.add(capabilitiesPath);
187
+ });
188
+ }
189
+ });
186
190
  }
187
191
  async configureLoaders({ fast = false, includeAllLocales = false }) {
188
192
  this.webpackConfig.module.rules.push({
@@ -0,0 +1,14 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class AuthorInfo {
3
+ static featureName = "Author information";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/visual-project-structure#metadata-entries";
5
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
6
+ static severity = Severity.Error;
7
+ static stage = Stage.PreBuild;
8
+ static visualFeatureType = VisualFeatureType.All;
9
+ static isSupported(visual) {
10
+ return visual.isAuthorDefined();
11
+ }
12
+ }
13
+ // The pbiviz.json schema validates author.name and author.email when present,
14
+ // but doesn't require the author object itself. This check fills that gap.
@@ -1,6 +1,7 @@
1
1
  import AdvancedEditMode from './AdvancedEditMode.js';
2
2
  import AllowInteractions from './AllowInteractions.js';
3
3
  import AnalyticsPane from './AnalyticsPane.js';
4
+ import AuthorInfo from './AuthorInfo.js';
4
5
  import Bookmarks from './Bookmarks.js';
5
6
  import ColorPalette from './ColorPalette.js';
6
7
  import ConditionalFormatting from './ConditionalFormatting.js';
@@ -25,4 +26,4 @@ import TotalSubTotal from './TotalSubTotal.js';
25
26
  import WarningIcon from './WarningIcon.js';
26
27
  import APIVersion from './APIVersion.js';
27
28
  import VisualVersion from './VisualVersion.js';
28
- export { AdvancedEditMode, AllowInteractions, AnalyticsPane, Bookmarks, ColorPalette, ConditionalFormatting, ContextMenu, DrillDown, FetchMoreData, FileDownload, FormatPane, HighContrast, HighlightData, KeyboardNavigation, LandingPage, LaunchURL, Localizations, LocalStorage, ModalDialog, RenderingEvents, SelectionAcrossVisuals, SyncSlicer, Tooltips, TotalSubTotal, WarningIcon, APIVersion, VisualVersion };
29
+ export { AdvancedEditMode, AllowInteractions, AnalyticsPane, Bookmarks, ColorPalette, ConditionalFormatting, ContextMenu, DrillDown, FetchMoreData, FileDownload, FormatPane, HighContrast, HighlightData, KeyboardNavigation, LandingPage, LaunchURL, Localizations, LocalStorage, ModalDialog, RenderingEvents, SelectionAcrossVisuals, SyncSlicer, Tooltips, TotalSubTotal, WarningIcon, APIVersion, VisualVersion, AuthorInfo };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerbi-visuals-tools",
3
- "version": "7.0.2",
3
+ "version": "7.0.3",
4
4
  "description": "Command line tool for creating and publishing visuals for Power BI",
5
5
  "main": "./bin/pbiviz.js",
6
6
  "type": "module",
@@ -12,6 +12,7 @@
12
12
  "jasmine": "node spec/jasmine-runner.js",
13
13
  "jasmine-inspect": "node --inspect spec/jasmine-runner.js",
14
14
  "lint": "npx eslint .",
15
+ "lint:fix": "npx eslint . --fix",
15
16
  "debug-tests": "npm run lint && npm run jasmine-inspect"
16
17
  },
17
18
  "bin": {
@@ -33,32 +34,32 @@
33
34
  "chalk": "^5.4.1",
34
35
  "commander": "^13.1.0",
35
36
  "compare-versions": "^6.1.1",
36
- "css-loader": "^7.1.2",
37
+ "css-loader": "^7.1.4",
37
38
  "eslint-plugin-powerbi-visuals": "1.1.0",
38
- "extra-watch-webpack-plugin": "^1.0.3",
39
39
  "fs-extra": "^11.3.3",
40
40
  "inline-source-map": "^0.6.3",
41
41
  "json-loader": "0.5.7",
42
42
  "jszip": "^3.10.1",
43
43
  "less": "^4.5.1",
44
- "less-loader": "^12.3.0",
44
+ "less-loader": "^12.3.1",
45
45
  "lodash.clonedeep": "4.5.0",
46
46
  "lodash.defaults": "4.2.0",
47
47
  "lodash.isequal": "4.5.0",
48
48
  "lodash.ismatch": "^4.4.0",
49
- "mini-css-extract-plugin": "^2.9.4",
50
- "powerbi-visuals-webpack-plugin": "^4.3.1",
49
+ "mini-css-extract-plugin": "^2.10.0",
50
+ "powerbi-visuals-webpack-plugin": "^5.0.0",
51
51
  "terser-webpack-plugin": "^5.3.16",
52
52
  "ts-loader": "^9.5.4",
53
53
  "typescript": "^5.9.3",
54
- "webpack": "^5.104.1",
54
+ "webpack": "^5.105.3",
55
55
  "webpack-bundle-analyzer": "4.10.2",
56
- "webpack-dev-server": "^5.2.2"
56
+ "webpack-dev-server": "^5.2.3"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@typescript-eslint/eslint-plugin": "^8.50.0",
60
- "eslint": "^9.39.2",
61
- "jasmine": "5.3.1",
60
+ "eslint": "^10.0.2",
61
+ "globals": "^17.3.0",
62
+ "jasmine": "^6.1.0",
62
63
  "jasmine-spec-reporter": "7.0.0",
63
64
  "semver": "7.7.3",
64
65
  "tree-kill": "1.2.2",
@@ -68,6 +69,6 @@
68
69
  "fsevents": "*"
69
70
  },
70
71
  "engines": {
71
- "node": ">=18.0.0"
72
+ "node": ">=20.19.0"
72
73
  }
73
74
  }
package/tsconfig.json CHANGED
@@ -14,7 +14,8 @@
14
14
  "ES2022",
15
15
  "dom"
16
16
  ],
17
- "outDir": "lib"
17
+ "outDir": "lib",
18
+ "skipLibCheck": true
18
19
  },
19
20
  "include": [
20
21
  "src/**/*.ts"