Giter VIP home page Giter VIP logo

dem's Issues

Support .d.ts

Patterns

  • Compiler hint
// @deno-types="./vendor/https/deno.land/std/foo/bar.d.ts"
import * as bar from "./bar.js";
  • Triple-slash reference in .js
/// <reference types="./vendor/https/deno.land/std/foo/bar.d.ts" />
export const bar = "bar";

Support alias

Not sure if something like this is already supported:

{
  "modules": [
    {
      "protocol": "https",
      "path": "deno.land/std",
      "version": "v0.51.0",
      "files": [
        "/http/server.ts"
      ],
      "alias": "server.ts"
    }
  ]
}
import { serve } from './vendor/server.ts"

dem add/ensure doesn't create anything in vendor/

Perhaps I am misunderstanding dem, but it seems dem add should be files in vendor? But I am not seeing this happening. Thus far, only dem alias does anything to vendor/ .

Using dem 0.9.9:

  1. dem init
    sucessfully initialized dem.json
  2. jq . dem.json
{
  "modules": [],
  "aliases": {}
}
  1. dem add https://deno.land/x/[email protected]
    successfully added new module: https://deno.land/x/dejs, version: 0.9.3
  2. jq .modules dem.json
[
  {
    "protocol": "https",
    "path": "deno.land/x/dejs",
    "version": "0.9.3",
    "files": []
  }
]

But, there is no vendor directory (if I create vendor/ beforehand, nothing is placed inside of it).

Fix build

try non- esm.sh typescript module

Make easier to update TypeScript

  • This module is using old version of TypeScript to parse import section
    • This is used for dem ensure / dem prune
  • Add ability to patch TypeScript automatically.

dem update Error

PS C:> deno --version
deno 1.16.3 (release, x86_64-pc-windows-msvc)
v8 9.7.106.5
typescript 4.4.2
PS C:> dem version
dem: 0.9.9
PS C:> dem update
error: Uncaught (in promise) TypeError: Invalid URL
const u = new URL(name);
^
at Object.opSync (deno:core/01_core.js:142:12)
at opUrlParse (deno:ext/url/00_url.js:47:27)
at new URL (deno:ext/url/00_url.js:320:20)
at Function.parse (https://deno.land/x/[email protected]/module.ts:20:15)
at App.updateModule (https://deno.land/x/[email protected]/mod.ts:159:31)
at main (https://deno.land/x/[email protected]/cmd.ts:74:11)
PS C:>

Problem with dem ensure

When i use dem ensure for this project and I started the code. I got Uncaught SyntaxError: The requested module './vendor/https/jspm.dev/typescript/lib/typescript.js' does not provide an export named 'default'

So I looked the code and the hasDefaultExport function return false even if a module a export default. I rewrite the code to get working but that's my first step with typescript and I think my code could be better.

Here is the full function

export function hasDefaultExport(body: string): boolean {
  const sourceFile = ts.createSourceFile("", body, ts.ScriptTarget.ES2020);
  let hasDefault = false;
  sourceFile.forEachChild((node: ts.Node) => {
    if(ts.isExportDeclaration(node)){
      const exportClause: ts.NamedExports = node.exportClause as ts.NamedExports;
      if(exportClause !== undefined){
        hasDefault = hasDefault || (exportClause.elements[0].name.escapedText as string === 'default');
      }
    }
  });
  return hasDefault;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.