tailwindcss 0.0.0-oxide-insiders.6a2c58a → 0.0.0-oxide-insiders.e046a37
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.
|
@@ -64,7 +64,9 @@ function createWatcher(args, { state , rebuild }) {
|
|
|
64
64
|
// Clear all pending rebuilds for the about-to-be-built files
|
|
65
65
|
changes.forEach((change)=>pendingRebuilds.delete(change.file));
|
|
66
66
|
// Resolve the promise even when the rebuild fails
|
|
67
|
-
return rebuild(changes).then(()=>{}, ()=>{
|
|
67
|
+
return rebuild(changes).then(()=>{}, (e)=>{
|
|
68
|
+
console.error(e.toString());
|
|
69
|
+
});
|
|
68
70
|
}
|
|
69
71
|
/**
|
|
70
72
|
*
|
|
@@ -8,56 +8,89 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
});
|
|
9
9
|
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
10
10
|
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
11
|
-
const _resolve = /*#__PURE__*/ _interopRequireDefault(require("resolve"));
|
|
12
|
-
const _detectiveTypescript = /*#__PURE__*/ _interopRequireDefault(require("detective-typescript"));
|
|
13
11
|
function _interopRequireDefault(obj) {
|
|
14
12
|
return obj && obj.__esModule ? obj : {
|
|
15
13
|
default: obj
|
|
16
14
|
};
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
16
|
+
let jsExtensions = [
|
|
17
|
+
".js",
|
|
18
|
+
".cjs",
|
|
19
|
+
".mjs"
|
|
20
|
+
];
|
|
21
|
+
// Given the current file `a.ts`, we want to make sure that when importing `b` that we resolve
|
|
22
|
+
// `b.ts` before `b.js`
|
|
23
|
+
//
|
|
24
|
+
// E.g.:
|
|
25
|
+
//
|
|
26
|
+
// a.ts
|
|
27
|
+
// b // .ts
|
|
28
|
+
// c // .ts
|
|
29
|
+
// a.js
|
|
30
|
+
// b // .js or .ts
|
|
31
|
+
let jsResolutionOrder = [
|
|
32
|
+
"",
|
|
33
|
+
".js",
|
|
34
|
+
".cjs",
|
|
35
|
+
".mjs",
|
|
36
|
+
".ts",
|
|
37
|
+
".cts",
|
|
38
|
+
".mts",
|
|
39
|
+
".jsx",
|
|
40
|
+
".tsx"
|
|
41
|
+
];
|
|
42
|
+
let tsResolutionOrder = [
|
|
43
|
+
"",
|
|
44
|
+
".ts",
|
|
45
|
+
".cts",
|
|
46
|
+
".mts",
|
|
47
|
+
".tsx",
|
|
48
|
+
".js",
|
|
49
|
+
".cjs",
|
|
50
|
+
".mjs",
|
|
51
|
+
".jsx"
|
|
52
|
+
];
|
|
53
|
+
function resolveWithExtension(file, extensions) {
|
|
54
|
+
// Try to find `./a.ts`, `./a.ts`, ... from `./a`
|
|
55
|
+
for (let ext of extensions){
|
|
56
|
+
let full = `${file}${ext}`;
|
|
57
|
+
if (_fs.default.existsSync(full) && _fs.default.statSync(full).isFile()) {
|
|
58
|
+
return full;
|
|
48
59
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
yield* _getModuleDependencies(depPath);
|
|
56
|
-
} catch (_err) {
|
|
57
|
-
// eslint-disable-next-line no-empty
|
|
60
|
+
}
|
|
61
|
+
// Try to find `./a/index.js` from `./a`
|
|
62
|
+
for (let ext of extensions){
|
|
63
|
+
let full = `${file}/index${ext}`;
|
|
64
|
+
if (_fs.default.existsSync(full)) {
|
|
65
|
+
return full;
|
|
58
66
|
}
|
|
59
67
|
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
function* _getModuleDependencies(filename, base, seen) {
|
|
71
|
+
let ext = _path.default.extname(filename);
|
|
72
|
+
// Try to find the file
|
|
73
|
+
let absoluteFile = resolveWithExtension(_path.default.resolve(base, filename), jsExtensions.includes(ext) ? jsResolutionOrder : tsResolutionOrder);
|
|
74
|
+
if (absoluteFile === null) return; // File doesn't exist
|
|
75
|
+
// Prevent infinite loops when there are circular dependencies
|
|
76
|
+
if (seen.has(absoluteFile)) return; // Already seen
|
|
77
|
+
seen.add(absoluteFile);
|
|
78
|
+
// Mark the file as a dependency
|
|
79
|
+
yield absoluteFile;
|
|
80
|
+
// Resolve new base for new imports/requires
|
|
81
|
+
base = _path.default.dirname(absoluteFile);
|
|
82
|
+
let contents = _fs.default.readFileSync(absoluteFile, "utf-8");
|
|
83
|
+
// Find imports/requires
|
|
84
|
+
for (let match of [
|
|
85
|
+
...contents.matchAll(/import[\s\S]*?['"](.{3,}?)['"]/gi),
|
|
86
|
+
...contents.matchAll(/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi),
|
|
87
|
+
...contents.matchAll(/require\(['"`](.{3,})['"`]\)/gi)
|
|
88
|
+
]){
|
|
89
|
+
// Bail out if it's not a relative file
|
|
90
|
+
if (!match[1].startsWith(".")) continue;
|
|
91
|
+
yield* _getModuleDependencies(match[1], base, seen);
|
|
92
|
+
}
|
|
60
93
|
}
|
|
61
|
-
function getModuleDependencies(
|
|
62
|
-
return new Set(_getModuleDependencies(
|
|
94
|
+
function getModuleDependencies(absoluteFilePath) {
|
|
95
|
+
return new Set(_getModuleDependencies(absoluteFilePath, _path.default.dirname(absoluteFilePath), new Set()));
|
|
63
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "0.0.0-oxide-insiders.
|
|
3
|
+
"version": "0.0.0-oxide-insiders.e046a37",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -70,12 +70,11 @@
|
|
|
70
70
|
"postcss": "^8.0.9"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@tailwindcss/oxide": "0.0.0-oxide-insiders.
|
|
73
|
+
"@tailwindcss/oxide": "0.0.0-oxide-insiders.e046a37",
|
|
74
74
|
"arg": "^5.0.2",
|
|
75
75
|
"browserslist": "^4.21.5",
|
|
76
76
|
"chokidar": "^3.5.3",
|
|
77
77
|
"color-name": "^1.1.4",
|
|
78
|
-
"detective-typescript": "^9.0.0",
|
|
79
78
|
"didyoumean": "^1.2.2",
|
|
80
79
|
"dlv": "^1.1.3",
|
|
81
80
|
"fast-glob": "^3.2.12",
|
|
@@ -1,40 +1,79 @@
|
|
|
1
1
|
import fs from 'fs'
|
|
2
2
|
import path from 'path'
|
|
3
|
-
import resolve from 'resolve'
|
|
4
|
-
import detective from 'detective-typescript'
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
let source = fs.readFileSync(file, 'utf-8')
|
|
8
|
-
return { file, requires: detective(source, { mixedImports: true }) }
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function* _getModuleDependencies(entryFile) {
|
|
12
|
-
yield entryFile
|
|
4
|
+
let jsExtensions = ['.js', '.cjs', '.mjs']
|
|
13
5
|
|
|
14
|
-
|
|
6
|
+
// Given the current file `a.ts`, we want to make sure that when importing `b` that we resolve
|
|
7
|
+
// `b.ts` before `b.js`
|
|
8
|
+
//
|
|
9
|
+
// E.g.:
|
|
10
|
+
//
|
|
11
|
+
// a.ts
|
|
12
|
+
// b // .ts
|
|
13
|
+
// c // .ts
|
|
14
|
+
// a.js
|
|
15
|
+
// b // .js or .ts
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let extensions = [...(isTypeScript ? ['.ts', '.cts', '.mts'] : []), '.js', '.cjs', '.mjs']
|
|
17
|
+
let jsResolutionOrder = ['', '.js', '.cjs', '.mjs', '.ts', '.cts', '.mts', '.jsx', '.tsx']
|
|
18
|
+
let tsResolutionOrder = ['', '.ts', '.cts', '.mts', '.tsx', '.js', '.cjs', '.mjs', '.jsx']
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
for (let
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
20
|
+
function resolveWithExtension(file, extensions) {
|
|
21
|
+
// Try to find `./a.ts`, `./a.ts`, ... from `./a`
|
|
22
|
+
for (let ext of extensions) {
|
|
23
|
+
let full = `${file}${ext}`
|
|
24
|
+
if (fs.existsSync(full) && fs.statSync(full).isFile()) {
|
|
25
|
+
return full
|
|
26
26
|
}
|
|
27
|
+
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// eslint-disable-next-line no-empty
|
|
29
|
+
// Try to find `./a/index.js` from `./a`
|
|
30
|
+
for (let ext of extensions) {
|
|
31
|
+
let full = `${file}/index${ext}`
|
|
32
|
+
if (fs.existsSync(full)) {
|
|
33
|
+
return full
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
return null
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function* _getModuleDependencies(filename, base, seen) {
|
|
41
|
+
let ext = path.extname(filename)
|
|
42
|
+
|
|
43
|
+
// Try to find the file
|
|
44
|
+
let absoluteFile = resolveWithExtension(
|
|
45
|
+
path.resolve(base, filename),
|
|
46
|
+
jsExtensions.includes(ext) ? jsResolutionOrder : tsResolutionOrder
|
|
47
|
+
)
|
|
48
|
+
if (absoluteFile === null) return // File doesn't exist
|
|
49
|
+
|
|
50
|
+
// Prevent infinite loops when there are circular dependencies
|
|
51
|
+
if (seen.has(absoluteFile)) return // Already seen
|
|
52
|
+
seen.add(absoluteFile)
|
|
53
|
+
|
|
54
|
+
// Mark the file as a dependency
|
|
55
|
+
yield absoluteFile
|
|
56
|
+
|
|
57
|
+
// Resolve new base for new imports/requires
|
|
58
|
+
base = path.dirname(absoluteFile)
|
|
59
|
+
|
|
60
|
+
let contents = fs.readFileSync(absoluteFile, 'utf-8')
|
|
61
|
+
|
|
62
|
+
// Find imports/requires
|
|
63
|
+
for (let match of [
|
|
64
|
+
...contents.matchAll(/import[\s\S]*?['"](.{3,}?)['"]/gi),
|
|
65
|
+
...contents.matchAll(/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi),
|
|
66
|
+
...contents.matchAll(/require\(['"`](.{3,})['"`]\)/gi),
|
|
67
|
+
]) {
|
|
68
|
+
// Bail out if it's not a relative file
|
|
69
|
+
if (!match[1].startsWith('.')) continue
|
|
70
|
+
|
|
71
|
+
yield* _getModuleDependencies(match[1], base, seen)
|
|
72
|
+
}
|
|
36
73
|
}
|
|
37
74
|
|
|
38
|
-
export default function getModuleDependencies(
|
|
39
|
-
return new Set(
|
|
75
|
+
export default function getModuleDependencies(absoluteFilePath) {
|
|
76
|
+
return new Set(
|
|
77
|
+
_getModuleDependencies(absoluteFilePath, path.dirname(absoluteFilePath), new Set())
|
|
78
|
+
)
|
|
40
79
|
}
|