@hubspot/ui-extensions-dev-server 0.7.2 → 0.7.3-canary.9

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/lib/build.js CHANGED
@@ -31,8 +31,17 @@ async function buildSingleExtension({
31
31
  emptyOutDir = true,
32
32
  minify = false,
33
33
  root = process.cwd(), // This is the vite default, so using that as our default
34
+ logger = console,
35
+ injectOverrides = true,
34
36
  }) {
35
37
  const output = getUrlSafeFileName(file);
38
+
39
+ const plugins = [manifestPlugin({ minify, output, logger })];
40
+
41
+ if (injectOverrides) {
42
+ plugins.push(codeInjectionPlugin({ file }));
43
+ }
44
+
36
45
  await build({
37
46
  root,
38
47
  define: {
@@ -49,7 +58,7 @@ async function buildSingleExtension({
49
58
  },
50
59
  rollupOptions: {
51
60
  ...ROLLUP_OPTIONS,
52
- plugins: [manifestPlugin({ output }), codeInjectionPlugin({ file })],
61
+ plugins,
53
62
  },
54
63
  outDir: outputDir,
55
64
  emptyOutDir,
@@ -58,23 +67,26 @@ async function buildSingleExtension({
58
67
  });
59
68
  }
60
69
 
61
- async function remoteBuild(root, entryPoint, outputDir = OUTPUT_DIR) {
70
+ async function remoteBuild({
71
+ root,
72
+ entryPoint,
73
+ outputDir = OUTPUT_DIR,
74
+ injectOverrides = true,
75
+ logger = console,
76
+ }) {
62
77
  const fileInfo = path.parse(entryPoint);
63
78
 
64
79
  if (!allowedExtensions.includes(fileInfo.ext)) {
65
80
  throw new Error(`${extensionErrorBaseMessage} ${fileInfo.ext}`);
66
81
  }
67
82
 
68
- const output = getUrlSafeFileName(entryPoint);
69
83
  await buildSingleExtension({
70
84
  file: entryPoint,
71
- outputFileName: output,
72
85
  outputDir,
73
- plugins: {
74
- rollup: [manifestPlugin({ minify: true, output })],
75
- },
76
86
  minify: true,
77
87
  root,
88
+ logger,
89
+ injectOverrides,
78
90
  });
79
91
  }
80
92
 
package/lib/dev.js CHANGED
@@ -29,6 +29,9 @@ async function _createViteDevServer(
29
29
  ignored: [
30
30
  path.join(outputDir, '/**/*'),
31
31
  '**/src/app/app.functions/**/*',
32
+ '**/app.json',
33
+ '**/package.json',
34
+ '**/package-lock.json',
32
35
  ],
33
36
  },
34
37
  },
@@ -1,16 +1,13 @@
1
1
  const path = require('path');
2
2
 
3
- function codeInjectionPlugin(options = {}) {
4
- const { file, root = process.cwd() } = options;
3
+ function codeInjectionPlugin() {
5
4
  return {
6
5
  name: 'ui-extensions-code-injection-plugin',
7
6
  enforce: 'post', // run after default rollup plugins
8
- transform(code, fileBeingTransformed) {
9
- const absoluteFilePath = path.isAbsolute(file)
10
- ? file
11
- : path.join(root, file);
7
+ transform(code, file) {
8
+ const { dir } = path.parse(file);
12
9
 
13
- if (fileBeingTransformed !== absoluteFilePath) {
10
+ if (dir.includes('node_modules')) {
14
11
  return { code, map: null }; // Not the file we care about, return the same code
15
12
  }
16
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/ui-extensions-dev-server",
3
- "version": "0.7.2",
3
+ "version": "0.7.3-canary.9+547554bb",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -66,7 +66,10 @@
66
66
  "peerDependenciesMeta": {
67
67
  "typescript": {
68
68
  "optional": true
69
+ },
70
+ "fsevents": {
71
+ "optional": true
69
72
  }
70
73
  },
71
- "gitHead": "291eae6851c5dc9be36952059ab8a7506e08b93b"
74
+ "gitHead": "547554bbe80edf0a3688a1a5f8351a5677c0f511"
72
75
  }