powerbi-visuals-tools 5.0.0 → 5.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.
package/Changelog.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  This page contains information about changes to the PowerBI Visual Tools (pbiviz).
4
4
 
5
+ ## 5.0.1
6
+ * Fixed broken imports in webpack.config for some cases
7
+
5
8
  ## 5.0.0
6
9
  * Migrated to TypeScript
7
10
  * Migrated to eslint
@@ -1,28 +1,28 @@
1
1
  -----BEGIN PRIVATE KEY-----
2
- MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCi3X3hDfJ24lQJ
3
- nEPNxT37WNNDVD4Dq4yb5aTrDWxZJT7U1Je7G9j4y3+LE6s4HioehtGHRXECfVZ7
4
- Ts8t2oVhiim9751ECTSmsAFEboy7t8mvLCFlIvjU1NZUXlAe1dO/ekcecLSnzczF
5
- x+l8VgNve0DYRgRjuckgI4UDNrTCvKqxlQUW2YSh+/nmUiF9A9ZPfq2gkSiZLsS5
6
- tpRvVx102en1JZ1FLu3dZ/oI3A5HeDZgAW9HkSPZVBcp+aSG+S8ZHCRD/2B/qynt
7
- 9IDwFotNQgnMJjl1Z3Y0qHQIntNUmv6MPFPgNEqk40ceT5CdA+jjZrgPxAjG3LR+
8
- 6EMchWXlAgMBAAECggEAGLw+DYvCOvcV313J2Hsv9jgf4fZt8r2/vb+rg/2GaqWi
9
- /M0K/GJ22haCGPvUQdInAHrmYL6VstSZaWHnSmYJYu6Kd2vofThOtFA/6QZHPo1j
10
- xsSTj9o3Y4+tu6OVVJGSNt8Z5RAmB+RUSOebWQRxQiG8j/xWV1UUrFporbvFyVuD
11
- B+EWhUiUQSFlIFHuI/abMDGYChw05N0sRj78zU/ezBxxlvuxXacjbT8x3/3yROW5
12
- 8ys9SW2C1ITUGpjM3m/ycF/IFgK7okklpQrZarha6wOeizx9v3g5TlhyscN4epTi
13
- ARR3Mqp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 2npJWOcYiAi3r1FrEOFwFi9x2isdKHDyUKjZ1c2MpE9NZINRygTJsdmxcd733+8C
8
+ TEzdJblOGBZ747Yxa/zw+3fDaPPPVHeh6AczEnjlcgKbzCOU87D6i4mm2amWIgEs
9
+ NxPj+kcGRmAcBnDXoGVc4RjgiBB1el9bNDHFZMB42JxU3fNPJGdrMFN7ggzlvLfZ
10
+ gsbE/NYA9l/SXxkB/EJwy4tdoAuu0yG+z8MWVw3GfQIDAQABo1MwUTAdBgNVHQ4E
11
+ FgQUdVL9VTkbLJWGTUXaoxQ3Q0px1aMwHwYDVR0jBBgwFoAUdVL9VTkbLJWGTUXa
12
+ oxQ3Q0px1aMwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAxgJg
13
+ PbzNc1+YI8BTNaIfwqhzuZ85xJlxMUY3YikjaVpZJs4wik1CL1M/TN/6s6MNiHrw
14
+ fH7QhJGgt7tq5TEjUpDjVNDtYMX6/tx1XdjYTsIl3zBJkz9GUPckdF8OcK8a+D3R
15
+ 7LPyMKUQ38LzbDwfbkAjXeWL23E/gJcd7p14/Eeyew6/6Xi2RLdHrH5teSjyIZ9B
16
+ 1cM/1Nv1Q634Xts5o6SNvPfWyX0BxsmQYGraOXzNSS+oSilOEaMILHWWXXrGMtxN
17
+ W7mjZfpXjM0Ofx4XatEdmO5664RpzA0QKltEV8IVohGbS26WfErrjsYVZ/zoO4dC
18
+ cTpYSCqOl0e8eqfLnw==
19
19
  -----END CERTIFICATE-----
@@ -6,13 +6,13 @@ import webpack from 'webpack';
6
6
  import util from 'util';
7
7
  const exec = util.promisify(processExec);
8
8
  import { exec as processExec } from 'child_process';
9
+ import lodashCloneDeep from 'lodash.clonedeep';
9
10
  import ExtraWatchWebpackPlugin from 'extra-watch-webpack-plugin';
10
11
  import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
11
12
  import { PowerBICustomVisualsWebpackPlugin } from 'powerbi-visuals-webpack-plugin';
12
13
  import ConsoleWriter from './ConsoleWriter.js';
13
14
  import { resolveCertificate } from "./CertificateTools.js";
14
- import lodashCloneDeep from 'lodash.clonedeep';
15
- import { readJsonFromRoot, readJsonFromVisual } from './utils.js';
15
+ import { getRootPath, readJsonFromRoot, readJsonFromVisual } from './utils.js';
16
16
  const config = readJsonFromRoot('config.json');
17
17
  const npmPackage = readJsonFromRoot('package.json');
18
18
  const visualPlugin = "visualPlugin.ts";
@@ -189,7 +189,7 @@ export default class WebPackWrap {
189
189
  test: /(\.ts)x?$/,
190
190
  use: [
191
191
  {
192
- loader: 'ts-loader',
192
+ loader: path.resolve(getRootPath(), "node_modules", "ts-loader"),
193
193
  options: tsOptions
194
194
  }
195
195
  ]
package/lib/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs-extra';
2
2
  import https from "https";
3
3
  import path from "path";
4
- import os from "os";
4
+ import { fileURLToPath } from 'node:url';
5
5
  export function download(url, pathToFile) {
6
6
  return new Promise((resolve, reject) => {
7
7
  const fileStream = fs.createWriteStream(pathToFile);
@@ -19,9 +19,8 @@ export function createFolder(folderName) {
19
19
  return folder;
20
20
  }
21
21
  export function getRootPath() {
22
- const isLinux = os.platform() === "linux";
23
- const pathToDirectory = import.meta.url.split(isLinux ? "file://" : "file:///")[1];
24
- return path.join(pathToDirectory, "../..");
22
+ const pathToDirectory = fileURLToPath(import.meta.url);
23
+ return path.join(pathToDirectory, "..", "..");
25
24
  }
26
25
  export function readFileFromRoot(filePath) {
27
26
  return fs.readFileSync(path.join(getRootPath(), filePath), "utf8");
@@ -5,6 +5,7 @@ import TerserPlugin from "terser-webpack-plugin";
5
5
  import path from "path";
6
6
  import webpack from "webpack";
7
7
  const config = readJsonFromRoot("/config.json");
8
+ const rootPath = getRootPath();
8
9
  const webpackConfig = {
9
10
  entry: {
10
11
  'visual.js': ['./src/visual.ts']
@@ -36,7 +37,7 @@ const webpackConfig = {
36
37
  },
37
38
  {
38
39
  test: /\.json$/,
39
- loader: 'json-loader',
40
+ loader: path.resolve(rootPath, "node_modules", "json-loader"),
40
41
  type: "javascript/auto"
41
42
  },
42
43
  {
@@ -46,13 +47,13 @@ const webpackConfig = {
46
47
  loader: MiniCssExtractPlugin.loader
47
48
  },
48
49
  {
49
- loader: 'css-loader'
50
+ loader: path.resolve(rootPath, "node_modules", "css-loader")
50
51
  },
51
52
  {
52
- loader: 'less-loader',
53
+ loader: path.resolve(rootPath, "node_modules", "less-loader"),
53
54
  options: {
54
55
  lessOptions: {
55
- paths: [path.resolve(getRootPath(), 'node_modules')]
56
+ paths: [path.resolve(rootPath, 'node_modules')]
56
57
  }
57
58
  }
58
59
  }
@@ -74,34 +75,34 @@ const webpackConfig = {
74
75
  resolve: {
75
76
  extensions: ['.tsx', '.ts', '.jsx', '.js', '.css'],
76
77
  fallback: {
77
- assert: path.resolve("../node-modules/assert/"),
78
- buffer: path.resolve("../node-modules/buffer/"),
79
- console: path.resolve("../node-modules/console-browserify/"),
80
- constants: path.resolve("../node-modules/constants-browserify/"),
81
- crypto: path.resolve("../node-modules/crypto-browserify/"),
82
- domain: path.resolve("../node-modules/domain-browser/"),
83
- events: path.resolve("../node-modules/events/"),
84
- http: path.resolve("../node-modules/stream-http/"),
85
- https: path.resolve("../node-modules/https-browserify/"),
86
- os: path.resolve("../node-modules/os-browserify/"),
87
- path: path.resolve("../node-modules/path-browserify/"),
88
- punycode: path.resolve("../node-modules/punycode/"),
89
- process: path.resolve("../node-modules/process/"),
90
- querystring: path.resolve("../node-modules/querystring-es3/"),
91
- stream: path.resolve("../node-modules/stream-browserify/"),
92
- _stream_duplex: path.resolve("../node-modules/readable-stream/"),
93
- _stream_passthrough: path.resolve("../node-modules/readable-stream/"),
94
- _stream_readable: path.resolve("../node-modules/readable-stream/"),
95
- _stream_transform: path.resolve("../node-modules/readable-stream/"),
96
- _stream_writable: path.resolve("../node-modules/readable-stream/"),
97
- string_decoder: path.resolve("../node-modules/string_decoder/"),
98
- sys: path.resolve("../node-modules/util/"),
99
- timers: path.resolve("../node-modules/timers-browserify/"),
100
- tty: path.resolve("../node-modules/tty-browserify/"),
101
- url: path.resolve("../node-modules/url/"),
102
- util: path.resolve("../node-modules/util/"),
103
- vm: path.resolve("../node-modules/vm-browserify/"),
104
- zlib: path.resolve("../node-modules/browserify-zlib/")
78
+ assert: path.resolve(rootPath, "node_modules", "assert"),
79
+ buffer: path.resolve(rootPath, "node_modules", "buffer"),
80
+ console: path.resolve(rootPath, "node_modules", "console-browserify"),
81
+ constants: path.resolve(rootPath, "node_modules", "constants-browserify"),
82
+ crypto: path.resolve(rootPath, "node_modules", "crypto-browserify"),
83
+ domain: path.resolve(rootPath, "node_modules", "domain-browser"),
84
+ events: path.resolve(rootPath, "node_modules", "events"),
85
+ http: path.resolve(rootPath, "node_modules", "stream-http"),
86
+ https: path.resolve(rootPath, "node_modules", "https-browserify"),
87
+ os: path.resolve(rootPath, "node_modules", "os-browserify"),
88
+ path: path.resolve(rootPath, "node_modules", "path-browserify"),
89
+ punycode: path.resolve(rootPath, "node_modules", "punycode"),
90
+ process: path.resolve(rootPath, "node_modules", "process"),
91
+ querystring: path.resolve(rootPath, "node_modules", "querystring-es3"),
92
+ stream: path.resolve(rootPath, "node_modules", "stream-browserify"),
93
+ _stream_duplex: path.resolve(rootPath, "node_modules", "readable-stream"),
94
+ _stream_passthrough: path.resolve(rootPath, "node_modules", "readable-stream"),
95
+ _stream_readable: path.resolve(rootPath, "node_modules", "readable-stream"),
96
+ _stream_transform: path.resolve(rootPath, "node_modules", "readable-stream"),
97
+ _stream_writable: path.resolve(rootPath, "node_modules", "readable-stream"),
98
+ string_decoder: path.resolve(rootPath, "node_modules", "string_decoder"),
99
+ sys: path.resolve(rootPath, "node_modules", "util"),
100
+ timers: path.resolve(rootPath, "node_modules", "timers-browserify"),
101
+ tty: path.resolve(rootPath, "node_modules", "tty-browserify"),
102
+ url: path.resolve(rootPath, "node_modules", "url"),
103
+ util: path.resolve(rootPath, "node_modules", "util"),
104
+ vm: path.resolve(rootPath, "node_modules", "vm-browserify"),
105
+ zlib: path.resolve(rootPath, "node_modules", "browserify-zlib")
105
106
  }
106
107
  },
107
108
  output: {
@@ -124,7 +125,7 @@ const webpackConfig = {
124
125
  }
125
126
  },
126
127
  watchOptions: {
127
- ignored: ['node_modules/**']
128
+ ignored: ['node_modules", "**']
128
129
  },
129
130
  plugins: [
130
131
  new webpack.ProvidePlugin({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerbi-visuals-tools",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Command line tool for creating and publishing visuals for Power BI",
5
5
  "main": "./bin/pbiviz.js",
6
6
  "type": "module",
@@ -58,7 +58,7 @@
58
58
  "mini-css-extract-plugin": "^2.7.6",
59
59
  "os-browserify": "^0.3.0",
60
60
  "path-browserify": "^1.0.1",
61
- "powerbi-visuals-webpack-plugin": "^4.0.1",
61
+ "powerbi-visuals-webpack-plugin": "4.0.1",
62
62
  "process": "^0.11.10",
63
63
  "punycode": "^2.3.0",
64
64
  "querystring-es3": "^0.2.1",
@@ -7,13 +7,13 @@ import webpack from 'webpack';
7
7
  import util from 'util';
8
8
  const exec = util.promisify(processExec);
9
9
  import { exec as processExec } from 'child_process';
10
+ import lodashCloneDeep from 'lodash.clonedeep';
10
11
  import ExtraWatchWebpackPlugin from 'extra-watch-webpack-plugin';
11
12
  import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
12
13
  import { PowerBICustomVisualsWebpackPlugin } from 'powerbi-visuals-webpack-plugin';
13
14
  import ConsoleWriter from './ConsoleWriter.js';
14
15
  import { resolveCertificate } from "./CertificateTools.js";
15
- import lodashCloneDeep from 'lodash.clonedeep';
16
- import { readJsonFromRoot, readJsonFromVisual } from './utils.js'
16
+ import { getRootPath, readJsonFromRoot, readJsonFromVisual } from './utils.js'
17
17
 
18
18
  const config = readJsonFromRoot('config.json');
19
19
  const npmPackage = readJsonFromRoot('package.json');
@@ -230,7 +230,7 @@ export default class WebPackWrap {
230
230
  test: /(\.ts)x?$/,
231
231
  use: [
232
232
  {
233
- loader: 'ts-loader',
233
+ loader: path.resolve(getRootPath(), "node_modules", "ts-loader"),
234
234
  options: tsOptions
235
235
  }
236
236
  ]
package/src/utils.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs-extra';
2
2
  import https from "https";
3
3
  import path from "path";
4
- import os from "os";
4
+ import { fileURLToPath } from 'node:url';
5
5
 
6
6
  export function download(url, pathToFile) {
7
7
  return new Promise((resolve, reject) => {
@@ -22,9 +22,8 @@ export function createFolder(folderName): string {
22
22
  }
23
23
 
24
24
  export function getRootPath(): string {
25
- const isLinux = os.platform() === "linux"
26
- const pathToDirectory = import.meta.url.split(isLinux ? "file://" : "file:///")[1];
27
- return path.join(pathToDirectory, "../..");
25
+ const pathToDirectory = fileURLToPath(import.meta.url);
26
+ return path.join(pathToDirectory, "..", "..");
28
27
  }
29
28
 
30
29
  export function readFileFromRoot(filePath: string) {
@@ -7,6 +7,7 @@ import path from "path";
7
7
  import webpack from "webpack";
8
8
 
9
9
  const config = readJsonFromRoot("/config.json");
10
+ const rootPath = getRootPath();
10
11
 
11
12
  const webpackConfig = {
12
13
  entry: {
@@ -39,7 +40,7 @@ const webpackConfig = {
39
40
  },
40
41
  {
41
42
  test: /\.json$/,
42
- loader: 'json-loader',
43
+ loader: path.resolve(rootPath, "node_modules", "json-loader"),
43
44
  type: "javascript/auto"
44
45
  },
45
46
  {
@@ -49,13 +50,13 @@ const webpackConfig = {
49
50
  loader: MiniCssExtractPlugin.loader
50
51
  },
51
52
  {
52
- loader: 'css-loader'
53
+ loader: path.resolve(rootPath, "node_modules", "css-loader")
53
54
  },
54
55
  {
55
- loader: 'less-loader',
56
+ loader: path.resolve(rootPath, "node_modules", "less-loader"),
56
57
  options: {
57
58
  lessOptions: {
58
- paths: [path.resolve(getRootPath(), 'node_modules')]
59
+ paths: [path.resolve(rootPath, 'node_modules')]
59
60
  }
60
61
  }
61
62
  }
@@ -77,34 +78,34 @@ const webpackConfig = {
77
78
  resolve: {
78
79
  extensions: ['.tsx', '.ts', '.jsx', '.js', '.css'],
79
80
  fallback: {
80
- assert: path.resolve("../node-modules/assert/"),
81
- buffer: path.resolve("../node-modules/buffer/"),
82
- console: path.resolve("../node-modules/console-browserify/"),
83
- constants: path.resolve("../node-modules/constants-browserify/"),
84
- crypto: path.resolve("../node-modules/crypto-browserify/"),
85
- domain: path.resolve("../node-modules/domain-browser/"),
86
- events: path.resolve("../node-modules/events/"),
87
- http: path.resolve("../node-modules/stream-http/"),
88
- https: path.resolve("../node-modules/https-browserify/"),
89
- os: path.resolve("../node-modules/os-browserify/"),
90
- path: path.resolve("../node-modules/path-browserify/"),
91
- punycode: path.resolve("../node-modules/punycode/"),
92
- process: path.resolve("../node-modules/process/"),
93
- querystring: path.resolve("../node-modules/querystring-es3/"),
94
- stream: path.resolve("../node-modules/stream-browserify/"),
95
- _stream_duplex: path.resolve("../node-modules/readable-stream/"),
96
- _stream_passthrough: path.resolve("../node-modules/readable-stream/"),
97
- _stream_readable: path.resolve("../node-modules/readable-stream/"),
98
- _stream_transform: path.resolve("../node-modules/readable-stream/"),
99
- _stream_writable: path.resolve("../node-modules/readable-stream/"),
100
- string_decoder: path.resolve("../node-modules/string_decoder/"),
101
- sys: path.resolve("../node-modules/util/"),
102
- timers: path.resolve("../node-modules/timers-browserify/"),
103
- tty: path.resolve("../node-modules/tty-browserify/"),
104
- url: path.resolve("../node-modules/url/"),
105
- util: path.resolve("../node-modules/util/"),
106
- vm: path.resolve("../node-modules/vm-browserify/"),
107
- zlib: path.resolve("../node-modules/browserify-zlib/")
81
+ assert: path.resolve(rootPath, "node_modules", "assert"),
82
+ buffer: path.resolve(rootPath, "node_modules", "buffer"),
83
+ console: path.resolve(rootPath, "node_modules", "console-browserify"),
84
+ constants: path.resolve(rootPath, "node_modules", "constants-browserify"),
85
+ crypto: path.resolve(rootPath, "node_modules", "crypto-browserify"),
86
+ domain: path.resolve(rootPath, "node_modules", "domain-browser"),
87
+ events: path.resolve(rootPath, "node_modules", "events"),
88
+ http: path.resolve(rootPath, "node_modules", "stream-http"),
89
+ https: path.resolve(rootPath, "node_modules", "https-browserify"),
90
+ os: path.resolve(rootPath, "node_modules", "os-browserify"),
91
+ path: path.resolve(rootPath, "node_modules", "path-browserify"),
92
+ punycode: path.resolve(rootPath, "node_modules", "punycode"),
93
+ process: path.resolve(rootPath, "node_modules", "process"),
94
+ querystring: path.resolve(rootPath, "node_modules", "querystring-es3"),
95
+ stream: path.resolve(rootPath, "node_modules", "stream-browserify"),
96
+ _stream_duplex: path.resolve(rootPath, "node_modules", "readable-stream"),
97
+ _stream_passthrough: path.resolve(rootPath, "node_modules", "readable-stream"),
98
+ _stream_readable: path.resolve(rootPath, "node_modules", "readable-stream"),
99
+ _stream_transform: path.resolve(rootPath, "node_modules", "readable-stream"),
100
+ _stream_writable: path.resolve(rootPath, "node_modules", "readable-stream"),
101
+ string_decoder: path.resolve(rootPath, "node_modules", "string_decoder"),
102
+ sys: path.resolve(rootPath, "node_modules", "util"),
103
+ timers: path.resolve(rootPath, "node_modules", "timers-browserify"),
104
+ tty: path.resolve(rootPath, "node_modules", "tty-browserify"),
105
+ url: path.resolve(rootPath, "node_modules", "url"),
106
+ util: path.resolve(rootPath, "node_modules", "util"),
107
+ vm: path.resolve(rootPath, "node_modules", "vm-browserify"),
108
+ zlib: path.resolve(rootPath, "node_modules", "browserify-zlib")
108
109
  }
109
110
  },
110
111
  output: {
@@ -127,7 +128,7 @@ const webpackConfig = {
127
128
  }
128
129
  },
129
130
  watchOptions: {
130
- ignored: ['node_modules/**']
131
+ ignored: ['node_modules", "**']
131
132
  },
132
133
  plugins: [
133
134
  new webpack.ProvidePlugin({