Skip to content

Commit

Permalink
fix: deps upgrades and improve support for loading as esm
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Jan 2, 2022
1 parent 25132b1 commit 38afc12
Show file tree
Hide file tree
Showing 9 changed files with 1,098 additions and 1,066 deletions.
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"*.ts": ["eslint -f visualstudio --fix", "prettier --write"],
"*.ts": ["eslint --fix", "prettier --write"],
"*{.js,.json,.md,.yml,rc}": ["prettier --write"],
"./package.json": ["fixpack"]
}
2 changes: 1 addition & 1 deletion .nycrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@istanbuljs/nyc-config-typescript",
"parserPlugins": ["objectRestSpread", "typescript"],
"reporter": ["text", "lcov"],
"include": ["src/**/*.{ts,marko}"],
"exclude": ["**/__tests__"]
Expand Down
21 changes: 17 additions & 4 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,23 @@ import { build, BuildOptions } from "esbuild";
build({
...opts,
format: "esm",
bundle: true,
splitting: true,
outExtension: { ".js": ".mjs" },
plugins: [
{
name: "external-modules",
setup(build) {
build.onResolve(
{ filter: /^[^./]|^\.[^./]|^\.\.[^/]/ },
({ path }) => ({
path,
external: true,
})
);
},
},
],
}),
]);
})().catch((err) => {
console.error(err);
process.exit(1);
});
})();
2,043 changes: 1,024 additions & 1,019 deletions package-lock.json

Large diffs are not rendered by default.

37 changes: 21 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,35 @@
"htmlparser2": "^7.2.0"
},
"devDependencies": {
"@commitlint/cli": "^15.0.0",
"@commitlint/config-conventional": "^15.0.0",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@marko/compiler": "^5.17.4",
"@commitlint/cli": "^16.0.1",
"@commitlint/config-conventional": "^16.0.0",
"@marko/compiler": "^5.17.6",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.11",
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"esbuild": "^0.14.2",
"esbuild-register": "^3.2.0",
"eslint": "^8.4.0",
"@types/node": "^17.0.6",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"esbuild": "^0.14.10",
"esbuild-register": "^3.3.1",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0",
"fast-glob": "^3.2.7",
"fixpack": "^4.0.0",
"husky": "^7.0.4",
"lint-staged": "^12.1.2",
"marko": "^5.17.5",
"lint-staged": "^12.1.4",
"marko": "^5.17.6",
"mocha": "^9.1.3",
"mocha-snap": "^4.2.1",
"nyc": "^15.1.0",
"prettier": "^2.5.1",
"semantic-release": "^18.0.1",
"typescript": "^4.5.2",
"vite": "^2.6.14"
"typescript": "^4.5.4",
"vite": "^2.7.10"
},
"exports": {
".": {
"import": "./dist/index.mjs",
"default": "./dist/index.js"
}
},
"files": [
"dist",
Expand All @@ -50,8 +55,8 @@
"vite"
],
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.mjs",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"peerDependencies": {
"@marko/compiler": "^5",
"vite": "^2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use strict";
var http = require("http");
var html = require("marko/dist/runtime/html");
var _marko_renderer = require("marko/dist/runtime/components/renderer");
var _marko_tag = require("marko/dist/runtime/helpers/render-tag");
var _marko_dynamic_tag = require("marko/dist/runtime/helpers/dynamic-tag");
var index_js = require("marko/dist/runtime/html/index.js");
var _marko_renderer = require("marko/dist/runtime/components/renderer.js");
var _marko_tag = require("marko/dist/runtime/helpers/render-tag.js");
var _marko_dynamic_tag = require("marko/dist/runtime/helpers/dynamic-tag.js");
var _initComponents = require("marko/dist/core-tags/components/init-components-tag.js");
var _awaitReorderer = require("marko/dist/core-tags/core/await/reorderer-renderer.js");
var _preferredScriptLocation = require("marko/dist/core-tags/components/preferred-script-location-tag.js");
Expand All @@ -19,7 +19,7 @@ var _initComponents__default = /* @__PURE__ */ _interopDefaultLegacy(_initCompon
var _awaitReorderer__default = /* @__PURE__ */ _interopDefaultLegacy(_awaitReorderer);
var _preferredScriptLocation__default = /* @__PURE__ */ _interopDefaultLegacy(_preferredScriptLocation);
var _flush_here_and_after____default = /* @__PURE__ */ _interopDefaultLegacy(_flush_here_and_after__);
const _marko_componentType$5 = "1BSUdNzk", _marko_template$5 = html.t(_marko_componentType$5);
const _marko_componentType$5 = "1BSUdNzk", _marko_template$5 = index_js.t(_marko_componentType$5);
const _marko_component$5 = {
onMount() {
console.log("mounted");
Expand All @@ -30,7 +30,7 @@ _marko_template$5._ = _marko_renderer__default["default"](function(input, out, _
}, {
t: _marko_componentType$5
}, _marko_component$5);
const _marko_componentType$4 = "9/pH0cjn", _marko_template$4 = html.t(_marko_componentType$4);
const _marko_componentType$4 = "9/pH0cjn", _marko_template$4 = index_js.t(_marko_componentType$4);
const _marko_component$4 = {};
_marko_template$4._ = _marko_renderer__default["default"](function(input, out, _componentDef, _component, state) {
out.w("<div id=implicit>");
Expand All @@ -40,7 +40,7 @@ _marko_template$4._ = _marko_renderer__default["default"](function(input, out, _
t: _marko_componentType$4,
i: true
}, _marko_component$4);
const _marko_componentType$3 = "EBjOWFdJ", _marko_template$3 = html.t(_marko_componentType$3);
const _marko_componentType$3 = "EBjOWFdJ", _marko_template$3 = index_js.t(_marko_componentType$3);
const _marko_component$3 = {};
_marko_template$3._ = _marko_renderer__default["default"](function(input, out, _componentDef, _component, state) {
out.w("<!DOCTYPE html><html lang=en><head>");
Expand All @@ -59,7 +59,7 @@ _marko_template$3._ = _marko_renderer__default["default"](function(input, out, _
t: _marko_componentType$3,
i: true
}, _marko_component$3);
const _marko_componentType$2 = "NgVTgNMO", _marko_template$2 = html.t(_marko_componentType$2);
const _marko_componentType$2 = "NgVTgNMO", _marko_template$2 = index_js.t(_marko_componentType$2);
const _marko_component$2 = {};
_marko_template$2._ = _marko_renderer__default["default"](function(input, out, _componentDef, _component, state) {
_marko_tag__default["default"](_marko_template$3, {
Expand All @@ -73,22 +73,22 @@ _marko_template$2._ = _marko_renderer__default["default"](function(input, out, _
t: _marko_componentType$2,
i: true
}, _marko_component$2);
const _marko_componentType$1 = "BnY0HwdC", _marko_template$1 = html.t(_marko_componentType$1);
const _marko_componentType$1 = "BnY0HwdC", _marko_template$1 = index_js.t(_marko_componentType$1);
function renderAssets(out, slot) {
const entries = this.___viteEntries;
if (entries) {
const slotWrittenEntriesKey = `___viteWrittenEntries-${slot}`;
const lastWrittenEntry = this[slotWrittenEntriesKey] || 0;
const writtenEntries = this[slotWrittenEntriesKey] = entries.length;
let html2 = "";
let html = "";
for (let i = lastWrittenEntry; i < writtenEntries; i++) {
const manifest = __MARKO_MANIFEST__[entries[i]];
const slotHtml = manifest && manifest[slot] && manifest[slot].join(this.___viteInjectAttrs);
if (slotHtml) {
html2 += slotHtml;
html += slotHtml;
}
}
out.write(html2);
out.write(html);
}
}
const _marko_component$1 = {};
Expand All @@ -107,7 +107,7 @@ _marko_template$1._ = _marko_renderer__default["default"](function(input, out, _
t: _marko_componentType$1,
i: true
}, _marko_component$1);
const _marko_componentType = "Nbn24J39", _marko_template = html.t(_marko_componentType);
const _marko_componentType = "Nbn24J39", _marko_template = index_js.t(_marko_componentType);
const _marko_component = {};
_marko_template._ = _marko_renderer__default["default"](function(input, out, _componentDef, _component, state) {
const $global = out.global;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"use strict";
var http = require("http");
var html = require("marko/dist/runtime/html");
var _marko_renderer = require("marko/dist/runtime/components/renderer");
var _marko_tag = require("marko/dist/runtime/helpers/render-tag");
var index_js = require("marko/dist/runtime/html/index.js");
var _marko_renderer = require("marko/dist/runtime/components/renderer.js");
var _marko_tag = require("marko/dist/runtime/helpers/render-tag.js");
function _interopDefaultLegacy(e) {
return e && typeof e === "object" && "default" in e ? e : { "default": e };
}
var http__default = /* @__PURE__ */ _interopDefaultLegacy(http);
var _marko_renderer__default = /* @__PURE__ */ _interopDefaultLegacy(_marko_renderer);
var _marko_tag__default = /* @__PURE__ */ _interopDefaultLegacy(_marko_tag);
const _marko_componentType$2 = "71MAcDxK", _marko_template$2 = html.t(_marko_componentType$2);
const _marko_componentType$2 = "71MAcDxK", _marko_template$2 = index_js.t(_marko_componentType$2);
const _marko_component$2 = {
onMount() {
console.log("mounted");
Expand All @@ -20,7 +20,7 @@ _marko_template$2._ = _marko_renderer__default["default"](function(input, out, _
}, {
t: _marko_componentType$2
}, _marko_component$2);
const _marko_componentType$1 = "c1uTHRl3", _marko_template$1 = html.t(_marko_componentType$1);
const _marko_componentType$1 = "c1uTHRl3", _marko_template$1 = index_js.t(_marko_componentType$1);
const _marko_component$1 = {};
_marko_template$1._ = _marko_renderer__default["default"](function(input, out, _componentDef, _component, state) {
out.w("<div id=implicit>");
Expand All @@ -30,7 +30,7 @@ _marko_template$1._ = _marko_renderer__default["default"](function(input, out, _
t: _marko_componentType$1,
i: true
}, _marko_component$1);
const _marko_componentType = "gaG2ehQw", _marko_template = html.t(_marko_componentType);
const _marko_componentType = "gaG2ehQw", _marko_template = index_js.t(_marko_componentType);
const _marko_component = {};
_marko_template._ = _marko_renderer__default["default"](function(input, out, _componentDef, _component, state) {
out.w("<div id=page>");
Expand Down
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type * as vite from "vite";
import type * as Compiler from "@marko/compiler";

import os from "os";
import fs from "fs";
import path from "path";
import crypto from "crypto";
import { pathToFileURL } from "url";
import * as vite from "vite";
import anyMatch from "anymatch";
import type * as Compiler from "@marko/compiler";
import getServerEntryTemplate from "./server-entry-template";
import {
generateInputDoc,
Expand Down Expand Up @@ -272,7 +273,7 @@ export default function markoPlugin(opts: Options = {}): vite.Plugin[] {
isBuild &&
importer &&
isMarkoFile(importee) &&
this.getModuleInfo(importer)!.isEntry
this.getModuleInfo(importer)?.isEntry
) {
importeeQuery = browserEntryQuery;
}
Expand Down
14 changes: 11 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
{
"include": ["src/**/*"],
"compilerOptions": {
"lib": ["dom", "ESNext", "scripthost"],
"lib": ["dom", "ESNext"],
"strict": true,
"outDir": "dist",
"target": "ESNext",
"module": "ESNext",
"sourceMap": false,
"declaration": true,
"incremental": true,
"module": "ESNext",
"stripInternal": true,
"noUnusedLocals": true,
"isolatedModules": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"preserveConstEnums": true,
"noUnusedParameters": true,
"allowUnusedLabels": false,
"noImplicitReturns": false,
"noImplicitOverride": true,
"emitDeclarationOnly": true,
"allowUnreachableCode": false,
"importsNotUsedAsValues": "error",
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true
}
Expand Down

0 comments on commit 38afc12

Please sign in to comment.