tailwindcss 0.0.0-oxide-insiders.07fe8bf → 0.0.0-oxide-insiders.019fddb

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.
@@ -0,0 +1,40 @@
1
+ let fs = require('fs')
2
+ let path = require('path')
3
+
4
+ let engines = {
5
+ stable: {
6
+ files: [
7
+ path.resolve(__dirname, '..', 'package.stable.json'),
8
+ path.resolve(__dirname, '..', 'package-lock.stable.json'),
9
+ ],
10
+ },
11
+ oxide: {
12
+ files: [
13
+ path.resolve(__dirname, '..', 'package.oxide.json'),
14
+ path.resolve(__dirname, '..', 'package-lock.oxide.json'),
15
+ ],
16
+ },
17
+ }
18
+
19
+ // Find out what the current engine is that we are using:
20
+ let [otherEngine, info] = Object.entries(engines).find(([, info]) =>
21
+ info.files.every((file) => fs.existsSync(file))
22
+ )
23
+ let currentEngine = otherEngine === 'oxide' ? 'stable' : 'oxide'
24
+
25
+ console.log(`Current engine: \`${currentEngine}\`, swapping to \`${otherEngine}\``)
26
+
27
+ // Swap the engines
28
+ for (let file of info.files) {
29
+ fs.renameSync(
30
+ file.replace(`.${otherEngine}`, ''),
31
+ file.replace(`.${otherEngine}`, `.${currentEngine}`)
32
+ )
33
+ }
34
+ for (let file of engines[otherEngine].files) {
35
+ fs.renameSync(file, file.replace(`.${otherEngine}`, ''))
36
+ }
37
+
38
+ console.log(
39
+ 'Engines have been swapped. Make sure to run `npm install` to update your dependencies.'
40
+ )
@@ -10,7 +10,7 @@ import loadOptions from 'postcss-load-config/src/options' // Little bit scary, l
10
10
  import tailwind from '../../processTailwindFeatures'
11
11
  import { loadAutoprefixer, loadCssNano, loadPostcss, loadPostcssImport } from './deps'
12
12
  import { formatNodes, drainStdin, outputFile } from './utils'
13
- import { env } from '../shared'
13
+ import { env } from '../../lib/sharedState'
14
14
  import resolveConfig from '../../../resolveConfig.js'
15
15
  import getModuleDependencies from '../../lib/getModuleDependencies.js'
16
16
  import { parseCandidateFiles } from '../../lib/content.js'
@@ -1,7 +1,11 @@
1
+ import pkg from '../../package.json'
2
+ let OXIDE_DEFAULT_ENABLED = pkg.tailwindcss.engine === 'oxide'
3
+
1
4
  export const env = {
2
5
  NODE_ENV: process.env.NODE_ENV,
3
6
  DEBUG: resolveDebug(process.env.DEBUG),
4
- OXIDE: process.env.OXIDE,
7
+ ENGINE: pkg.tailwindcss.engine,
8
+ OXIDE: resolveBoolean(process.env.OXIDE, OXIDE_DEFAULT_ENABLED),
5
9
  }
6
10
  export const contextMap = new Map()
7
11
  export const configContextMap = new Map()
@@ -11,6 +15,18 @@ export const NOT_ON_DEMAND = new String('*')
11
15
 
12
16
  export const NONE = Symbol('__NONE__')
13
17
 
18
+ function resolveBoolean(value, defaultValue) {
19
+ if (value === undefined) {
20
+ return defaultValue
21
+ }
22
+
23
+ if (value === '0' || value === 'false') {
24
+ return false
25
+ }
26
+
27
+ return true
28
+ }
29
+
14
30
  export function resolveDebug(debug) {
15
31
  if (debug === undefined) {
16
32
  return false
@@ -8,7 +8,7 @@ import loadOptions from 'postcss-load-config/src/options' // Little bit scary, l
8
8
  import tailwind from '../../../processTailwindFeatures'
9
9
  import { loadPostcss, loadPostcssImport, lightningcss } from './deps'
10
10
  import { formatNodes, drainStdin, outputFile } from './utils'
11
- import { env } from '../shared'
11
+ import { env } from '../../../lib/sharedState'
12
12
  import resolveConfig from '../../../../resolveConfig'
13
13
  import getModuleDependencies from '../../../lib/getModuleDependencies'
14
14
  import { parseCandidateFiles } from '../../../lib/content'