@zipadee/javascript 0.0.17 → 0.0.19
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/README.md +14 -4
- package/lib/attributes.d.ts +2 -0
- package/lib/attributes.d.ts.map +1 -0
- package/lib/attributes.js +160 -0
- package/lib/attributes.js.map +1 -0
- package/lib/serve.d.ts +5 -0
- package/lib/serve.d.ts.map +1 -1
- package/lib/serve.js +77 -26
- package/lib/serve.js.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -29,7 +29,17 @@ app.listen();
|
|
|
29
29
|
|
|
30
30
|
## Options
|
|
31
31
|
|
|
32
|
-
- `base`: The directory that paths are resolved against to find on disk. This
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- `
|
|
32
|
+
- `base`: The directory that paths are resolved against to find on disk. This
|
|
33
|
+
directory is typically where first-party JavaScript files are located. Must be
|
|
34
|
+
a subpath of `root`. Defaults to the value of `root`.
|
|
35
|
+
- `root`: The root directory that files are restricted to. Import specifiers can
|
|
36
|
+
resolve to a path outside of `base` (this is common with npm dependencies, and
|
|
37
|
+
monorepos), but they are disallowed to be served from outside of `root`.
|
|
38
|
+
Defaults to the current working directory.
|
|
39
|
+
- `rootPathPrefix`: Imports that resolve to outside of the base directory are
|
|
40
|
+
prefixed with the `rootPathPrefix` in order to resolve them against the `root`
|
|
41
|
+
directory instead of the `base` directory. Defaults to `'/__root__'`.
|
|
42
|
+
- `extensions`: Array of file extensions to serve. Defaults to `['.js',
|
|
43
|
+
'.mjs']`. Files not matching these extensions will not be handled by this
|
|
44
|
+
middleware. They can be served by other downstream middleware.
|
|
45
|
+
- `conditions`: Array of import conditions to support. Defaults to `['browser', 'import']`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../src/lib/attributes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses import attributes from a source string.
|
|
3
|
+
*
|
|
4
|
+
* Import attributes are similar to JSON or an object literal. They're a
|
|
5
|
+
* key-value object, where the keys do not need to be quoted, and the values
|
|
6
|
+
* must be quoted strings. Key-value pairs are separated by commas, and
|
|
7
|
+
* whitespace is ignored.
|
|
8
|
+
*
|
|
9
|
+
* @param source - The source string containing just the import attributes.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export const parseImportAttributes = (expr) => new Parser(expr).parse();
|
|
14
|
+
const isWhitespace = (ch) =>
|
|
15
|
+
ch === 9 /* \t */ ||
|
|
16
|
+
ch === 10 /* \n */ ||
|
|
17
|
+
ch === 13 /* \r */ ||
|
|
18
|
+
ch === 32; /* space */
|
|
19
|
+
// TODO(justinfagnani): allow code points > 127
|
|
20
|
+
const isIdentStart = (ch) =>
|
|
21
|
+
ch === 95 /* _ */ ||
|
|
22
|
+
ch === 36 /* $ */ ||
|
|
23
|
+
// ch &= ~32 puts ch into the range [65,90] [A-Z] only if ch was already in
|
|
24
|
+
// the that range or in the range [97,122] [a-z]. We must mutate ch only after
|
|
25
|
+
// checking other characters, thus the comma operator.
|
|
26
|
+
((ch &= ~32), 65 /* A */ <= ch && ch <= 90); /* Z */
|
|
27
|
+
// TODO(justinfagnani): allow code points > 127
|
|
28
|
+
const isIdentifier = (ch) => isIdentStart(ch);
|
|
29
|
+
const isQuote = (ch) => ch === 34 /* " */ || ch === 39; /* ' */
|
|
30
|
+
const escapeString = (str) =>
|
|
31
|
+
str.replace(/\\(.)/g, (_match, group) => {
|
|
32
|
+
switch (group) {
|
|
33
|
+
case 'n':
|
|
34
|
+
return '\n';
|
|
35
|
+
case 'r':
|
|
36
|
+
return '\r';
|
|
37
|
+
case 't':
|
|
38
|
+
return '\t';
|
|
39
|
+
case 'b':
|
|
40
|
+
return '\b';
|
|
41
|
+
case 'f':
|
|
42
|
+
return '\f';
|
|
43
|
+
default:
|
|
44
|
+
return group;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
class Parser {
|
|
48
|
+
#input;
|
|
49
|
+
#index = -1;
|
|
50
|
+
#tokenStart = 0;
|
|
51
|
+
#next;
|
|
52
|
+
constructor(input) {
|
|
53
|
+
this.#input = input;
|
|
54
|
+
this.#advance();
|
|
55
|
+
}
|
|
56
|
+
parse() {
|
|
57
|
+
this.#parseMapStart();
|
|
58
|
+
const entries = new Map();
|
|
59
|
+
do {
|
|
60
|
+
this.#advanceWhitespace();
|
|
61
|
+
if (this.#next === 125 /* } */) {
|
|
62
|
+
break; // end of map
|
|
63
|
+
}
|
|
64
|
+
const key = this.#parseKey();
|
|
65
|
+
this.#parseColon();
|
|
66
|
+
const value = this.#parseString();
|
|
67
|
+
entries.set(key, value);
|
|
68
|
+
} while (this.#parseCommaOrMapEnd());
|
|
69
|
+
return entries;
|
|
70
|
+
}
|
|
71
|
+
#advance(resetTokenStart) {
|
|
72
|
+
this.#index++;
|
|
73
|
+
if (this.#index < this.#input.length) {
|
|
74
|
+
this.#next = this.#input.charCodeAt(this.#index);
|
|
75
|
+
if (resetTokenStart === true) {
|
|
76
|
+
this.#tokenStart = this.#index;
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
this.#next = undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
#advanceWhitespace() {
|
|
83
|
+
const l = this.#input.length;
|
|
84
|
+
let index = this.#index;
|
|
85
|
+
let char = this.#next;
|
|
86
|
+
while (index < l && isWhitespace(char)) {
|
|
87
|
+
char = this.#input.charCodeAt(++index);
|
|
88
|
+
}
|
|
89
|
+
this.#tokenStart = this.#index = index;
|
|
90
|
+
this.#next = char;
|
|
91
|
+
}
|
|
92
|
+
#getValue() {
|
|
93
|
+
const v = this.#input.substring(this.#tokenStart, this.#index);
|
|
94
|
+
this.#tokenStart = this.#index;
|
|
95
|
+
return v;
|
|
96
|
+
}
|
|
97
|
+
#parseColon() {
|
|
98
|
+
this.#advanceWhitespace();
|
|
99
|
+
if (this.#next === 58 /* : */) {
|
|
100
|
+
this.#advance();
|
|
101
|
+
} else {
|
|
102
|
+
throw new Error(`Expected :, got ${this.#next}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
#parseString() {
|
|
106
|
+
this.#advanceWhitespace();
|
|
107
|
+
const quoteChar = this.#next;
|
|
108
|
+
this.#advance(true);
|
|
109
|
+
while (this.#next !== quoteChar) {
|
|
110
|
+
if (this.#next === undefined) {
|
|
111
|
+
throw new Error('unterminated string');
|
|
112
|
+
}
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
if (this.#next === 92 /* \ */) {
|
|
115
|
+
this.#advance();
|
|
116
|
+
if (this.#next === undefined) {
|
|
117
|
+
throw new Error('unterminated string');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
this.#advance();
|
|
121
|
+
}
|
|
122
|
+
const value = escapeString(this.#getValue());
|
|
123
|
+
this.#advance();
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
#parseKey() {
|
|
127
|
+
this.#advanceWhitespace();
|
|
128
|
+
if (isQuote(this.#next)) {
|
|
129
|
+
return this.#parseString();
|
|
130
|
+
} else if (isIdentStart(this.#next)) {
|
|
131
|
+
do {
|
|
132
|
+
this.#advance();
|
|
133
|
+
} while (isIdentifier(this.#next));
|
|
134
|
+
return this.#getValue();
|
|
135
|
+
} else {
|
|
136
|
+
throw new Error(`expected string or identifier, got ${this.#next}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
#parseMapStart() {
|
|
140
|
+
this.#advanceWhitespace();
|
|
141
|
+
if (this.#next === 123 /* { */) {
|
|
142
|
+
this.#advance(true);
|
|
143
|
+
} else {
|
|
144
|
+
throw new Error(`expected {, got ${this.#next}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
#parseCommaOrMapEnd() {
|
|
148
|
+
this.#advanceWhitespace();
|
|
149
|
+
if (this.#next === 125 /* } */) {
|
|
150
|
+
this.#advance();
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
if (this.#next === 44 /* , */) {
|
|
154
|
+
this.#advance();
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
throw new Error(`expected }, got ${this.#next}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../src/lib/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAuB,EAAE,CACzE,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;AAE3B,MAAM,YAAY,GAAG,CAAC,EAAU,EAAE,EAAE,CAClC,EAAE,KAAK,CAAC,CAAC,QAAQ;IACjB,EAAE,KAAK,EAAE,CAAC,QAAQ;IAClB,EAAE,KAAK,EAAE,CAAC,QAAQ;IAClB,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW;AAExB,+CAA+C;AAC/C,MAAM,YAAY,GAAG,CAAC,EAAU,EAAE,EAAE,CAClC,EAAE,KAAK,EAAE,CAAC,OAAO;IACjB,EAAE,KAAK,EAAE,CAAC,OAAO;IACjB,2EAA2E;IAC3E,8EAA8E;IAC9E,sDAAsD;IACtD,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO;AAEtD,+CAA+C;AAC/C,MAAM,YAAY,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAEtD,MAAM,OAAO,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,OAAO,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO;AAEvE,MAAM,YAAY,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AC;QAC1B,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;YAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,mBAAmB;QACjB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;YAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC;YAC9B,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;CACF"}
|
package/lib/serve.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ export interface Options {
|
|
|
25
25
|
* Array of import conditions to support. Defaults to `['browser', 'import']`.
|
|
26
26
|
*/
|
|
27
27
|
conditions?: Array<string>;
|
|
28
|
+
/**
|
|
29
|
+
* If true, will transform CSS modules and imports with the `type: 'css'`
|
|
30
|
+
* attribute.
|
|
31
|
+
*/
|
|
32
|
+
cssModules?: boolean;
|
|
28
33
|
}
|
|
29
34
|
/**
|
|
30
35
|
* Serve static JavaScript files from a `root` directory.
|
package/lib/serve.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/lib/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,UAAU,EAAC,MAAM,eAAe,CAAC;AAmBzD,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/lib/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,UAAU,EAAC,MAAM,eAAe,CAAC;AAmBzD,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAYD;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,MAAM,OAAO,KAAG,UAkOrC,CAAC"}
|
package/lib/serve.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { HttpError } from '@zipadee/core';
|
|
2
|
-
import { decodePath, pathIsHidden, resolvePath, stat, } from '@zipadee/static/lib/utils.js';
|
|
3
2
|
import { send } from '@zipadee/static';
|
|
4
|
-
import
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { parse, init } from 'es-module-lexer';
|
|
7
|
-
// import {moduleResolve, type ErrnoException} from 'import-meta-resolve';
|
|
3
|
+
import { decodePath, pathIsHidden, resolvePath, stat, } from '@zipadee/static/lib/utils.js';
|
|
8
4
|
import resolve from 'enhanced-resolve';
|
|
5
|
+
import { init, parse } from 'es-module-lexer';
|
|
9
6
|
import baseFS from 'fs';
|
|
7
|
+
import fs from 'node:fs/promises';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { parseImportAttributes } from './attributes.js';
|
|
10
10
|
const { CachedInputFileSystem, ResolverFactory } = resolve;
|
|
11
11
|
await init;
|
|
12
12
|
// TODO:
|
|
@@ -24,15 +24,12 @@ await init;
|
|
|
24
24
|
export const serve = (opts) => {
|
|
25
25
|
const root = opts.root === undefined ? process.cwd() : path.resolve(opts.root);
|
|
26
26
|
const base = opts.base === undefined ? root : resolvePath(root, opts.base);
|
|
27
|
-
const rootPathPrefix =
|
|
28
|
-
const extensions = opts.extensions ?? ['.js', '.mjs'];
|
|
29
|
-
const conditionsArray = opts.conditions ?? ['browser', 'import'];
|
|
30
|
-
// const conditions = new Set(conditionsArray);
|
|
27
|
+
const { rootPathPrefix = '/__root__', extensions = ['.js', '.mjs'], conditions = ['browser', 'import'], cssModules = false, } = opts;
|
|
31
28
|
const resolver = ResolverFactory.createResolver({
|
|
32
29
|
fileSystem: new CachedInputFileSystem(baseFS, 4000),
|
|
33
30
|
roots: [root, base],
|
|
34
31
|
extensions: ['.js', '.json'],
|
|
35
|
-
conditionNames:
|
|
32
|
+
conditionNames: conditions,
|
|
36
33
|
mainFields: ['module', 'browser', 'main'],
|
|
37
34
|
});
|
|
38
35
|
return async (req, res, next) => {
|
|
@@ -41,9 +38,9 @@ export const serve = (opts) => {
|
|
|
41
38
|
return await next();
|
|
42
39
|
}
|
|
43
40
|
let filePath = decodePath(req.path);
|
|
44
|
-
const mountedPath = req.url.pathname.substring(0, req.url.pathname.length - filePath.length);
|
|
45
41
|
const parsedPath = path.parse(filePath);
|
|
46
|
-
const
|
|
42
|
+
const isCssModule = req.url.searchParams.get('type') === 'css-module';
|
|
43
|
+
const transform = isCssModule || extensions.includes(parsedPath.ext);
|
|
47
44
|
if (filePath.startsWith(rootPathPrefix)) {
|
|
48
45
|
filePath = filePath.substring(rootPathPrefix.length);
|
|
49
46
|
filePath = filePath.slice(parsedPath.root.length);
|
|
@@ -65,15 +62,29 @@ export const serve = (opts) => {
|
|
|
65
62
|
await send(req, res, relativePath, { root });
|
|
66
63
|
return;
|
|
67
64
|
}
|
|
65
|
+
if (isCssModule) {
|
|
66
|
+
const source = await fs.readFile(filePath, 'utf8');
|
|
67
|
+
res.type = 'text/javascript';
|
|
68
|
+
res.body = `const styleSheet = new CSSStyleSheet();
|
|
69
|
+
styleSheet.replaceSync(\`${source.replace(/`/g, '\\`')}\`);
|
|
70
|
+
export default styleSheet;
|
|
71
|
+
`;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
// Derive the mount prefix by removing the request path which mount() sets
|
|
75
|
+
// from the URL path.
|
|
76
|
+
const mountPrefix = req.url.pathname.substring(0, req.url.pathname.length - req.path.length);
|
|
68
77
|
const source = await fs.readFile(filePath, 'utf8');
|
|
69
78
|
const [imports, _exports, _facade, _hasModuleSyntax] = parse(source, filePath);
|
|
70
79
|
let output = '';
|
|
71
80
|
let lastIndex = 0;
|
|
72
81
|
for (const impt of imports) {
|
|
73
|
-
const { t: type, s: start, e:
|
|
82
|
+
const { t: type, s: start, e: specifierEnd, n: unescaped, a: assert, se: importEnd, } = impt;
|
|
74
83
|
if (type === 1) {
|
|
75
84
|
// Static import
|
|
76
|
-
let importSpecifier = unescaped
|
|
85
|
+
let importSpecifier = unescaped ?? source.substring(start, specifierEnd);
|
|
86
|
+
let resolve = false;
|
|
87
|
+
let cssImportTransform = false;
|
|
77
88
|
let relativeImport = false;
|
|
78
89
|
let absoluteImport = false;
|
|
79
90
|
// If the specifier is relative or absolute, and has an extension,
|
|
@@ -85,13 +96,28 @@ export const serve = (opts) => {
|
|
|
85
96
|
// resolved path to be relative to the current file
|
|
86
97
|
relativeImport = importSpecifier.startsWith('.');
|
|
87
98
|
absoluteImport = importSpecifier.startsWith('/');
|
|
99
|
+
resolve = true;
|
|
88
100
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// If the import is not relative or absolute, we need to resolve it
|
|
104
|
+
// using the resolver
|
|
105
|
+
resolve = true;
|
|
106
|
+
}
|
|
107
|
+
const hasAttributes = assert !== -1;
|
|
108
|
+
let attributes;
|
|
109
|
+
if (cssModules && hasAttributes) {
|
|
110
|
+
const attributesSource = source.slice(assert, importEnd);
|
|
111
|
+
attributes = parseImportAttributes(attributesSource);
|
|
112
|
+
if (attributes.get('type') === 'css') {
|
|
113
|
+
cssImportTransform = true;
|
|
93
114
|
}
|
|
94
115
|
}
|
|
116
|
+
if (!resolve && !cssImportTransform) {
|
|
117
|
+
output += `${source.substring(lastIndex, start)}${importSpecifier}`;
|
|
118
|
+
lastIndex = specifierEnd;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
95
121
|
const fileURL = new URL(filePath, 'file://');
|
|
96
122
|
if (absoluteImport) {
|
|
97
123
|
// If the import is absolute, we need to resolve it relative to the
|
|
@@ -116,21 +142,46 @@ export const serve = (opts) => {
|
|
|
116
142
|
if (!resolvedImportPath.startsWith(root)) {
|
|
117
143
|
throw new HttpError(500, undefined, `Attempted to resolve import outside of root:\n root: ${root}\n resolved: ${resolvedImportPath}`);
|
|
118
144
|
}
|
|
119
|
-
let
|
|
145
|
+
let resolvedImport;
|
|
120
146
|
if (relativeImport) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
147
|
+
// For relative imports, we resolve the path relative to the current
|
|
148
|
+
// file. This keeps the rewritten import as similar as possible to the
|
|
149
|
+
// original import. Most likely in this case we're just adding a file
|
|
150
|
+
// extension.
|
|
151
|
+
resolvedImport = path.relative(path.dirname(filePath), resolvedImportPath);
|
|
152
|
+
if (!resolvedImport.startsWith('.')) {
|
|
153
|
+
resolvedImport = './' + resolvedImport;
|
|
124
154
|
}
|
|
125
155
|
}
|
|
126
156
|
else if (resolvedImportPath.startsWith(base)) {
|
|
127
|
-
|
|
157
|
+
// Imports within the base path are rewritten to be relative to the
|
|
158
|
+
// mounted path.
|
|
159
|
+
resolvedImport = resolvedImportPath.substring(base.length);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
resolvedImport = path.join(mountPrefix, rootPathPrefix, resolvedImportPath.substring(root.length));
|
|
163
|
+
}
|
|
164
|
+
if (cssImportTransform) {
|
|
165
|
+
attributes?.delete('type');
|
|
166
|
+
let attributesSource = '';
|
|
167
|
+
if (attributes?.size) {
|
|
168
|
+
const attrs = Array.from(attributes.entries())
|
|
169
|
+
.map(([key, value]) => `${key}: '${value}'`)
|
|
170
|
+
.join(', ');
|
|
171
|
+
attributesSource = ` with {${attrs}}`;
|
|
172
|
+
}
|
|
173
|
+
output +=
|
|
174
|
+
source.substring(lastIndex, start) +
|
|
175
|
+
resolvedImport +
|
|
176
|
+
'?type=css-module' +
|
|
177
|
+
source.substring(specifierEnd, specifierEnd + 1) +
|
|
178
|
+
attributesSource;
|
|
179
|
+
lastIndex = importEnd;
|
|
128
180
|
}
|
|
129
181
|
else {
|
|
130
|
-
|
|
182
|
+
output += source.substring(lastIndex, start) + resolvedImport;
|
|
183
|
+
lastIndex = specifierEnd;
|
|
131
184
|
}
|
|
132
|
-
output += `${source.substring(lastIndex, start)}${resolvedimport}`;
|
|
133
|
-
lastIndex = end;
|
|
134
185
|
}
|
|
135
186
|
}
|
|
136
187
|
res.type = 'text/javascript';
|
package/lib/serve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/lib/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAkB,MAAM,eAAe,CAAC;AACzD,O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|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/es-module-lexer": "^0.4.3",
|
|
26
|
-
"@types/node": "^
|
|
26
|
+
"@types/node": "^22.15.17",
|
|
27
27
|
"@types/supertest": "^6.0.2",
|
|
28
28
|
"supertest": "^7.0.0"
|
|
29
29
|
},
|
|
@@ -57,8 +57,9 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@zipadee/core": "
|
|
61
|
-
"@zipadee/static": "
|
|
60
|
+
"@zipadee/core": "0.0.19",
|
|
61
|
+
"@zipadee/static": "0.0.19",
|
|
62
|
+
"dedent": "^1.6.0",
|
|
62
63
|
"enhanced-resolve": "^5.17.1",
|
|
63
64
|
"es-module-lexer": "^1.5.4"
|
|
64
65
|
}
|