@htmlplus/element 0.7.4 → 0.7.6

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.
@@ -3,5 +3,5 @@ export declare const rollup: (...plugins: Array<Plugin>) => {
3
3
  name: string;
4
4
  buildStart(): Promise<void>;
5
5
  load(id: any): Promise<string | undefined>;
6
- buildEnd(): Promise<void>;
6
+ buildEnd(error?: Error): Promise<void>;
7
7
  };
@@ -14,7 +14,9 @@ export const rollup = (...plugins) => {
14
14
  return;
15
15
  return script;
16
16
  },
17
- async buildEnd() {
17
+ async buildEnd(error) {
18
+ if (error)
19
+ throw error;
18
20
  await finish();
19
21
  }
20
22
  };
@@ -168,7 +168,7 @@ export const customElement = (options) => {
168
168
  const template = t.templateLiteral(quasis, expressions);
169
169
  // TODO
170
170
  // if (!expressions.length) return template;
171
- const { local } = addDependency(path, CONSTANTS.UTILS_PATH, CONSTANTS.UTILS_HTML_LOCAL, CONSTANTS.UTILS_HTML_IMPORTED);
171
+ const { local } = addDependency(path, CONSTANTS.UTILS_PATH, CONSTANTS.UTILS_HTML_LOCAL, CONSTANTS.UTILS_HTML_IMPORTED, true);
172
172
  return t.taggedTemplateExpression(t.identifier(local), template);
173
173
  };
174
174
  path.replaceWith(transform(render(path.node)));
@@ -30,7 +30,7 @@ export const style = (options) => {
30
30
  }
31
31
  if (!context.stylePath)
32
32
  return;
33
- const { local } = addDependency(context.fileAST, context.stylePath, CONSTANTS.STYLE_IMPORTED);
33
+ const { local } = addDependency(context.fileAST, context.stylePath, CONSTANTS.STYLE_IMPORTED, undefined, true);
34
34
  // TODO: remove 'local!'
35
35
  const property = t.classProperty(t.identifier(CONSTANTS.STATIC_STYLES), t.identifier(local), undefined, null, undefined, true);
36
36
  t.addComment(property, 'leading', CONSTANTS.COMMENT_AUTO_ADDED_PROPERTY, true);
@@ -3,7 +3,5 @@ interface AddDependencyReturns {
3
3
  local?: string;
4
4
  node: ImportDeclaration;
5
5
  }
6
- export declare function addDependency(path: File | any, source: string): AddDependencyReturns;
7
- export declare function addDependency(path: File | any, source: string, local: string): AddDependencyReturns;
8
- export declare function addDependency(path: File | any, source: string, local: string, imported: string): AddDependencyReturns;
6
+ export declare function addDependency(path: File | any, source: string, local?: string, imported?: string, comment?: boolean): AddDependencyReturns;
9
7
  export {};
@@ -1,7 +1,7 @@
1
1
  import t from '@babel/types';
2
2
  import * as CONSTANTS from '../../constants/index.js';
3
3
  import { visitor } from './visitor.js';
4
- export function addDependency(path, source, local, imported) {
4
+ export function addDependency(path, source, local, imported, comment) {
5
5
  const isDefault = local && !imported;
6
6
  const isImport = local && imported;
7
7
  const isNormal = !local && !imported;
@@ -54,7 +54,9 @@ export function addDependency(path, source, local, imported) {
54
54
  // TODO
55
55
  (file.program || file).body.unshift(declaration);
56
56
  // TODO
57
- t.addComment(declaration, 'leading', CONSTANTS.COMMENT_AUTO_ADDED_DEPENDENCY, true);
57
+ if (comment) {
58
+ t.addComment(declaration, 'leading', CONSTANTS.COMMENT_AUTO_ADDED_DEPENDENCY, true);
59
+ }
58
60
  }
59
61
  return {
60
62
  local,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htmlplus/element",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "author": "Masood Abdolian <m.abdolian@gmail.com>",