marko 5.39.48 → 5.39.49
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/bin/markoc.js +11 -3
- package/dist/node-require/index.js +4 -5
- package/dist/runtime/components/legacy/dependencies/index.js +6 -2
- package/dist/translator/util/add-dependencies.js +2 -2
- package/docs/class-components.md +6 -6
- package/docs/express.md +2 -1
- package/docs/fastify.md +2 -1
- package/docs/http.md +1 -0
- package/docs/koa.md +1 -0
- package/docs/marko-vs-react.md +2 -1
- package/docs/redux.md +1 -0
- package/docs/rendering.md +2 -0
- package/docs/rollup.md +5 -3
- package/docs/vite.md +1 -1
- package/docs/webpack.md +1 -0
- package/package.json +7 -8
- package/src/node-require/index.js +4 -5
- package/src/runtime/components/legacy/dependencies/index.js +5 -1
- package/src/translator/util/add-dependencies.js +1 -1
package/bin/markoc.js
CHANGED
|
@@ -95,13 +95,13 @@ var args = require("argly")
|
|
|
95
95
|
})
|
|
96
96
|
.parse();
|
|
97
97
|
var Minimatch = require("minimatch").Minimatch;
|
|
98
|
-
var
|
|
98
|
+
var cwdRequire = require("module").createRequire(nodePath.join(cwd, "_"));
|
|
99
99
|
|
|
100
100
|
// Try to use the Marko compiler installed with the project
|
|
101
|
-
var markoCompilerPath =
|
|
101
|
+
var markoCompilerPath = tryResolve("marko/compiler");
|
|
102
102
|
const markocPkgVersion = require("../package.json").version;
|
|
103
103
|
|
|
104
|
-
var markoPkgPath =
|
|
104
|
+
var markoPkgPath = tryResolve("marko/package.json");
|
|
105
105
|
var markoPkgVersion = markoPkgPath && require(markoPkgPath).version;
|
|
106
106
|
|
|
107
107
|
var markoCompiler = markoCompilerPath
|
|
@@ -439,3 +439,11 @@ if (args.clean) {
|
|
|
439
439
|
);
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
|
+
|
|
443
|
+
function tryResolve(id) {
|
|
444
|
+
try {
|
|
445
|
+
return cwdRequire.resolve(id);
|
|
446
|
+
} catch {
|
|
447
|
+
return undefined;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// eslint-disable-next-line no-constant-binary-expression
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
const resolveFrom = require("resolve-from");
|
|
4
|
+
const { createRequire } = require("module");
|
|
6
5
|
const requiredCompilerOptions = { modules: "cjs" };
|
|
7
6
|
const defaultCompilerOptions = {
|
|
8
7
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -67,9 +66,9 @@ function install(options) {
|
|
|
67
66
|
|
|
68
67
|
function markoRequireExtension(module, filename) {
|
|
69
68
|
// Resolve the appropriate compiler relative to the location of the
|
|
70
|
-
// marko template file on disk
|
|
71
|
-
var
|
|
72
|
-
|
|
69
|
+
// marko template file on disk.
|
|
70
|
+
var markoCompilerModulePath =
|
|
71
|
+
createRequire(filename).resolve("@marko/compiler");
|
|
73
72
|
var markoCompiler = require(markoCompilerModulePath);
|
|
74
73
|
|
|
75
74
|
// Now use the appropriate Marko compiler to compile the Marko template
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";var nodePath = require("path");
|
|
2
|
-
var
|
|
2
|
+
var createRequire = require("module").createRequire;
|
|
3
3
|
var env = process.env.NODE_ENV;
|
|
4
4
|
var production = !env || env !== "development";
|
|
5
5
|
|
|
@@ -174,4 +174,8 @@ function patch(Template) {
|
|
|
174
174
|
|
|
175
175
|
exports.getDeps = getRootDeps;
|
|
176
176
|
exports.resolveDep = resolveDep;
|
|
177
|
-
exports.patch = patch;
|
|
177
|
+
exports.patch = patch;
|
|
178
|
+
|
|
179
|
+
function defaultResolveFrom(dir, id) {
|
|
180
|
+
return createRequire(nodePath.join(dir, "_")).resolve(id);
|
|
181
|
+
}
|
|
@@ -7,7 +7,7 @@ var _babelUtils = require("@marko/compiler/babel-utils");
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _modules = _interopRequireDefault(require("@marko/compiler/modules"));
|
|
10
|
-
var _magicString =
|
|
10
|
+
var _magicString = require("magic-string");function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
|
|
11
11
|
const kEntryState = Symbol();
|
|
12
12
|
const lassoDepPrefix = "package: ";var _default =
|
|
13
13
|
|
|
@@ -219,7 +219,7 @@ function addBrowserImports(seenImports, lassoDeps, body, file, entryFile) {
|
|
|
219
219
|
let map;
|
|
220
220
|
|
|
221
221
|
if (sourceMaps && dep.startPos !== undefined) {
|
|
222
|
-
s = s || new _magicString.
|
|
222
|
+
s = s || new _magicString.MagicString(file.code, { filename });
|
|
223
223
|
map = s.snip(dep.startPos, dep.endPos).generateMap({
|
|
224
224
|
source: filename,
|
|
225
225
|
includeContent: true
|
package/docs/class-components.md
CHANGED
|
@@ -871,12 +871,12 @@ Each lifecycle event has a corresponding component lifecycle method that can lis
|
|
|
871
871
|
|
|
872
872
|
```js
|
|
873
873
|
class {
|
|
874
|
-
onCreate(input, out) {
|
|
875
|
-
onInput(input, out) {
|
|
876
|
-
onRender(out) {
|
|
877
|
-
onMount() {
|
|
878
|
-
onUpdate() {
|
|
879
|
-
onDestroy() {
|
|
874
|
+
onCreate(input, out) {}
|
|
875
|
+
onInput(input, out) {}
|
|
876
|
+
onRender(out) {}
|
|
877
|
+
onMount() {}
|
|
878
|
+
onUpdate() {}
|
|
879
|
+
onDestroy() {}
|
|
880
880
|
}
|
|
881
881
|
```
|
|
882
882
|
|
package/docs/express.md
CHANGED
|
@@ -32,8 +32,9 @@ Express’s builtin view engine may be asynchronous, but it doesn’t support st
|
|
|
32
32
|
> **ProTip**: By using `res.marko()`, properties from [`app.locals`](https://expressjs.com/en/api.html#app.locals) and [`res.locals`](https://expressjs.com/en/api.html#res.locals) are automatically [available on `$global`](https://markojs.com/docs/rendering/#global-data).
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
|
-
import express from "express";
|
|
36
35
|
import markoPlugin from "@marko/express";
|
|
36
|
+
import express from "express";
|
|
37
|
+
|
|
37
38
|
import template from "./template.marko";
|
|
38
39
|
|
|
39
40
|
const app = express();
|
package/docs/fastify.md
CHANGED
|
@@ -24,8 +24,9 @@ The [`@marko/fastify`](https://github.com/marko-js/fastify/) adds a `reply.marko
|
|
|
24
24
|
By using `reply.marko` you'll automatically have access to `app.locals`, and `reply.locals` from within your Marko template and custom tags. These values are added to `$global`.
|
|
25
25
|
|
|
26
26
|
```javascript
|
|
27
|
-
import fastify from "fastify";
|
|
28
27
|
import markoPlugin from "@marko/fastify";
|
|
28
|
+
import fastify from "fastify";
|
|
29
|
+
|
|
29
30
|
import Template from "./template.marko";
|
|
30
31
|
|
|
31
32
|
const app = fastify();
|
package/docs/http.md
CHANGED
package/docs/koa.md
CHANGED
package/docs/marko-vs-react.md
CHANGED
|
@@ -663,8 +663,8 @@ var html = ReactDOMServer.renderToString(<HelloMessage name="John" />);
|
|
|
663
663
|
With React, all custom tags for UI components must be explicitly imported:
|
|
664
664
|
|
|
665
665
|
```jsx
|
|
666
|
-
import Hello from "./components/Hello";
|
|
667
666
|
import GoodBye from "./components/GoodBye";
|
|
667
|
+
import Hello from "./components/Hello";
|
|
668
668
|
|
|
669
669
|
export default function HelloGoodBye(props) {
|
|
670
670
|
return (
|
|
@@ -770,6 +770,7 @@ Markdown to HTML at _compile-time_:
|
|
|
770
770
|
|
|
771
771
|
```js
|
|
772
772
|
import marked from "marked";
|
|
773
|
+
|
|
773
774
|
import { removeIndentation } from "./util";
|
|
774
775
|
|
|
775
776
|
export default function generateCode(el, codegen) {
|
package/docs/redux.md
CHANGED
package/docs/rendering.md
CHANGED
|
@@ -104,6 +104,7 @@ The HTML output is written to the passed `stream`. Render errors are emitted as
|
|
|
104
104
|
|
|
105
105
|
```js
|
|
106
106
|
import http from "http";
|
|
107
|
+
|
|
107
108
|
import View from "./view.marko";
|
|
108
109
|
|
|
109
110
|
http.createServer((req, res) => {
|
|
@@ -177,6 +178,7 @@ The `stream` method returns a Node.js-style stream of the output HTML.
|
|
|
177
178
|
|
|
178
179
|
```js
|
|
179
180
|
import fs from "fs";
|
|
181
|
+
|
|
180
182
|
import View from "./view.marko";
|
|
181
183
|
const writeStream = fs.createWriteStream("output.html");
|
|
182
184
|
|
package/docs/rollup.md
CHANGED
|
@@ -80,16 +80,18 @@ The following configuration file is long and hairy, which may be upsetting to so
|
|
|
80
80
|
```js
|
|
81
81
|
import { builtinModules } from "module";
|
|
82
82
|
import path from "path";
|
|
83
|
-
|
|
83
|
+
|
|
84
|
+
import markoPlugin from "@marko/rollup";
|
|
84
85
|
import babelPlugin from "@rollup/plugin-babel";
|
|
85
86
|
import commonjsPlugin from "@rollup/plugin-commonjs";
|
|
86
87
|
import jsonPlugin from "@rollup/plugin-json";
|
|
87
|
-
import markoPlugin from "@marko/rollup";
|
|
88
88
|
import nodeResolvePlugin from "@rollup/plugin-node-resolve";
|
|
89
89
|
import replacePlugin from "@rollup/plugin-replace";
|
|
90
90
|
import runPlugin from "@rollup/plugin-run";
|
|
91
|
-
import stylesPlugin from "rollup-plugin-styles";
|
|
92
91
|
import urlPlugin from "@rollup/plugin-url";
|
|
92
|
+
import autoprefixer from "autoprefixer";
|
|
93
|
+
import stylesPlugin from "rollup-plugin-styles";
|
|
94
|
+
|
|
93
95
|
import pkg from "./package.json";
|
|
94
96
|
|
|
95
97
|
const __DEV__ = process.env.NODE_ENV === "development";
|
package/docs/vite.md
CHANGED
package/docs/webpack.md
CHANGED
|
@@ -127,6 +127,7 @@ For example, with the Webpack internationalization plugin, you might have a conf
|
|
|
127
127
|
```js
|
|
128
128
|
import MarkoPlugin from "@marko/webpack/plugin";
|
|
129
129
|
import I18nPlugin from "i18n-webpack-plugin";
|
|
130
|
+
|
|
130
131
|
import germanTranslations from "./de.json";
|
|
131
132
|
|
|
132
133
|
const languages = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "5.39.
|
|
3
|
+
"version": "5.39.49",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
|
6
6
|
"keywords": [
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"types": "index.d.ts",
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@marko/compiler": "^5.42.
|
|
71
|
-
"@marko/runtime-tags": "^6.4.
|
|
70
|
+
"@marko/compiler": "^5.42.16",
|
|
71
|
+
"@marko/runtime-tags": "^6.4.10",
|
|
72
72
|
"app-module-path": "^2.2.0",
|
|
73
73
|
"argly": "^1.2.0",
|
|
74
74
|
"browser-refresh-client": "1.1.4",
|
|
@@ -76,18 +76,17 @@
|
|
|
76
76
|
"csstype": "^3.2.3",
|
|
77
77
|
"events-light": "^1.0.5",
|
|
78
78
|
"listener-tracker": "^2.0.0",
|
|
79
|
-
"magic-string": "^
|
|
80
|
-
"minimatch": "^
|
|
79
|
+
"magic-string": "^1.4.5",
|
|
80
|
+
"minimatch": "^11.0.4",
|
|
81
81
|
"raptor-util": "^3.2.0",
|
|
82
|
-
"resolve-from": "^5.0.0",
|
|
83
82
|
"self-closing-tags": "^1.0.1",
|
|
84
83
|
"warp10": "^2.1.0"
|
|
85
84
|
},
|
|
86
85
|
"devDependencies": {
|
|
87
|
-
"marko": "5.39.
|
|
86
|
+
"marko": "5.39.49"
|
|
88
87
|
},
|
|
89
88
|
"engines": {
|
|
90
|
-
"node": ">=22"
|
|
89
|
+
"node": ">=22.12.0"
|
|
91
90
|
},
|
|
92
91
|
"logo": {
|
|
93
92
|
"url": "https://raw.githubusercontent.com/marko-js/branding/master/marko-logo-small.png"
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// eslint-disable-next-line no-constant-binary-expression
|
|
3
3
|
const complain = "MARKO_DEBUG" && require("complain");
|
|
4
|
-
const
|
|
5
|
-
const resolveFrom = require("resolve-from");
|
|
4
|
+
const { createRequire } = require("module");
|
|
6
5
|
const requiredCompilerOptions = { modules: "cjs" };
|
|
7
6
|
const defaultCompilerOptions = {
|
|
8
7
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -67,9 +66,9 @@ function install(options) {
|
|
|
67
66
|
|
|
68
67
|
function markoRequireExtension(module, filename) {
|
|
69
68
|
// Resolve the appropriate compiler relative to the location of the
|
|
70
|
-
// marko template file on disk
|
|
71
|
-
var
|
|
72
|
-
|
|
69
|
+
// marko template file on disk.
|
|
70
|
+
var markoCompilerModulePath =
|
|
71
|
+
createRequire(filename).resolve("@marko/compiler");
|
|
73
72
|
var markoCompiler = require(markoCompilerModulePath);
|
|
74
73
|
|
|
75
74
|
// Now use the appropriate Marko compiler to compile the Marko template
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var nodePath = require("path");
|
|
2
|
-
var
|
|
2
|
+
var createRequire = require("module").createRequire;
|
|
3
3
|
var env = process.env.NODE_ENV;
|
|
4
4
|
var production = !env || env !== "development";
|
|
5
5
|
|
|
@@ -175,3 +175,7 @@ function patch(Template) {
|
|
|
175
175
|
exports.getDeps = getRootDeps;
|
|
176
176
|
exports.resolveDep = resolveDep;
|
|
177
177
|
exports.patch = patch;
|
|
178
|
+
|
|
179
|
+
function defaultResolveFrom(dir, id) {
|
|
180
|
+
return createRequire(nodePath.join(dir, "_")).resolve(id);
|
|
181
|
+
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
resolveRelativePath,
|
|
8
8
|
} from "@marko/compiler/babel-utils";
|
|
9
9
|
import markoModules from "@marko/compiler/modules";
|
|
10
|
-
import MagicString from "magic-string";
|
|
10
|
+
import { MagicString } from "magic-string";
|
|
11
11
|
const kEntryState = Symbol();
|
|
12
12
|
const lassoDepPrefix = "package: ";
|
|
13
13
|
|