changeset 86:6ec759f9009f

build fixes, dead code, format
author drewp@bigasterisk.com
date Thu, 25 Nov 2021 18:15:08 -0800
parents 792452c0eb98
children 910e2037d72d
files rollup.config.js src/index.ts tsconfig.json
diffstat 3 files changed, 15 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/rollup.config.js	Wed Nov 17 16:48:45 2021 -0800
+++ b/rollup.config.js	Thu Nov 25 18:15:08 2021 -0800
@@ -1,26 +1,9 @@
-// import copy from 'rollup-plugin-copy';
-// import postcss from "rollup-plugin-postcss";
 import builtins from 'rollup-plugin-node-builtins';
 import commonjs from '@rollup/plugin-commonjs';
 import resolve from "@rollup/plugin-node-resolve";
 import typescript from "@rollup/plugin-typescript";
 import globals from 'rollup-plugin-node-globals';
 
-const workaround_jsonld_module_system_picker = "process = {version: '1.0.0'}";
-const workaround_some_browser_detector = "global = window";
-const workaround_jsonld_expand_issue = {
-  namedExports: {
-    jsonld: ["expand"] // fixes "expand is not exported by node_modules/jsonld/lib/index.js"
-  }
-};
-
-const moduleIsntLocal = (id, parentId, isResolved) => {
-  console.log("check", id, !id.startsWith("./"));
-  if (isResolved || id == "src/index.ts") {
-    return false;
-  }
-  return !id.startsWith("./");
-};
 
 export default [
   {
@@ -29,9 +12,7 @@
       file: "build/lib.bundle.js",
       format: "es",
       sourcemap: true,
-      // intro: `const ${workaround_some_browser_detector}, ${workaround_jsonld_module_system_picker};`
     },
-    // external: moduleIsntLocal,
     plugins: [
       builtins(),
       resolve({
@@ -41,13 +22,8 @@
       commonjs(),
       globals(),
       typescript({
-        outDir: "build",
-        declaration: true
+        tsconfig: './tsconfig.json'
       }),
-      // postcss({
-      //   inject: false
-      // }),
-      // commonjs(workaround_jsonld_expand_issue)
     ]
   },
 ];
--- a/src/index.ts	Wed Nov 17 16:48:45 2021 -0800
+++ b/src/index.ts	Thu Nov 25 18:15:08 2021 -0800
@@ -1,11 +1,11 @@
-import { LitElement, html, css, render, TemplateResult } from "lit";
+import { LitElement, html, render, TemplateResult } from "lit";
 import { customElement, property } from "lit/decorators.js";
 
 import { Store } from "n3";
 
 import { GraphView } from "./graph_view";
 import { StreamedGraphClient } from "./streamed_graph_client";
-import { style, addFontToRootPage } from './style';
+import { style, addFontToRootPage } from "./style";
 
 // export * from "./graph_queries";
 
@@ -31,7 +31,8 @@
   sg!: StreamedGraphClient;
   graphViewDirty = true;
 
-  static styles=style;
+  static styles = style;
+
   render() {
     const expandAction = this.expanded ? "-" : "+";
     return html`
@@ -132,6 +133,12 @@
   }
 }
 
+declare global {
+  interface HTMLElementTagNameMap {
+    "streamed-graph": StreamedGraph;
+  }
+}
+
 // // allow child nodes to combine a few graphs and statics
 // //<streamed-graph id="timebankGraph"  graph="{{graph}}" expanded="true">
 // //  <member-graph url="graph/timebank/events"></member-graph>
--- a/tsconfig.json	Wed Nov 17 16:48:45 2021 -0800
+++ b/tsconfig.json	Thu Nov 25 18:15:08 2021 -0800
@@ -17,17 +17,18 @@
     "moduleResolution": "node",
     "sourceMap": true,
     "declaration": true,
+    "declarationDir": ".", // relative to outDir
     "experimentalDecorators": true,
     "allowJs": true,
     "esModuleInterop": true,
     // "traceResolution": true,
     // "allowSyntheticDefaultImports": true,
     // "rootDir": ".",
-    // "outDir": "./build",
+    "outDir": "./build",
     "baseUrl": "."
     // "emitDecoratorMetadata": true,
     // "lib": [ "es6", "dom" ],
   },
-  "include": ["src/**/*.ts", "demo/demo.ts"],
-  // "exclude": ["src/**/*.test.ts"]
+  "include": ["src/**/*.ts"],
+  "exclude": ["src/**/*.test.ts"]
 }